diff --git a/app/src/main/assets/fossil_hr/openSourceWatchface.bin b/app/src/main/assets/fossil_hr/openSourceWatchface.bin index e8980fe3b..17987ff4f 100644 Binary files a/app/src/main/assets/fossil_hr/openSourceWatchface.bin and b/app/src/main/assets/fossil_hr/openSourceWatchface.bin differ diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/appmanager/AbstractAppManagerFragment.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/appmanager/AbstractAppManagerFragment.java index 60d9fc3e5..41e8eec8e 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/appmanager/AbstractAppManagerFragment.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/appmanager/AbstractAppManagerFragment.java @@ -148,6 +148,12 @@ public abstract class AbstractAppManagerFragment extends Fragment { appList.add(app); } } + if (mGBDevice.getType() == DeviceType.FOSSILQHYBRID) { + List systemApps = getSystemAppsInCategory(); + for (GBDeviceApp systemApp : systemApps) { + appList.add(systemApp); + } + } } private Bitmap getAppPreviewImage(String name) { diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/appmanager/AppManagerFragmentInstalledApps.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/appmanager/AppManagerFragmentInstalledApps.java index 7a4dceaf8..69eb1e65c 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/appmanager/AppManagerFragmentInstalledApps.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/appmanager/AppManagerFragmentInstalledApps.java @@ -16,6 +16,7 @@ along with this program. If not, see . */ package nodomain.freeyourgadget.gadgetbridge.activities.appmanager; +import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.List; import java.util.UUID; @@ -30,27 +31,29 @@ public class AppManagerFragmentInstalledApps extends AbstractAppManagerFragment @Override protected List getSystemAppsInCategory() { List systemApps = new ArrayList<>(); - if (mGBDevice.getType() != DeviceType.PEBBLE) { - return systemApps; - } - //systemApps.add(new GBDeviceApp(UUID.fromString("4dab81a6-d2fc-458a-992c-7a1f3b96a970"), "Sports (System)", "Pebble Inc.", "", GBDeviceApp.Type.APP_SYSTEM)); - //systemApps.add(new GBDeviceApp(UUID.fromString("cf1e816a-9db0-4511-bbb8-f60c48ca8fac"), "Golf (System)", "Pebble Inc.", "", GBDeviceApp.Type.APP_SYSTEM)); - systemApps.add(new GBDeviceApp(UUID.fromString("1f03293d-47af-4f28-b960-f2b02a6dd757"), "Music (System)", "Pebble Inc.", "", GBDeviceApp.Type.APP_SYSTEM)); - systemApps.add(new GBDeviceApp(PebbleProtocol.UUID_NOTIFICATIONS, "Notifications (System)", "Pebble Inc.", "", GBDeviceApp.Type.APP_SYSTEM)); - systemApps.add(new GBDeviceApp(UUID.fromString("67a32d95-ef69-46d4-a0b9-854cc62f97f9"), "Alarms (System)", "Pebble Inc.", "", GBDeviceApp.Type.APP_SYSTEM)); - systemApps.add(new GBDeviceApp(UUID.fromString("18e443ce-38fd-47c8-84d5-6d0c775fbe55"), "Watchfaces (System)", "Pebble Inc.", "", GBDeviceApp.Type.APP_SYSTEM)); - if (mGBDevice != null) { - if (PebbleUtils.hasHealth(mGBDevice.getModel())) { - systemApps.add(new GBDeviceApp(UUID.fromString("0863fc6a-66c5-4f62-ab8a-82ed00a98b5d"), "Send Text (System)", "Pebble Inc.", "", GBDeviceApp.Type.APP_SYSTEM)); - systemApps.add(new GBDeviceApp(PebbleProtocol.UUID_PEBBLE_HEALTH, "Health (System)", "Pebble Inc.", "", GBDeviceApp.Type.APP_SYSTEM)); - } - if (PebbleUtils.hasHRM(mGBDevice.getModel())) { - systemApps.add(new GBDeviceApp(PebbleProtocol.UUID_WORKOUT, "Workout (System)", "Pebble Inc.", "", GBDeviceApp.Type.APP_SYSTEM)); - } - if (PebbleUtils.getFwMajor(mGBDevice.getFirmwareVersion()) >= 4) { - systemApps.add(new GBDeviceApp(PebbleProtocol.UUID_WEATHER, "Weather (System)", "Pebble Inc.", "", GBDeviceApp.Type.APP_SYSTEM)); + if (mGBDevice.getType() == DeviceType.PEBBLE) { + //systemApps.add(new GBDeviceApp(UUID.fromString("4dab81a6-d2fc-458a-992c-7a1f3b96a970"), "Sports (System)", "Pebble Inc.", "", GBDeviceApp.Type.APP_SYSTEM)); + //systemApps.add(new GBDeviceApp(UUID.fromString("cf1e816a-9db0-4511-bbb8-f60c48ca8fac"), "Golf (System)", "Pebble Inc.", "", GBDeviceApp.Type.APP_SYSTEM)); + systemApps.add(new GBDeviceApp(UUID.fromString("1f03293d-47af-4f28-b960-f2b02a6dd757"), "Music (System)", "Pebble Inc.", "", GBDeviceApp.Type.APP_SYSTEM)); + systemApps.add(new GBDeviceApp(PebbleProtocol.UUID_NOTIFICATIONS, "Notifications (System)", "Pebble Inc.", "", GBDeviceApp.Type.APP_SYSTEM)); + systemApps.add(new GBDeviceApp(UUID.fromString("67a32d95-ef69-46d4-a0b9-854cc62f97f9"), "Alarms (System)", "Pebble Inc.", "", GBDeviceApp.Type.APP_SYSTEM)); + systemApps.add(new GBDeviceApp(UUID.fromString("18e443ce-38fd-47c8-84d5-6d0c775fbe55"), "Watchfaces (System)", "Pebble Inc.", "", GBDeviceApp.Type.APP_SYSTEM)); + + if (mGBDevice != null) { + if (PebbleUtils.hasHealth(mGBDevice.getModel())) { + systemApps.add(new GBDeviceApp(UUID.fromString("0863fc6a-66c5-4f62-ab8a-82ed00a98b5d"), "Send Text (System)", "Pebble Inc.", "", GBDeviceApp.Type.APP_SYSTEM)); + systemApps.add(new GBDeviceApp(PebbleProtocol.UUID_PEBBLE_HEALTH, "Health (System)", "Pebble Inc.", "", GBDeviceApp.Type.APP_SYSTEM)); + } + if (PebbleUtils.hasHRM(mGBDevice.getModel())) { + systemApps.add(new GBDeviceApp(PebbleProtocol.UUID_WORKOUT, "Workout (System)", "Pebble Inc.", "", GBDeviceApp.Type.APP_SYSTEM)); + } + if (PebbleUtils.getFwMajor(mGBDevice.getFirmwareVersion()) >= 4) { + systemApps.add(new GBDeviceApp(PebbleProtocol.UUID_WEATHER, "Weather (System)", "Pebble Inc.", "", GBDeviceApp.Type.APP_SYSTEM)); + } } + } else if (mGBDevice.getType() == DeviceType.FOSSILQHYBRID) { + systemApps.add(new GBDeviceApp(UUID.nameUUIDFromBytes("workoutApp".getBytes(StandardCharsets.UTF_8)), "workoutApp", "", "", GBDeviceApp.Type.APP_ACTIVITYTRACKER)); } return systemApps; diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/qhybrid/QHybridConstants.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/qhybrid/QHybridConstants.java index c18ae482f..097d95087 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/qhybrid/QHybridConstants.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/qhybrid/QHybridConstants.java @@ -22,7 +22,7 @@ import java.util.Map; import nodomain.freeyourgadget.gadgetbridge.model.ActivityKind; public final class QHybridConstants { - public static final String HYBRIDHR_WATCHFACE_VERSION = "1.8"; + public static final String HYBRIDHR_WATCHFACE_VERSION = "1.9"; public static final int HYBRID_HR_WATCHFACE_WIDGET_SIZE = 76; public static Map KNOWN_WAPP_VERSIONS = new HashMap() { 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 09b7a5a8f..3a8611d81 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 @@ -825,7 +825,9 @@ public class QHybridSupport extends QHybridBaseSupport { public void onAppStart(UUID uuid, boolean start) { if(this.watchAdapter instanceof FossilHRWatchAdapter) { String appName = ((FossilHRWatchAdapter) watchAdapter).getInstalledAppNameFromUUID(uuid); - if (appName != null) { + if ((appName != null) && (appName.endsWith("App"))) { + ((FossilHRWatchAdapter) watchAdapter).startAppOnWatch(appName); + } else { ((FossilHRWatchAdapter) watchAdapter).activateWatchface(appName); } } 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 806dca8f2..aa08eeb9f 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 @@ -472,6 +472,20 @@ public class FossilHRWatchAdapter extends FossilWatchAdapter { queueWrite(new SelectedThemePutRequest(this, appName)); } + public void startAppOnWatch(String appName) { + try { + JSONObject jsonObject = new JSONObject() + .put("push", new JSONObject() + .put("set", new JSONObject() + .put("customWatchFace._.config.start_app", appName) + ) + ); + queueWrite(new JsonPutRequest(jsonObject, this)); + } catch (JSONException e) { + LOG.warn("Couldn't start app on watch: " + e.getMessage()); + } + } + private void setVibrationStrengthFromConfig() { Prefs prefs = new Prefs(getDeviceSpecificPreferences()); int vibrationStrengh = prefs.getInt(DeviceSettingsPreferenceConst.PREF_VIBRATION_STRENGH_PERCENTAGE, 2); @@ -1859,6 +1873,9 @@ public class FossilHRWatchAdapter extends FossilWatchAdapter { return appInfo.getAppName(); } } + if (uuid.equals(UUID.nameUUIDFromBytes("workoutApp".getBytes(StandardCharsets.UTF_8)))) { + return "workoutApp"; + } return null; } } diff --git a/external/fossil-hr-watchface b/external/fossil-hr-watchface index 1f7c07473..1a58411e8 160000 --- a/external/fossil-hr-watchface +++ b/external/fossil-hr-watchface @@ -1 +1 @@ -Subproject commit 1f7c07473b9232b59c51c4d9daaa29aab815db45 +Subproject commit 1a58411e8fe32d1a1a80982fdc5775b4529cf8d1