From 4a697edcedad256ed8daecf5ce2bfa4015f4439e Mon Sep 17 00:00:00 2001 From: Andreas Shimokawa Date: Fri, 10 Apr 2015 22:26:52 +0200 Subject: [PATCH] add icon for activity tracker type apps. Thanks xphnx! --- LICENSE.artwork | 1 + .../gadgetbridge/adapter/GBDeviceAppAdapter.java | 3 +++ .../gadgetbridge/protocol/PebbleProtocol.java | 13 ++++++------- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/LICENSE.artwork b/LICENSE.artwork index bb6cdbeb..cb2299ed 100644 --- a/LICENSE.artwork +++ b/LICENSE.artwork @@ -3,6 +3,7 @@ The following artwork is licensed under the following licenses Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0): ic_device_pebble.png (pebble.svg from https://gitlab.com/xphnx/twelf_cm12_theme/issues/13) ic_device_miband.png (miband.svg from https://gitlab.com/xphnx/twelf_cm12_theme/issues/13) + ic_activitytracker.png (androidrun.png from https://gitlab.com/xphnx/twelf_cm12_theme/) ic_watchface.png (clock.png from https://gitlab.com/xphnx/twelf_cm12_theme/) Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0): diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/adapter/GBDeviceAppAdapter.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/adapter/GBDeviceAppAdapter.java index c2b92305..0a52b44d 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/adapter/GBDeviceAppAdapter.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/adapter/GBDeviceAppAdapter.java @@ -42,6 +42,9 @@ public class GBDeviceAppAdapter extends ArrayAdapter { deviceStatusLabel.setText(deviceApp.getVersion() + " by " + deviceApp.getCreator()); deviceNameLabel.setText(deviceApp.getName()); switch (deviceApp.getType()) { + case APP_ACTIVITYTRACKER: + deviceImageView.setImageResource(R.drawable.ic_activitytracker); + break; case WATCHFACE: deviceImageView.setImageResource(R.drawable.ic_watchface); break; diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/protocol/PebbleProtocol.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/protocol/PebbleProtocol.java index bd0a69bd..e136b8bf 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/protocol/PebbleProtocol.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/protocol/PebbleProtocol.java @@ -437,13 +437,12 @@ public class PebbleProtocol extends GBDeviceProtocol { int flags = buf.getInt(); GBDeviceApp.Type appType; - switch (flags) { - case 1: - appType = GBDeviceApp.Type.WATCHFACE; - break; - default: - appType = GBDeviceApp.Type.APP_GENERIC; - break; + if ((flags & 16) == 16) { // FIXME: verify this assumption + appType = GBDeviceApp.Type.APP_ACTIVITYTRACKER; + } else if ((flags & 1) == 1) { // FIXME: verify this assumption + appType = GBDeviceApp.Type.WATCHFACE; + } else { + appType = GBDeviceApp.Type.APP_GENERIC; } Short appVersion = buf.getShort(); appInfoCmd.apps[i] = new GBDeviceApp(id, index, new String(appName).trim(), new String(appCreator).trim(), appVersion.toString(), appType);