Remove rotation-lock from Display settings.
Ability to lock device to natural orientation is still available under Accessibility. Bug:11062710 Change-Id: I2045e16cfc676ee75d4d42b0cd652433b2f12715
This commit is contained in:
@@ -27,10 +27,6 @@
|
|||||||
android:title="@string/wallpaper_settings_title"
|
android:title="@string/wallpaper_settings_title"
|
||||||
android:fragment="com.android.settings.WallpaperTypeSettings" />
|
android:fragment="com.android.settings.WallpaperTypeSettings" />
|
||||||
|
|
||||||
<CheckBoxPreference
|
|
||||||
android:key="accelerometer"
|
|
||||||
android:title="@string/accelerometer_title"/>
|
|
||||||
|
|
||||||
<ListPreference
|
<ListPreference
|
||||||
android:key="screen_timeout"
|
android:key="screen_timeout"
|
||||||
android:title="@string/screen_timeout"
|
android:title="@string/screen_timeout"
|
||||||
|
@@ -49,14 +49,12 @@ public class DisplaySettings extends SettingsPreferenceFragment implements
|
|||||||
private static final int FALLBACK_SCREEN_TIMEOUT_VALUE = 30000;
|
private static final int FALLBACK_SCREEN_TIMEOUT_VALUE = 30000;
|
||||||
|
|
||||||
private static final String KEY_SCREEN_TIMEOUT = "screen_timeout";
|
private static final String KEY_SCREEN_TIMEOUT = "screen_timeout";
|
||||||
private static final String KEY_ACCELEROMETER = "accelerometer";
|
|
||||||
private static final String KEY_FONT_SIZE = "font_size";
|
private static final String KEY_FONT_SIZE = "font_size";
|
||||||
private static final String KEY_NOTIFICATION_PULSE = "notification_pulse";
|
private static final String KEY_NOTIFICATION_PULSE = "notification_pulse";
|
||||||
private static final String KEY_SCREEN_SAVER = "screensaver";
|
private static final String KEY_SCREEN_SAVER = "screensaver";
|
||||||
|
|
||||||
private static final int DLG_GLOBAL_CHANGE_WARNING = 1;
|
private static final int DLG_GLOBAL_CHANGE_WARNING = 1;
|
||||||
|
|
||||||
private CheckBoxPreference mAccelerometer;
|
|
||||||
private WarnedListPreference mFontSizePref;
|
private WarnedListPreference mFontSizePref;
|
||||||
private CheckBoxPreference mNotificationPulse;
|
private CheckBoxPreference mNotificationPulse;
|
||||||
|
|
||||||
@@ -65,14 +63,6 @@ public class DisplaySettings extends SettingsPreferenceFragment implements
|
|||||||
private ListPreference mScreenTimeoutPreference;
|
private ListPreference mScreenTimeoutPreference;
|
||||||
private Preference mScreenSaverPreference;
|
private Preference mScreenSaverPreference;
|
||||||
|
|
||||||
private final RotationPolicy.RotationPolicyListener mRotationPolicyListener =
|
|
||||||
new RotationPolicy.RotationPolicyListener() {
|
|
||||||
@Override
|
|
||||||
public void onChange() {
|
|
||||||
updateAccelerometerRotationCheckbox();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
@@ -80,16 +70,6 @@ public class DisplaySettings extends SettingsPreferenceFragment implements
|
|||||||
|
|
||||||
addPreferencesFromResource(R.xml.display_settings);
|
addPreferencesFromResource(R.xml.display_settings);
|
||||||
|
|
||||||
mAccelerometer = (CheckBoxPreference) findPreference(KEY_ACCELEROMETER);
|
|
||||||
mAccelerometer.setPersistent(false);
|
|
||||||
if (!RotationPolicy.isRotationSupported(getActivity())
|
|
||||||
|| RotationPolicy.isRotationLockToggleSupported(getActivity())) {
|
|
||||||
// If rotation lock is supported, then we do not provide this option in
|
|
||||||
// Display settings. However, is still available in Accessibility settings,
|
|
||||||
// if the device supports rotation.
|
|
||||||
getPreferenceScreen().removePreference(mAccelerometer);
|
|
||||||
}
|
|
||||||
|
|
||||||
mScreenSaverPreference = findPreference(KEY_SCREEN_SAVER);
|
mScreenSaverPreference = findPreference(KEY_SCREEN_SAVER);
|
||||||
if (mScreenSaverPreference != null
|
if (mScreenSaverPreference != null
|
||||||
&& getResources().getBoolean(
|
&& getResources().getBoolean(
|
||||||
@@ -226,20 +206,9 @@ public class DisplaySettings extends SettingsPreferenceFragment implements
|
|||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
|
|
||||||
RotationPolicy.registerRotationPolicyListener(getActivity(),
|
|
||||||
mRotationPolicyListener);
|
|
||||||
|
|
||||||
updateState();
|
updateState();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onPause() {
|
|
||||||
super.onPause();
|
|
||||||
|
|
||||||
RotationPolicy.unregisterRotationPolicyListener(getActivity(),
|
|
||||||
mRotationPolicyListener);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Dialog onCreateDialog(int dialogId) {
|
public Dialog onCreateDialog(int dialogId) {
|
||||||
if (dialogId == DLG_GLOBAL_CHANGE_WARNING) {
|
if (dialogId == DLG_GLOBAL_CHANGE_WARNING) {
|
||||||
@@ -255,7 +224,6 @@ public class DisplaySettings extends SettingsPreferenceFragment implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void updateState() {
|
private void updateState() {
|
||||||
updateAccelerometerRotationCheckbox();
|
|
||||||
readFontSizePreference(mFontSizePref);
|
readFontSizePreference(mFontSizePref);
|
||||||
updateScreenSaverSummary();
|
updateScreenSaverSummary();
|
||||||
}
|
}
|
||||||
@@ -267,12 +235,6 @@ public class DisplaySettings extends SettingsPreferenceFragment implements
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateAccelerometerRotationCheckbox() {
|
|
||||||
if (getActivity() == null) return;
|
|
||||||
|
|
||||||
mAccelerometer.setChecked(!RotationPolicy.isRotationLocked(getActivity()));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void writeFontSizePreference(Object objValue) {
|
public void writeFontSizePreference(Object objValue) {
|
||||||
try {
|
try {
|
||||||
mCurConfig.fontScale = Float.parseFloat(objValue.toString());
|
mCurConfig.fontScale = Float.parseFloat(objValue.toString());
|
||||||
@@ -284,10 +246,7 @@ public class DisplaySettings extends SettingsPreferenceFragment implements
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
|
public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
|
||||||
if (preference == mAccelerometer) {
|
if (preference == mNotificationPulse) {
|
||||||
RotationPolicy.setRotationLockForAccessibility(
|
|
||||||
getActivity(), !mAccelerometer.isChecked());
|
|
||||||
} else if (preference == mNotificationPulse) {
|
|
||||||
boolean value = mNotificationPulse.isChecked();
|
boolean value = mNotificationPulse.isChecked();
|
||||||
Settings.System.putInt(getContentResolver(), Settings.System.NOTIFICATION_LIGHT_PULSE,
|
Settings.System.putInt(getContentResolver(), Settings.System.NOTIFICATION_LIGHT_PULSE,
|
||||||
value ? 1 : 0);
|
value ? 1 : 0);
|
||||||
|
Reference in New Issue
Block a user