1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-03 00:43:02 +01:00

Pebble: allow launching internal Golf and Sports App if untested features are enabled

This is completely useless for now, but since it is there on every Pebble, I want to be able to launch it.
This commit is contained in:
Andreas Shimokawa 2015-09-10 23:07:42 +02:00
parent 0ad758fbca
commit 03b9f02b2c

View File

@ -5,7 +5,9 @@ import android.content.BroadcastReceiver;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.IntentFilter; import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.os.Bundle; import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.v4.app.NavUtils; import android.support.v4.app.NavUtils;
import android.support.v4.content.LocalBroadcastManager; import android.support.v4.content.LocalBroadcastManager;
import android.view.ContextMenu; import android.view.ContextMenu;
@ -52,14 +54,30 @@ public class AppManagerActivity extends Activity {
appList.add(new GBDeviceApp(uuid, appName, appCreator, "", appType)); appList.add(new GBDeviceApp(uuid, appName, appCreator, "", appType));
} }
if (sharedPrefs.getBoolean("pebble_force_untested", false)) {
appList.addAll(getSystemApps());
}
mGBDeviceAppAdapter.notifyDataSetChanged(); mGBDeviceAppAdapter.notifyDataSetChanged();
} }
} }
}; };
final List<GBDeviceApp> appList = new ArrayList<>();
SharedPreferences sharedPrefs;
private final List<GBDeviceApp> appList = new ArrayList<>();
private GBDeviceAppAdapter mGBDeviceAppAdapter; private GBDeviceAppAdapter mGBDeviceAppAdapter;
private GBDeviceApp selectedApp = null; private GBDeviceApp selectedApp = null;
private List<GBDeviceApp> getSystemApps() {
List<GBDeviceApp> systemApps = new ArrayList<>();
systemApps.add(new GBDeviceApp(UUID.fromString("4dab81a6-d2fc-458a-992c-7a1f3b96a970"), "Sports (System)", "Pebble Inc.", "", GBDeviceApp.Type.UNKNOWN));
systemApps.add(new GBDeviceApp(UUID.fromString("cf1e816a-9db0-4511-bbb8-f60c48ca8fac"), "Golf (System)", "Pebble Inc.", "", GBDeviceApp.Type.UNKNOWN));
return systemApps;
}
private List<GBDeviceApp> getCachedApps() { private List<GBDeviceApp> getCachedApps() {
List<GBDeviceApp> cachedAppList = new ArrayList<>(); List<GBDeviceApp> cachedAppList = new ArrayList<>();
try { try {
@ -82,6 +100,9 @@ public class AppManagerActivity extends Activity {
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
sharedPrefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
setContentView(R.layout.activity_appmanager); setContentView(R.layout.activity_appmanager);
getActionBar().setDisplayHomeAsUpEnabled(true); getActionBar().setDisplayHomeAsUpEnabled(true);
@ -99,9 +120,10 @@ public class AppManagerActivity extends Activity {
registerForContextMenu(appListView); registerForContextMenu(appListView);
List<GBDeviceApp> cachedApps = getCachedApps(); appList.addAll(getCachedApps());
for (GBDeviceApp app : cachedApps) {
appList.add(app); if (sharedPrefs.getBoolean("pebble_force_untested", false)) {
appList.addAll(getSystemApps());
} }
IntentFilter filter = new IntentFilter(); IntentFilter filter = new IntentFilter();