mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-12-24 01:25:50 +01:00
Pebble: allow reinstallation of apps in pbw-cache from App Manager (long press menu)
See #93 Also bump version, update CHANGELOG.md
This commit is contained in:
parent
50cd5b2629
commit
d7f74851e2
@ -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
|
||||
|
@ -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 {
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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() {
|
||||
|
@ -1,5 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
<item
|
||||
android:id="@+id/appmanager_app_reinstall"
|
||||
android:title="@string/appmananger_app_reinstall"/>
|
||||
<item
|
||||
android:id="@+id/appmanager_app_delete"
|
||||
android:title="@string/appmananger_app_delete"/>
|
||||
|
@ -216,4 +216,5 @@
|
||||
<string name="fwinstaller_firmware_not_compatible_to_device">This firmware is not compatible with the device</string>
|
||||
<string name="miband_prefs_reserve_alarm_calendar">Alarms to reserve for upcoming events</string>
|
||||
<string name="waiting_for_reconnect">waiting for reconnect</string>
|
||||
<string name="appmananger_app_reinstall">Reinstall</string>
|
||||
</resources>
|
||||
|
Loading…
Reference in New Issue
Block a user