Skip to content

Commit

Permalink
Rename methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Florianisme committed Apr 5, 2024
1 parent 6eeec10 commit d28cccb
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ static void createAndUpdateStatefulControls(List<String> 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);
Expand All @@ -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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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) {
Expand All @@ -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<Integer, StatusTestItem> updatedList = new HashMap<>(8);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
}
}
}

0 comments on commit d28cccb

Please sign in to comment.