Pebble 2: allow to disable/enable HRM in context menu of Workout app
Okay this might be stupid since Workout seems to work also works without HRM! I assumed (wrongly) that I will disable Workout by disabling HRM anyway, better than not being able to toggle it at all!
This commit is contained in:
parent
4b7f47ba6c
commit
82a47022fa
|
@ -283,6 +283,10 @@ public abstract class AbstractAppManagerFragment extends Fragment {
|
||||||
menu.removeItem(R.id.appmanager_health_activate);
|
menu.removeItem(R.id.appmanager_health_activate);
|
||||||
menu.removeItem(R.id.appmanager_health_deactivate);
|
menu.removeItem(R.id.appmanager_health_deactivate);
|
||||||
}
|
}
|
||||||
|
if (!PebbleProtocol.UUID_WORKOUT.equals(selectedApp.getUUID())) {
|
||||||
|
menu.removeItem(R.id.appmanager_hrm_activate);
|
||||||
|
menu.removeItem(R.id.appmanager_hrm_deactivate);
|
||||||
|
}
|
||||||
if (selectedApp.getType() == GBDeviceApp.Type.APP_SYSTEM || selectedApp.getType() == GBDeviceApp.Type.WATCHFACE_SYSTEM) {
|
if (selectedApp.getType() == GBDeviceApp.Type.APP_SYSTEM || selectedApp.getType() == GBDeviceApp.Type.WATCHFACE_SYSTEM) {
|
||||||
menu.removeItem(R.id.appmanager_app_delete);
|
menu.removeItem(R.id.appmanager_app_delete);
|
||||||
}
|
}
|
||||||
|
@ -355,7 +359,11 @@ public abstract class AbstractAppManagerFragment extends Fragment {
|
||||||
case R.id.appmanager_health_activate:
|
case R.id.appmanager_health_activate:
|
||||||
GBApplication.deviceService().onInstallApp(Uri.parse("fake://health"));
|
GBApplication.deviceService().onInstallApp(Uri.parse("fake://health"));
|
||||||
return true;
|
return true;
|
||||||
|
case R.id.appmanager_hrm_activate:
|
||||||
|
GBApplication.deviceService().onInstallApp(Uri.parse("fake://hrm"));
|
||||||
|
return true;
|
||||||
case R.id.appmanager_health_deactivate:
|
case R.id.appmanager_health_deactivate:
|
||||||
|
case R.id.appmanager_hrm_deactivate:
|
||||||
GBApplication.deviceService().onAppDelete(selectedApp.getUUID());
|
GBApplication.deviceService().onAppDelete(selectedApp.getUUID());
|
||||||
return true;
|
return true;
|
||||||
case R.id.appmanager_app_configure:
|
case R.id.appmanager_app_configure:
|
||||||
|
|
|
@ -596,6 +596,10 @@ class PebbleIoThread extends GBDeviceIoThread {
|
||||||
write(mPebbleProtocol.encodeSetSaneDistanceUnit(true));
|
write(mPebbleProtocol.encodeSetSaneDistanceUnit(true));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (uri.equals(Uri.parse("fake://hrm"))) {
|
||||||
|
write(mPebbleProtocol.encodeActivateHRM(true));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
String platformName = PebbleUtils.getPlatformName(gbDevice.getModel());
|
String platformName = PebbleUtils.getPlatformName(gbDevice.getModel());
|
||||||
|
|
||||||
|
|
|
@ -721,10 +721,8 @@ public class PebbleProtocol extends GBDeviceProtocol {
|
||||||
return buf.array();
|
return buf.array();
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte[] encodeActivateHealth(boolean activate) {
|
byte[] encodeActivateHealth(boolean activate) {
|
||||||
byte[] blob;
|
byte[] blob;
|
||||||
byte command;
|
|
||||||
command = BLOBDB_INSERT;
|
|
||||||
if (activate) {
|
if (activate) {
|
||||||
|
|
||||||
ByteBuffer buf = ByteBuffer.allocate(9);
|
ByteBuffer buf = ByteBuffer.allocate(9);
|
||||||
|
@ -744,10 +742,10 @@ public class PebbleProtocol extends GBDeviceProtocol {
|
||||||
} else {
|
} else {
|
||||||
blob = new byte[]{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
blob = new byte[]{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||||
}
|
}
|
||||||
return encodeBlobdb("activityPreferences", command, BLOBDB_PREFERENCES, blob);
|
return encodeBlobdb("activityPreferences", BLOBDB_INSERT, BLOBDB_PREFERENCES, blob);
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte[] encodeSetSaneDistanceUnit(boolean sane) {
|
byte[] encodeSetSaneDistanceUnit(boolean sane) {
|
||||||
byte value;
|
byte value;
|
||||||
if (sane) {
|
if (sane) {
|
||||||
value = 0x00;
|
value = 0x00;
|
||||||
|
@ -757,7 +755,13 @@ public class PebbleProtocol extends GBDeviceProtocol {
|
||||||
return encodeBlobdb("unitsDistance", BLOBDB_INSERT, BLOBDB_PREFERENCES, new byte[]{value});
|
return encodeBlobdb("unitsDistance", BLOBDB_INSERT, BLOBDB_PREFERENCES, new byte[]{value});
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte[] encodeReportDataLogSessions() {
|
|
||||||
|
byte[] encodeActivateHRM(boolean activate) {
|
||||||
|
return encodeBlobdb("hrmPreferences", BLOBDB_INSERT, BLOBDB_PREFERENCES,
|
||||||
|
activate ? new byte[]{0x01} : new byte[]{0x00});
|
||||||
|
}
|
||||||
|
|
||||||
|
byte[] encodeReportDataLogSessions() {
|
||||||
return encodeSimpleMessage(ENDPOINT_DATALOG, DATALOG_REPORTSESSIONS);
|
return encodeSimpleMessage(ENDPOINT_DATALOG, DATALOG_REPORTSESSIONS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1249,6 +1253,9 @@ public class PebbleProtocol extends GBDeviceProtocol {
|
||||||
if (UUID_PEBBLE_HEALTH.equals(uuid)) {
|
if (UUID_PEBBLE_HEALTH.equals(uuid)) {
|
||||||
return encodeActivateHealth(false);
|
return encodeActivateHealth(false);
|
||||||
}
|
}
|
||||||
|
if (UUID_WORKOUT.equals(uuid)) {
|
||||||
|
return encodeActivateHRM(false);
|
||||||
|
}
|
||||||
return encodeBlobdb(uuid, BLOBDB_DELETE, BLOBDB_APP, null);
|
return encodeBlobdb(uuid, BLOBDB_DELETE, BLOBDB_APP, null);
|
||||||
} else {
|
} else {
|
||||||
ByteBuffer buf = ByteBuffer.allocate(LENGTH_PREFIX + LENGTH_REMOVEAPP_2X);
|
ByteBuffer buf = ByteBuffer.allocate(LENGTH_PREFIX + LENGTH_REMOVEAPP_2X);
|
||||||
|
|
|
@ -15,6 +15,12 @@
|
||||||
<item
|
<item
|
||||||
android:id="@+id/appmanager_health_deactivate"
|
android:id="@+id/appmanager_health_deactivate"
|
||||||
android:title="@string/appmanager_health_deactivate"/>
|
android:title="@string/appmanager_health_deactivate"/>
|
||||||
|
<item
|
||||||
|
android:id="@+id/appmanager_hrm_activate"
|
||||||
|
android:title="@string/appmanager_hrm_activate"/>
|
||||||
|
<item
|
||||||
|
android:id="@+id/appmanager_hrm_deactivate"
|
||||||
|
android:title="@string/appmanager_hrm_deactivate"/>
|
||||||
<item
|
<item
|
||||||
android:id="@+id/appmanager_app_configure"
|
android:id="@+id/appmanager_app_configure"
|
||||||
android:title="@string/app_configure"/>
|
android:title="@string/app_configure"/>
|
||||||
|
|
|
@ -28,6 +28,8 @@
|
||||||
<string name="appmanager_app_openinstore">Search in Pebble Appstore</string>
|
<string name="appmanager_app_openinstore">Search in Pebble Appstore</string>
|
||||||
<string name="appmanager_health_activate">Activate</string>
|
<string name="appmanager_health_activate">Activate</string>
|
||||||
<string name="appmanager_health_deactivate">Deactivate</string>
|
<string name="appmanager_health_deactivate">Deactivate</string>
|
||||||
|
<string name="appmanager_hrm_activate">Activate HRM</string>
|
||||||
|
<string name="appmanager_hrm_deactivate">Deactivate HRM</string>
|
||||||
<string name="app_configure">Configure</string>
|
<string name="app_configure">Configure</string>
|
||||||
<string name="app_move_to_top">Move to top</string>
|
<string name="app_move_to_top">Move to top</string>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue