diff options
author | Amith Yamasani <yamasani@google.com> | 2012-06-20 15:45:05 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-06-20 15:45:05 -0700 |
commit | 9938ac8a6e1885b2cd7f35fd6c63e2b04a84d36c (patch) | |
tree | f0cec9b7f5461f17e3fa5d35f75da0b944553ce6 /src | |
parent | 679948df3cf5c71bfe24ad4d6cd1bd78cb0fb28d (diff) | |
parent | ea7b28c2a1b2eab49af7066f53fe19f905d989b2 (diff) | |
download | packages_apps_settings-9938ac8a6e1885b2cd7f35fd6c63e2b04a84d36c.zip packages_apps_settings-9938ac8a6e1885b2cd7f35fd6c63e2b04a84d36c.tar.gz packages_apps_settings-9938ac8a6e1885b2cd7f35fd6c63e2b04a84d36c.tar.bz2 |
Merge "Fix incorrect updating of headers in Settings" into jb-dev
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/settings/Settings.java | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/src/com/android/settings/Settings.java b/src/com/android/settings/Settings.java index 37b47c2..e8a8f46 100644 --- a/src/com/android/settings/Settings.java +++ b/src/com/android/settings/Settings.java @@ -52,6 +52,7 @@ import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.widget.ArrayAdapter; +import android.widget.BaseAdapter; import android.widget.Button; import android.widget.ImageView; import android.widget.ListAdapter; @@ -71,6 +72,7 @@ public class Settings extends PreferenceActivity implements ButtonBarHandler, OnAccountsUpdateListener { private static final String LOG_TAG = "Settings"; + private static final String META_DATA_KEY_HEADER_ID = "com.android.settings.TOP_LEVEL_HEADER_ID"; private static final String META_DATA_KEY_FRAGMENT_CLASS = @@ -108,7 +110,6 @@ public class Settings extends PreferenceActivity // TODO: Update Call Settings based on airplane mode state. protected HashMap<Integer, Integer> mHeaderIndexMap = new HashMap<Integer, Integer>(); - private List<Header> mHeaders; private AuthenticatorHelper mAuthenticatorHelper; private Header mLastHeader; @@ -189,6 +190,7 @@ public class Settings extends PreferenceActivity if (listAdapter instanceof HeaderAdapter) { ((HeaderAdapter) listAdapter).resume(); } + invalidateHeaders(); } @Override @@ -360,7 +362,7 @@ public class Settings extends PreferenceActivity intent.setClass(this, SubSettings.class); return intent; } - + /** * Populate the activity with the top-level headers. */ @@ -369,8 +371,6 @@ public class Settings extends PreferenceActivity loadHeadersFromResource(R.xml.settings_headers, headers); updateHeaderList(headers); - - mHeaders = headers; } private void updateHeaderList(List<Header> target) { @@ -730,17 +730,11 @@ public class Settings extends PreferenceActivity @Override public void setListAdapter(ListAdapter adapter) { - if (mHeaders == null) { - mHeaders = new ArrayList<Header>(); - // When the saved state provides the list of headers, onBuildHeaders is not called - // Copy the list of Headers from the adapter, preserving their order - for (int i = 0; i < adapter.getCount(); i++) { - mHeaders.add((Header) adapter.getItem(i)); - } + if (adapter == null) { + super.setListAdapter(null); + } else { + super.setListAdapter(new HeaderAdapter(this, getHeaders(), mAuthenticatorHelper)); } - - // Ignore the adapter provided by PreferenceActivity and substitute ours instead - super.setListAdapter(new HeaderAdapter(this, mHeaders, mAuthenticatorHelper)); } @Override |