diff options
author | Jason Monk <jmonk@google.com> | 2015-06-11 15:47:29 -0400 |
---|---|---|
committer | Jason Monk <jmonk@google.com> | 2015-06-11 15:47:29 -0400 |
commit | 2acff556c25e788c47284c9fc837f27a1916b578 (patch) | |
tree | 4b1dc5ecf924e1d045efd7724a07ccd749bb171c /src/com/android/settings/SettingsActivity.java | |
parent | 1fdbbffceda141404ae033a471bea20de8df60d4 (diff) | |
download | packages_apps_Settings-2acff556c25e788c47284c9fc837f27a1916b578.zip packages_apps_Settings-2acff556c25e788c47284c9fc837f27a1916b578.tar.gz packages_apps_Settings-2acff556c25e788c47284c9fc837f27a1916b578.tar.bz2 |
Clean up settings shortcuts
- Remove some bad entries
- Fix icons to be top-level item specific
- Add memory
Bug: 20632230
Change-Id: I067b467b9ee354b52ef61b312dc5a89fd7eae2ac
Diffstat (limited to 'src/com/android/settings/SettingsActivity.java')
-rw-r--r-- | src/com/android/settings/SettingsActivity.java | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/src/com/android/settings/SettingsActivity.java b/src/com/android/settings/SettingsActivity.java index 89231df..f376644 100644 --- a/src/com/android/settings/SettingsActivity.java +++ b/src/com/android/settings/SettingsActivity.java @@ -1039,7 +1039,7 @@ public class SettingsActivity extends Activity */ private void buildDashboardCategories(List<DashboardCategory> categories) { categories.clear(); - loadCategoriesFromResource(R.xml.dashboard_categories, categories); + loadCategoriesFromResource(R.xml.dashboard_categories, categories, this); updateTilesList(categories); } @@ -1050,10 +1050,11 @@ public class SettingsActivity extends Activity * @param resid The XML resource to load and parse. * @param target The list in which the parsed categories and tiles should be placed. */ - private void loadCategoriesFromResource(int resid, List<DashboardCategory> target) { + public static void loadCategoriesFromResource(int resid, List<DashboardCategory> target, + Context context) { XmlResourceParser parser = null; try { - parser = getResources().getXml(resid); + parser = context.getResources().getXml(resid); AttributeSet attrs = Xml.asAttributeSet(parser); int type; @@ -1082,7 +1083,7 @@ public class SettingsActivity extends Activity if ("dashboard-category".equals(nodeName)) { DashboardCategory category = new DashboardCategory(); - TypedArray sa = obtainStyledAttributes( + TypedArray sa = context.obtainStyledAttributes( attrs, com.android.internal.R.styleable.PreferenceHeader); category.id = sa.getResourceId( com.android.internal.R.styleable.PreferenceHeader_id, @@ -1098,12 +1099,13 @@ public class SettingsActivity extends Activity } } sa.recycle(); - sa = obtainStyledAttributes(attrs, com.android.internal.R.styleable.Preference); + sa = context.obtainStyledAttributes(attrs, + com.android.internal.R.styleable.Preference); tv = sa.peekValue( com.android.internal.R.styleable.Preference_key); if (tv != null && tv.type == TypedValue.TYPE_STRING) { if (tv.resourceId != 0) { - category.key = getString(tv.resourceId); + category.key = context.getString(tv.resourceId); } else { category.key = tv.string.toString(); } @@ -1121,7 +1123,7 @@ public class SettingsActivity extends Activity if (innerNodeName.equals("dashboard-tile")) { DashboardTile tile = new DashboardTile(); - sa = obtainStyledAttributes( + sa = context.obtainStyledAttributes( attrs, com.android.internal.R.styleable.PreferenceHeader); tile.id = sa.getResourceId( com.android.internal.R.styleable.PreferenceHeader_id, @@ -1163,11 +1165,13 @@ public class SettingsActivity extends Activity String innerNodeName2 = parser.getName(); if (innerNodeName2.equals("extra")) { - getResources().parseBundleExtra("extra", attrs, curBundle); + context.getResources().parseBundleExtra("extra", attrs, + curBundle); XmlUtils.skipCurrentTag(parser); } else if (innerNodeName2.equals("intent")) { - tile.intent = Intent.parseIntent(getResources(), parser, attrs); + tile.intent = Intent.parseIntent(context.getResources(), parser, + attrs); } else { XmlUtils.skipCurrentTag(parser); @@ -1180,7 +1184,7 @@ public class SettingsActivity extends Activity } // Show the SIM Cards setting if there are more than 2 SIMs installed. - if(tile.id != R.id.sim_settings || Utils.showSimCardTile(this)){ + if(tile.id != R.id.sim_settings || Utils.showSimCardTile(context)){ category.addTile(tile); } |