Skip to content

Commit

Permalink
Merge branch 'hotfix/1.9.8'
Browse files Browse the repository at this point in the history
  • Loading branch information
Florianisme committed Apr 11, 2024
2 parents e1d532e + a71ede3 commit ddbf708
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 15 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apply from: "$rootProject.projectDir/shared-build.gradle"

android {
defaultConfig {
versionCode 107
versionCode 111
wearAppUnbundled true
}
buildFeatures {
Expand Down
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,9 @@ public void onStartListening() {
@Override
public void onStopListening() {
super.onStopListening();
statusTesterPool.stopStatusTest(device, StatusTestType.TILE);
if (device != null) {
statusTesterPool.stopSingle(device, StatusTestType.TILE);
}
}

abstract int machineAtIndex();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import android.util.Log;

import androidx.annotation.NonNull;

import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.Executors;
Expand Down Expand Up @@ -38,7 +40,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 +71,7 @@ public void scheduleStatusTest(Device device, DeviceStatusListener deviceStatusL
}

@Override
public void stopStatusTest(Device device, StatusTestType testType) {
public void stopSingle(@NonNull 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 +88,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
@@ -1,15 +1,17 @@
package de.florianisme.wakeonlan.ui.list.status.pool;

import androidx.annotation.NonNull;

import de.florianisme.wakeonlan.persistence.models.Device;
import de.florianisme.wakeonlan.ui.list.status.DeviceStatusListener;

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(@NonNull 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);
}
}
}
2 changes: 1 addition & 1 deletion shared-build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ android {
applicationId "de.florianisme.wakeonlan"
minSdk 24
targetSdk 34
versionName "1.9.7"
versionName "1.9.8"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
Expand Down
2 changes: 1 addition & 1 deletion wear/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ android {
compileSdk 33
defaultConfig {
targetSdk 33
versionCode 106
versionCode 110
}
}

Expand Down

0 comments on commit ddbf708

Please sign in to comment.