Merge "Show screen saver toggle on tablets." into ics-mr1

This commit is contained in:
Daniel Sandler
2011-11-29 18:18:29 -08:00
committed by Android (Google) Code Review

View File

@@ -69,18 +69,19 @@ public class DreamSettings extends SettingsPreferenceFragment {
if (activity instanceof PreferenceActivity) { if (activity instanceof PreferenceActivity) {
PreferenceActivity preferenceActivity = (PreferenceActivity) activity; PreferenceActivity preferenceActivity = (PreferenceActivity) activity;
if (preferenceActivity.onIsHidingHeaders() || !preferenceActivity.onIsMultiPane()) { // note: we do not check onIsHidingHeaders() or onIsMultiPane() because there's no
final int padding = activity.getResources().getDimensionPixelSize( // switch in the left-hand pane to control this; we need to show the ON/OFF in our
R.dimen.action_bar_switch_padding); // fragment every time
mEnableSwitch.setPadding(0, 0, padding, 0); final int padding = activity.getResources().getDimensionPixelSize(
activity.getActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM, R.dimen.action_bar_switch_padding);
ActionBar.DISPLAY_SHOW_CUSTOM); mEnableSwitch.setPadding(0, 0, padding, 0);
activity.getActionBar().setCustomView(mEnableSwitch, new ActionBar.LayoutParams( activity.getActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM,
ActionBar.LayoutParams.WRAP_CONTENT, ActionBar.DISPLAY_SHOW_CUSTOM);
ActionBar.LayoutParams.WRAP_CONTENT, activity.getActionBar().setCustomView(mEnableSwitch, new ActionBar.LayoutParams(
Gravity.CENTER_VERTICAL | Gravity.RIGHT)); ActionBar.LayoutParams.WRAP_CONTENT,
activity.getActionBar().setTitle(R.string.screensaver_settings_title); ActionBar.LayoutParams.WRAP_CONTENT,
} Gravity.CENTER_VERTICAL | Gravity.RIGHT));
activity.getActionBar().setTitle(R.string.screensaver_settings_title);
} }
mEnabler = new Enabler(activity, mEnableSwitch); mEnabler = new Enabler(activity, mEnableSwitch);