diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/qhybrid/adapter/fossil_hr/FossilHRWatchAdapter.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/qhybrid/adapter/fossil_hr/FossilHRWatchAdapter.java index 16ab755f3..376f84cd4 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/qhybrid/adapter/fossil_hr/FossilHRWatchAdapter.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/qhybrid/adapter/fossil_hr/FossilHRWatchAdapter.java @@ -89,6 +89,7 @@ import nodomain.freeyourgadget.gadgetbridge.externalevents.NotificationListener; import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice; import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceApp; import nodomain.freeyourgadget.gadgetbridge.model.CallSpec; +import nodomain.freeyourgadget.gadgetbridge.model.GenericItem; import nodomain.freeyourgadget.gadgetbridge.model.MusicSpec; import nodomain.freeyourgadget.gadgetbridge.model.MusicStateSpec; import nodomain.freeyourgadget.gadgetbridge.model.NotificationSpec; @@ -210,7 +211,19 @@ public class FossilHRWatchAdapter extends FossilWatchAdapter { } public void listApplications() { - queueWrite(new ApplicationsListRequest(this)); + queueWrite(new ApplicationsListRequest(this){ + @Override + public void handleApplicationsList(List installedApplications) { + ((FossilHRWatchAdapter) getAdapter()).setInstalledApplications(installedApplications); + GBDevice device = getAdapter().getDeviceSupport().getDevice(); + JSONArray array = new JSONArray(); + for(ApplicationInformation info : installedApplications){ + array.put(info.getAppName()); + } + device.addDeviceInfo(new GenericItem("INSTALLED_APPS", array.toString())); + device.sendDeviceUpdateIntent(getAdapter().getContext()); + } + }); } private void initializeAfterAuthentication(boolean authenticated) { diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/qhybrid/requests/fossil_hr/application/ApplicationsListRequest.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/qhybrid/requests/fossil_hr/application/ApplicationsListRequest.java index eb9a0fe0a..4ee71cd21 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/qhybrid/requests/fossil_hr/application/ApplicationsListRequest.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/qhybrid/requests/fossil_hr/application/ApplicationsListRequest.java @@ -9,6 +9,7 @@ import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.util.ArrayList; import java.util.Collections; +import java.util.List; import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice; import nodomain.freeyourgadget.gadgetbridge.model.GenericItem; @@ -49,15 +50,13 @@ public class ApplicationsListRequest extends FileLookupAndGetRequest{ )); } Collections.sort(applicationInfos); - ((FossilHRWatchAdapter) getAdapter()).setInstalledApplications(applicationInfos); - GBDevice device = getAdapter().getDeviceSupport().getDevice(); - JSONArray array = new JSONArray(); - for(ApplicationInformation info : applicationInfos){ - array.put(info.getAppName()); - } - device.addDeviceInfo(new GenericItem("INSTALLED_APPS", array.toString())); - device.sendDeviceUpdateIntent(getAdapter().getContext()); + this.handleApplicationsList(applicationInfos); } + + public void handleApplicationsList(List installedApplications){ + + } + public void handleFileLookupError(FILE_LOOKUP_ERROR error){ }