mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2025-01-10 17:11:56 +01:00
Fossil/Skagen Hybrids: Allow launching watch apps from app manager
This commit is contained in:
parent
1713659e5e
commit
d8af8bede0
Binary file not shown.
@ -148,6 +148,12 @@ public abstract class AbstractAppManagerFragment extends Fragment {
|
|||||||
appList.add(app);
|
appList.add(app);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (mGBDevice.getType() == DeviceType.FOSSILQHYBRID) {
|
||||||
|
List<GBDeviceApp> systemApps = getSystemAppsInCategory();
|
||||||
|
for (GBDeviceApp systemApp : systemApps) {
|
||||||
|
appList.add(systemApp);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Bitmap getAppPreviewImage(String name) {
|
private Bitmap getAppPreviewImage(String name) {
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||||
package nodomain.freeyourgadget.gadgetbridge.activities.appmanager;
|
package nodomain.freeyourgadget.gadgetbridge.activities.appmanager;
|
||||||
|
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
@ -30,27 +31,29 @@ public class AppManagerFragmentInstalledApps extends AbstractAppManagerFragment
|
|||||||
@Override
|
@Override
|
||||||
protected List<GBDeviceApp> getSystemAppsInCategory() {
|
protected List<GBDeviceApp> getSystemAppsInCategory() {
|
||||||
List<GBDeviceApp> systemApps = new ArrayList<>();
|
List<GBDeviceApp> 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 (mGBDevice.getType() == DeviceType.PEBBLE) {
|
||||||
if (PebbleUtils.hasHealth(mGBDevice.getModel())) {
|
//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("0863fc6a-66c5-4f62-ab8a-82ed00a98b5d"), "Send Text (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(PebbleProtocol.UUID_PEBBLE_HEALTH, "Health (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));
|
||||||
if (PebbleUtils.hasHRM(mGBDevice.getModel())) {
|
systemApps.add(new GBDeviceApp(UUID.fromString("67a32d95-ef69-46d4-a0b9-854cc62f97f9"), "Alarms (System)", "Pebble Inc.", "", GBDeviceApp.Type.APP_SYSTEM));
|
||||||
systemApps.add(new GBDeviceApp(PebbleProtocol.UUID_WORKOUT, "Workout (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 (PebbleUtils.getFwMajor(mGBDevice.getFirmwareVersion()) >= 4) {
|
if (mGBDevice != null) {
|
||||||
systemApps.add(new GBDeviceApp(PebbleProtocol.UUID_WEATHER, "Weather (System)", "Pebble Inc.", "", GBDeviceApp.Type.APP_SYSTEM));
|
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;
|
return systemApps;
|
||||||
|
@ -22,7 +22,7 @@ import java.util.Map;
|
|||||||
import nodomain.freeyourgadget.gadgetbridge.model.ActivityKind;
|
import nodomain.freeyourgadget.gadgetbridge.model.ActivityKind;
|
||||||
|
|
||||||
public final class QHybridConstants {
|
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 final int HYBRID_HR_WATCHFACE_WIDGET_SIZE = 76;
|
||||||
|
|
||||||
public static Map<String, String> KNOWN_WAPP_VERSIONS = new HashMap<String, String>() {
|
public static Map<String, String> KNOWN_WAPP_VERSIONS = new HashMap<String, String>() {
|
||||||
|
@ -825,7 +825,9 @@ public class QHybridSupport extends QHybridBaseSupport {
|
|||||||
public void onAppStart(UUID uuid, boolean start) {
|
public void onAppStart(UUID uuid, boolean start) {
|
||||||
if(this.watchAdapter instanceof FossilHRWatchAdapter) {
|
if(this.watchAdapter instanceof FossilHRWatchAdapter) {
|
||||||
String appName = ((FossilHRWatchAdapter) watchAdapter).getInstalledAppNameFromUUID(uuid);
|
String appName = ((FossilHRWatchAdapter) watchAdapter).getInstalledAppNameFromUUID(uuid);
|
||||||
if (appName != null) {
|
if ((appName != null) && (appName.endsWith("App"))) {
|
||||||
|
((FossilHRWatchAdapter) watchAdapter).startAppOnWatch(appName);
|
||||||
|
} else {
|
||||||
((FossilHRWatchAdapter) watchAdapter).activateWatchface(appName);
|
((FossilHRWatchAdapter) watchAdapter).activateWatchface(appName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -472,6 +472,20 @@ public class FossilHRWatchAdapter extends FossilWatchAdapter {
|
|||||||
queueWrite(new SelectedThemePutRequest(this, appName));
|
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() {
|
private void setVibrationStrengthFromConfig() {
|
||||||
Prefs prefs = new Prefs(getDeviceSpecificPreferences());
|
Prefs prefs = new Prefs(getDeviceSpecificPreferences());
|
||||||
int vibrationStrengh = prefs.getInt(DeviceSettingsPreferenceConst.PREF_VIBRATION_STRENGH_PERCENTAGE, 2);
|
int vibrationStrengh = prefs.getInt(DeviceSettingsPreferenceConst.PREF_VIBRATION_STRENGH_PERCENTAGE, 2);
|
||||||
@ -1859,6 +1873,9 @@ public class FossilHRWatchAdapter extends FossilWatchAdapter {
|
|||||||
return appInfo.getAppName();
|
return appInfo.getAppName();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (uuid.equals(UUID.nameUUIDFromBytes("workoutApp".getBytes(StandardCharsets.UTF_8)))) {
|
||||||
|
return "workoutApp";
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
2
external/fossil-hr-watchface
vendored
2
external/fossil-hr-watchface
vendored
@ -1 +1 @@
|
|||||||
Subproject commit 1f7c07473b9232b59c51c4d9daaa29aab815db45
|
Subproject commit 1a58411e8fe32d1a1a80982fdc5775b4529cf8d1
|
Loading…
Reference in New Issue
Block a user