diff options
author | Chris Wren <cwren@android.com> | 2012-09-26 13:18:01 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-09-26 13:18:02 -0700 |
commit | 99f98bb14607240a0e05997a18770912ade1587e (patch) | |
tree | faeeaecaf350c24ef1c889ad4fd392f1a086d33d | |
parent | 6f2ca5bc71d9afc531b60762b8676cacdb96fcaa (diff) | |
parent | 63707af94a8ceb23f39f35454025c94e10d52397 (diff) | |
download | packages_apps_settings-99f98bb14607240a0e05997a18770912ade1587e.zip packages_apps_settings-99f98bb14607240a0e05997a18770912ade1587e.tar.gz packages_apps_settings-99f98bb14607240a0e05997a18770912ade1587e.tar.bz2 |
Merge "show the dream enable switch in all conditions." into jb-mr1-dev
-rw-r--r-- | src/com/android/settings/DreamSettings.java | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/src/com/android/settings/DreamSettings.java b/src/com/android/settings/DreamSettings.java index 43f3ce6..ca4415b 100644 --- a/src/com/android/settings/DreamSettings.java +++ b/src/com/android/settings/DreamSettings.java @@ -96,24 +96,27 @@ public class DreamSettings extends SettingsPreferenceFragment { } } }); - if (activity instanceof PreferenceActivity) { - PreferenceActivity preferenceActivity = (PreferenceActivity) activity; - if (preferenceActivity.onIsHidingHeaders() || !preferenceActivity.onIsMultiPane()) { - final int padding = activity.getResources().getDimensionPixelSize( - R.dimen.action_bar_switch_padding); - mSwitch.setPadding(0, 0, padding, 0); - activity.getActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM, - ActionBar.DISPLAY_SHOW_CUSTOM); - activity.getActionBar().setCustomView(mSwitch, new ActionBar.LayoutParams( - ActionBar.LayoutParams.WRAP_CONTENT, - ActionBar.LayoutParams.WRAP_CONTENT, - Gravity.CENTER_VERTICAL | Gravity.END)); - } - } + + final int padding = activity.getResources().getDimensionPixelSize( + R.dimen.action_bar_switch_padding); + mSwitch.setPadding(0, 0, padding, 0); + activity.getActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM, + ActionBar.DISPLAY_SHOW_CUSTOM); + activity.getActionBar().setCustomView(mSwitch, new ActionBar.LayoutParams( + ActionBar.LayoutParams.WRAP_CONTENT, + ActionBar.LayoutParams.WRAP_CONTENT, + Gravity.CENTER_VERTICAL | Gravity.END)); + setHasOptionsMenu(true); } @Override + public void onDestroyView() { + getActivity().getActionBar().setCustomView(null); + super.onDestroyView(); + } + + @Override public void onActivityCreated(Bundle savedInstanceState) { logd("onActivityCreated(%s)", savedInstanceState); super.onActivityCreated(savedInstanceState); |