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 6e3b2802..7fe4db25 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/AppManagerActivity.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/AppManagerActivity.java @@ -5,7 +5,9 @@ import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; +import android.content.SharedPreferences; import android.os.Bundle; +import android.preference.PreferenceManager; import android.support.v4.app.NavUtils; import android.support.v4.content.LocalBroadcastManager; import android.view.ContextMenu; @@ -52,14 +54,30 @@ public class AppManagerActivity extends Activity { appList.add(new GBDeviceApp(uuid, appName, appCreator, "", appType)); } + + if (sharedPrefs.getBoolean("pebble_force_untested", false)) { + appList.addAll(getSystemApps()); + } + mGBDeviceAppAdapter.notifyDataSetChanged(); } } }; - final List appList = new ArrayList<>(); + + SharedPreferences sharedPrefs; + + private final List appList = new ArrayList<>(); private GBDeviceAppAdapter mGBDeviceAppAdapter; private GBDeviceApp selectedApp = null; + private List getSystemApps() { + List 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 getCachedApps() { List cachedAppList = new ArrayList<>(); try { @@ -82,6 +100,9 @@ public class AppManagerActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + + sharedPrefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); + setContentView(R.layout.activity_appmanager); getActionBar().setDisplayHomeAsUpEnabled(true); @@ -99,9 +120,10 @@ public class AppManagerActivity extends Activity { registerForContextMenu(appListView); - List cachedApps = getCachedApps(); - for (GBDeviceApp app : cachedApps) { - appList.add(app); + appList.addAll(getCachedApps()); + + if (sharedPrefs.getBoolean("pebble_force_untested", false)) { + appList.addAll(getSystemApps()); } IntentFilter filter = new IntentFilter();