Do not show the configure menu item for non configurable watch apps.
This commit is contained in:
parent
1603d60144
commit
e69fac9704
|
@ -102,11 +102,14 @@ public class AppManagerActivity extends Activity {
|
||||||
for (File file : files) {
|
for (File file : files) {
|
||||||
if (file.getName().endsWith(".pbw")) {
|
if (file.getName().endsWith(".pbw")) {
|
||||||
String baseName = file.getName().substring(0, file.getName().length() - 4);
|
String baseName = file.getName().substring(0, file.getName().length() - 4);
|
||||||
|
//metadata
|
||||||
File jsonFile = new File(cachePath, baseName + ".json");
|
File jsonFile = new File(cachePath, baseName + ".json");
|
||||||
|
//configuration
|
||||||
|
File configFile = new File(cachePath, baseName + "_config.js");
|
||||||
try {
|
try {
|
||||||
String jsonstring = FileUtils.getStringFromFile(jsonFile);
|
String jsonstring = FileUtils.getStringFromFile(jsonFile);
|
||||||
JSONObject json = new JSONObject(jsonstring);
|
JSONObject json = new JSONObject(jsonstring);
|
||||||
cachedAppList.add(new GBDeviceApp(json));
|
cachedAppList.add(new GBDeviceApp(json, configFile.exists()));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOG.warn("could not read json file for " + baseName, e.getMessage(), e);
|
LOG.warn("could not read json file for " + baseName, e.getMessage(), e);
|
||||||
cachedAppList.add(new GBDeviceApp(UUID.fromString(baseName), baseName, "N/A", "", GBDeviceApp.Type.UNKNOWN));
|
cachedAppList.add(new GBDeviceApp(UUID.fromString(baseName), baseName, "N/A", "", GBDeviceApp.Type.UNKNOWN));
|
||||||
|
@ -178,6 +181,9 @@ public class AppManagerActivity extends Activity {
|
||||||
} else if (PebbleProtocol.UUID_PEBBLE_HEALTH.equals(selectedApp.getUUID())) {
|
} else if (PebbleProtocol.UUID_PEBBLE_HEALTH.equals(selectedApp.getUUID())) {
|
||||||
menu.removeItem(R.id.appmanager_app_delete);
|
menu.removeItem(R.id.appmanager_app_delete);
|
||||||
}
|
}
|
||||||
|
if (!selectedApp.isConfigurable()) {
|
||||||
|
menu.removeItem(R.id.appmanager_app_configure);
|
||||||
|
}
|
||||||
menu.setHeaderTitle(selectedApp.getName());
|
menu.setHeaderTitle(selectedApp.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@ public class GBDeviceApp {
|
||||||
private final UUID uuid;
|
private final UUID uuid;
|
||||||
private final Type type;
|
private final Type type;
|
||||||
private final boolean inCache;
|
private final boolean inCache;
|
||||||
|
private final boolean configurable;
|
||||||
|
|
||||||
public GBDeviceApp(UUID uuid, String name, String creator, String version, Type type) {
|
public GBDeviceApp(UUID uuid, String name, String creator, String version, Type type) {
|
||||||
this.uuid = uuid;
|
this.uuid = uuid;
|
||||||
|
@ -21,9 +22,10 @@ public class GBDeviceApp {
|
||||||
this.type = type;
|
this.type = type;
|
||||||
//FIXME: do not assume
|
//FIXME: do not assume
|
||||||
this.inCache = false;
|
this.inCache = false;
|
||||||
|
this.configurable = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public GBDeviceApp(JSONObject json) {
|
public GBDeviceApp(JSONObject json, boolean configurable) {
|
||||||
UUID uuid = UUID.fromString("00000000-0000-0000-0000-000000000000");
|
UUID uuid = UUID.fromString("00000000-0000-0000-0000-000000000000");
|
||||||
String name = "";
|
String name = "";
|
||||||
String creator = "";
|
String creator = "";
|
||||||
|
@ -47,6 +49,7 @@ public class GBDeviceApp {
|
||||||
this.type = type;
|
this.type = type;
|
||||||
//FIXME: do not assume
|
//FIXME: do not assume
|
||||||
this.inCache = true;
|
this.inCache = true;
|
||||||
|
this.configurable = configurable;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isInCache() {
|
public boolean isInCache() {
|
||||||
|
@ -94,4 +97,8 @@ public class GBDeviceApp {
|
||||||
}
|
}
|
||||||
return json;
|
return json;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isConfigurable() {
|
||||||
|
return configurable;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue