summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJorge Ruesga <jorge@ruesga.com>2014-03-10 19:31:22 (GMT)
committerGerrit Code Review <gerrit@cyanogenmod.org>2014-03-10 19:31:22 (GMT)
commitb16d27faa1100687bf026398b70090925926526c (patch)
tree0308dc62a527d3ff0341b87d0a1806d918b84c26
parentec30873b0571d25780032e29d4a9910e70f49721 (diff)
parenta5d4a78d0831d0385df0da57378ee41c95234fb1 (diff)
downloadandroid_packages_apps_Trebuchet-b16d27faa1100687bf026398b70090925926526c.zip
android_packages_apps_Trebuchet-b16d27faa1100687bf026398b70090925926526c.tar.gz
android_packages_apps_Trebuchet-b16d27faa1100687bf026398b70090925926526c.tar.bz2
Merge "trebuchet: build headers from internal adapter instance" into cm-11.0
-rw-r--r--src/com/android/launcher3/settings/SettingsActivity.java15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/com/android/launcher3/settings/SettingsActivity.java b/src/com/android/launcher3/settings/SettingsActivity.java
index 466a01f..182a6bf 100644
--- a/src/com/android/launcher3/settings/SettingsActivity.java
+++ b/src/com/android/launcher3/settings/SettingsActivity.java
@@ -31,6 +31,7 @@ import android.widget.ListAdapter;
import android.widget.TextView;
import com.android.launcher3.R;
+import java.util.ArrayList;
import java.util.List;
public class SettingsActivity extends PreferenceActivity
@@ -38,7 +39,6 @@ public class SettingsActivity extends PreferenceActivity
private static final String TAG = "Launcher3.SettingsActivity";
private SharedPreferences mSettings;
- private List<Header> mHeaders;
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -90,7 +90,6 @@ public class SettingsActivity extends PreferenceActivity
public void onBuildHeaders(List<Header> target) {
loadHeadersFromResource(R.xml.preferences_headers, target);
updateHeaders(target);
- mHeaders = target;
}
private void updateHeaders(List<Header> headers) {
@@ -115,7 +114,8 @@ public class SettingsActivity extends PreferenceActivity
if (adapter == null) {
super.setListAdapter(null);
} else {
- super.setListAdapter(new HeaderAdapter(this, mHeaders));
+ List<Header> headers = getHeadersFromAdapter(adapter);
+ super.setListAdapter(new HeaderAdapter(this, headers));
}
}
@@ -126,6 +126,15 @@ public class SettingsActivity extends PreferenceActivity
editor.commit();
}
+ private List<Header> getHeadersFromAdapter(ListAdapter adapter) {
+ List<Header> headers = new ArrayList<Header>();
+ int count = adapter.getCount();
+ for (int i = 0; i < count; i++) {
+ headers.add((Header)adapter.getItem(i));
+ }
+ return headers;
+ }
+
public static class HomescreenFragment extends PreferenceFragment {
@Override
public void onCreate(Bundle savedInstanceState) {