diff options
author | Chris Wren <cwren@android.com> | 2012-09-26 14:39:05 -0400 |
---|---|---|
committer | Chris Wren <cwren@android.com> | 2012-09-26 14:53:45 -0400 |
commit | 63707af94a8ceb23f39f35454025c94e10d52397 (patch) | |
tree | 9e43c5da7d47a9f0ab0446658cb2ebc63f26f51a | |
parent | 49dc9825569d0c555466303d7d78f1bc75e1602b (diff) | |
download | packages_apps_settings-63707af94a8ceb23f39f35454025c94e10d52397.zip packages_apps_settings-63707af94a8ceb23f39f35454025c94e10d52397.tar.gz packages_apps_settings-63707af94a8ceb23f39f35454025c94e10d52397.tar.bz2 |
show the dream enable switch in all conditions.
Bug: 7229905
Change-Id: I3fc3b2e8ce1e8bb08c72daed9c5d33ce5ff343c6
-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); |