diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/qhybrid/QHybridSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/qhybrid/QHybridSupport.java index 6606874fb..19fbb40b7 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/qhybrid/QHybridSupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/qhybrid/QHybridSupport.java @@ -464,6 +464,9 @@ public class QHybridSupport extends QHybridBaseSupport { public void dispose() { LocalBroadcastManager.getInstance(getContext()).unregisterReceiver(commandReceiver); GBApplication.getContext().unregisterReceiver(globalCommandReceiver); + if (watchAdapter != null) { + watchAdapter.dispose(); + } super.dispose(); } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/qhybrid/adapter/WatchAdapter.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/qhybrid/adapter/WatchAdapter.java index 0daafea3a..249cd35f1 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/qhybrid/adapter/WatchAdapter.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/qhybrid/adapter/WatchAdapter.java @@ -172,4 +172,8 @@ public abstract class WatchAdapter { public void handleSetMenuStructure(JSONObject menuStructure) { } + + public void dispose() { + + } } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/qhybrid/adapter/fossil/FossilWatchAdapter.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/qhybrid/adapter/fossil/FossilWatchAdapter.java index 769d61ad0..f49d8762c 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/qhybrid/adapter/fossil/FossilWatchAdapter.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/qhybrid/adapter/fossil/FossilWatchAdapter.java @@ -156,6 +156,16 @@ public class FossilWatchAdapter extends WatchAdapter { getDeviceInfos(); } + @Override + public void dispose() { + if (timeoutLooper != null) { + timeoutHandler.removeCallbacks(requestTimeoutRunnable); + timeoutLooper.quit(); + } + + super.dispose(); + } + private void restartRequestTimeout(){ if(timeoutLooper == null){ return;