mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-13 21:49:27 +01:00
Add strings for activate and deactivate pebble Health
This commit is contained in:
parent
a451b37ceb
commit
ba9e00d2e4
@ -157,24 +157,26 @@ public class AppManagerActivity extends Activity {
|
||||
AdapterView.AdapterContextMenuInfo acmi = (AdapterView.AdapterContextMenuInfo) menuInfo;
|
||||
selectedApp = appList.get(acmi.position);
|
||||
|
||||
if (!selectedApp.isInCache() && !PebbleProtocol.UUID_PEBBLE_HEALTH.equals(selectedApp.getUUID())) {
|
||||
if (!selectedApp.isInCache()) {
|
||||
menu.removeItem(R.id.appmanager_app_reinstall);
|
||||
}
|
||||
if (!PebbleProtocol.UUID_PEBBLE_HEALTH.equals(selectedApp.getUUID())) {
|
||||
menu.removeItem(R.id.appmanager_health_activate);
|
||||
menu.removeItem(R.id.appmanager_health_deactivate);
|
||||
} else if (PebbleProtocol.UUID_PEBBLE_HEALTH.equals(selectedApp.getUUID())) {
|
||||
menu.removeItem(R.id.appmanager_app_delete);
|
||||
}
|
||||
menu.setHeaderTitle(selectedApp.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onContextItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case R.id.appmanager_health_deactivate:
|
||||
case R.id.appmanager_app_delete:
|
||||
GBApplication.deviceService().onAppDelete(selectedApp.getUUID());
|
||||
return true;
|
||||
case R.id.appmanager_app_reinstall:
|
||||
if (PebbleProtocol.UUID_PEBBLE_HEALTH.equals(selectedApp.getUUID())) {
|
||||
GBApplication.deviceService().onInstallApp(Uri.parse("fake://health"));
|
||||
return true;
|
||||
}
|
||||
|
||||
File cachePath;
|
||||
try {
|
||||
cachePath = new File(FileUtils.getExternalFilesDir().getPath() + "/pbw-cache/" + selectedApp.getUUID() + ".pbw");
|
||||
@ -184,6 +186,9 @@ public class AppManagerActivity extends Activity {
|
||||
}
|
||||
GBApplication.deviceService().onInstallApp(Uri.fromFile(cachePath));
|
||||
return true;
|
||||
case R.id.appmanager_health_activate:
|
||||
GBApplication.deviceService().onInstallApp(Uri.parse("fake://health"));
|
||||
return true;
|
||||
default:
|
||||
return super.onContextItemSelected(item);
|
||||
}
|
||||
|
@ -6,4 +6,11 @@
|
||||
<item
|
||||
android:id="@+id/appmanager_app_delete"
|
||||
android:title="@string/appmananger_app_delete"/>
|
||||
<item
|
||||
android:id="@+id/appmanager_health_activate"
|
||||
android:title="@string/appmanager_health_activate"/>
|
||||
<item
|
||||
android:id="@+id/appmanager_health_deactivate"
|
||||
android:title="@string/appmanager_health_deactivate"/>
|
||||
|
||||
</menu>
|
@ -219,5 +219,7 @@
|
||||
<string name="activity_prefs_gender">Gender</string>
|
||||
<string name="activity_prefs_height_cm">Height in cm</string>
|
||||
<string name="activity_prefs_weight_kg">Weight in kg</string>
|
||||
<string name="appmanager_health_activate">Activate</string>
|
||||
<string name="appmanager_health_deactivate">Deactivate</string>
|
||||
|
||||
</resources>
|
||||
|
Loading…
Reference in New Issue
Block a user