diff --git a/CHANGELOG.md b/CHANGELOG.md index a8b847b63..c48e4e23f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,8 @@ ###Changelog -####Next Version -*Pebble: Fix regression which freezes Gadgetbridge when disconnecting via long-press menu +####Version 0.7.1 +* Pebble: allow reinstallation of apps in pbw-cache from App Manager (long press menu) +* Pebble: Fix regression which freezes Gadgetbridge when disconnecting via long-press menu ####Version 0.7.0 * Read upcoming events (up to 7 days in the future). Requires READ_CALENDAR permission diff --git a/app/build.gradle b/app/build.gradle index fd2262460..498f1b8aa 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -14,8 +14,8 @@ android { targetSdkVersion 23 // note: always bump BOTH versionCode and versionName! - versionName "0.7.0" - versionCode 36 + versionName "0.7.1" + versionCode 37 } buildTypes { release { diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/AppManagerActivity.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/AppManagerActivity.java index 4071de6d5..19d07b165 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/AppManagerActivity.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/AppManagerActivity.java @@ -6,6 +6,7 @@ import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.content.SharedPreferences; +import android.net.Uri; import android.os.Bundle; import android.preference.PreferenceManager; import android.support.v4.app.NavUtils; @@ -150,10 +151,13 @@ public class AppManagerActivity extends Activity { @Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); - getMenuInflater().inflate( - R.menu.appmanager_context, menu); + getMenuInflater().inflate(R.menu.appmanager_context, menu); AdapterView.AdapterContextMenuInfo acmi = (AdapterView.AdapterContextMenuInfo) menuInfo; selectedApp = appList.get(acmi.position); + + if (!selectedApp.isInCache()) { + menu.removeItem(R.id.appmanager_app_reinstall); + } menu.setHeaderTitle(selectedApp.getName()); } @@ -161,9 +165,17 @@ public class AppManagerActivity extends Activity { public boolean onContextItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.appmanager_app_delete: - if (selectedApp != null) { - GBApplication.deviceService().onAppDelete(selectedApp.getUUID()); + GBApplication.deviceService().onAppDelete(selectedApp.getUUID()); + return true; + case R.id.appmanager_app_reinstall: + File cachePath; + try { + cachePath = new File(FileUtils.getExternalFilesDir().getPath() + "/pbw-cache/" + selectedApp.getUUID() + ".pbw"); + } catch (IOException e) { + LOG.warn("could not get external dir while reading pbw cache."); + return true; } + GBApplication.deviceService().onInstallApp(Uri.fromFile(cachePath)); return true; default: return super.onContextItemSelected(item); diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/ControlCenter.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/ControlCenter.java index 87ccd58ee..db241ed99 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/ControlCenter.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/ControlCenter.java @@ -2,7 +2,6 @@ package nodomain.freeyourgadget.gadgetbridge.activities; import android.app.Activity; import android.app.ProgressDialog; -import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothDevice; import android.content.BroadcastReceiver; import android.content.Context; @@ -35,9 +34,7 @@ import nodomain.freeyourgadget.gadgetbridge.R; import nodomain.freeyourgadget.gadgetbridge.activities.charts.ChartsActivity; import nodomain.freeyourgadget.gadgetbridge.adapter.GBDeviceAdapter; import nodomain.freeyourgadget.gadgetbridge.devices.DeviceCoordinator; -import nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandConst; import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice; -import nodomain.freeyourgadget.gadgetbridge.model.DeviceType; import nodomain.freeyourgadget.gadgetbridge.util.DeviceHelper; import nodomain.freeyourgadget.gadgetbridge.util.GB; diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/impl/GBDeviceApp.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/impl/GBDeviceApp.java index fda269a9c..9743a0832 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/impl/GBDeviceApp.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/impl/GBDeviceApp.java @@ -11,6 +11,7 @@ public class GBDeviceApp { private final String version; private final UUID uuid; private final Type type; + private final boolean inCache; public GBDeviceApp(UUID uuid, String name, String creator, String version, Type type) { this.uuid = uuid; @@ -18,6 +19,8 @@ public class GBDeviceApp { this.creator = creator; this.version = version; this.type = type; + //FIXME: do not assume + this.inCache = false; } public GBDeviceApp(JSONObject json) { @@ -42,6 +45,12 @@ public class GBDeviceApp { this.creator = creator; this.version = version; this.type = type; + //FIXME: do not assume + this.inCache = true; + } + + public boolean isInCache() { + return inCache; } public String getName() { diff --git a/app/src/main/res/menu/appmanager_context.xml b/app/src/main/res/menu/appmanager_context.xml index d2dd4f5dd..60f1653dd 100644 --- a/app/src/main/res/menu/appmanager_context.xml +++ b/app/src/main/res/menu/appmanager_context.xml @@ -1,5 +1,8 @@