diff --git a/app/src/main/java/de/florianisme/wakeonlan/quickaccess/StatefulControlService.java b/app/src/main/java/de/florianisme/wakeonlan/quickaccess/StatefulControlService.java index 04a5afe..258774e 100644 --- a/app/src/main/java/de/florianisme/wakeonlan/quickaccess/StatefulControlService.java +++ b/app/src/main/java/de/florianisme/wakeonlan/quickaccess/StatefulControlService.java @@ -36,7 +36,7 @@ static void createAndUpdateStatefulControls(List deviceIds, ReplayProces .collect(Collectors.toList()); for (Device device : filteredDevices) { - STATUS_TESTER_POOL.scheduleStatusTest(device, deviceStatus -> { + STATUS_TESTER_POOL.schedule(device, deviceStatus -> { Control control = mapDeviceToStatefulControl(device, deviceStatus == DeviceStatus.ONLINE, context); processor.onNext(control); }, StatusTestType.QUICK_ACCESS); @@ -60,6 +60,6 @@ private static Control mapDeviceToStatefulControl(Device device, boolean toggleO } public static void stopAllStatusTesters() { - STATUS_TESTER_POOL.stopAllStatusTesters(StatusTestType.QUICK_ACCESS); + STATUS_TESTER_POOL.stopAllForType(StatusTestType.QUICK_ACCESS); } } diff --git a/app/src/main/java/de/florianisme/wakeonlan/quicksettings/DeviceTileService.java b/app/src/main/java/de/florianisme/wakeonlan/quicksettings/DeviceTileService.java index 2e6c662..f3b8327 100644 --- a/app/src/main/java/de/florianisme/wakeonlan/quicksettings/DeviceTileService.java +++ b/app/src/main/java/de/florianisme/wakeonlan/quicksettings/DeviceTileService.java @@ -44,7 +44,7 @@ private void updateTileState() { if (optionalMachine.isPresent()) { Device device = optionalMachine.get(); this.device = device; - statusTesterPool.scheduleStatusTest(device, this, StatusTestType.TILE); + statusTesterPool.schedule(device, this, StatusTestType.TILE); tile.setLabel(device.name); if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { @@ -96,7 +96,7 @@ public void onStartListening() { @Override public void onStopListening() { super.onStopListening(); - statusTesterPool.stopStatusTest(device, StatusTestType.TILE); + statusTesterPool.stopSingle(device, StatusTestType.TILE); } abstract int machineAtIndex(); diff --git a/app/src/main/java/de/florianisme/wakeonlan/ui/list/status/pool/PingStatusTesterPool.java b/app/src/main/java/de/florianisme/wakeonlan/ui/list/status/pool/PingStatusTesterPool.java index 8b56846..c203212 100644 --- a/app/src/main/java/de/florianisme/wakeonlan/ui/list/status/pool/PingStatusTesterPool.java +++ b/app/src/main/java/de/florianisme/wakeonlan/ui/list/status/pool/PingStatusTesterPool.java @@ -38,7 +38,7 @@ public static synchronized StatusTesterPool getInstance() { } @Override - public void scheduleStatusTest(Device device, DeviceStatusListener deviceStatusListener, StatusTestType statusTestType) { + public void schedule(Device device, DeviceStatusListener deviceStatusListener, StatusTestType statusTestType) { synchronized (STATUS_LOCK) { StatusTestItem statusTestItem; @@ -69,7 +69,7 @@ public void scheduleStatusTest(Device device, DeviceStatusListener deviceStatusL } @Override - public void stopStatusTest(Device device, StatusTestType testType) { + public void stopSingle(Device device, StatusTestType testType) { Log.d(getClass().getSimpleName(), "Stopping status checks for device " + device.name + " of type " + testType); synchronized (STATUS_LOCK) { @@ -86,7 +86,7 @@ public void stopStatusTest(Device device, StatusTestType testType) { } @Override - public void stopAllStatusTesters(StatusTestType testType) { + public void stopAllForType(StatusTestType testType) { Log.d(getClass().getSimpleName(), "Stopping all status checks of type " + testType); Map updatedList = new HashMap<>(8); diff --git a/app/src/main/java/de/florianisme/wakeonlan/ui/list/status/pool/StatusTesterPool.java b/app/src/main/java/de/florianisme/wakeonlan/ui/list/status/pool/StatusTesterPool.java index ae794b7..d45a408 100644 --- a/app/src/main/java/de/florianisme/wakeonlan/ui/list/status/pool/StatusTesterPool.java +++ b/app/src/main/java/de/florianisme/wakeonlan/ui/list/status/pool/StatusTesterPool.java @@ -5,11 +5,11 @@ public interface StatusTesterPool { - void scheduleStatusTest(Device device, DeviceStatusListener deviceStatusListener, StatusTestType testType); + void schedule(Device device, DeviceStatusListener deviceStatusListener, StatusTestType testType); - void stopStatusTest(Device device, StatusTestType testType); + void stopSingle(Device device, StatusTestType testType); - void stopAllStatusTesters(StatusTestType testType); + void stopAllForType(StatusTestType testType); void pauseAllForType(StatusTestType testType); diff --git a/app/src/main/java/de/florianisme/wakeonlan/ui/list/viewholder/DeviceItemViewHolder.java b/app/src/main/java/de/florianisme/wakeonlan/ui/list/viewholder/DeviceItemViewHolder.java index 74b6cc5..b4c832e 100644 --- a/app/src/main/java/de/florianisme/wakeonlan/ui/list/viewholder/DeviceItemViewHolder.java +++ b/app/src/main/java/de/florianisme/wakeonlan/ui/list/viewholder/DeviceItemViewHolder.java @@ -102,7 +102,7 @@ public void startDeviceStatusQuery(Device device) { deviceStatus.clearAnimation(); deviceStatus.setBackground(AppCompatResources.getDrawable(itemView.getContext(), R.drawable.device_status_unknown)); - statusTesterPool.scheduleStatusTest(device, status -> { + statusTesterPool.schedule(device, status -> { if (status == DeviceStatus.ONLINE) { setAlphaAnimationIfNotSet(); setStatusDrawable(R.drawable.device_status_online); @@ -140,7 +140,7 @@ private void setAlphaAnimationIfNotSet() { public void cancelStatusUpdates() { if (statusTesterPool != null && device != null) { - statusTesterPool.stopStatusTest(device, StatusTestType.LIST); + statusTesterPool.stopSingle(device, StatusTestType.LIST); } } } \ No newline at end of file