summaryrefslogtreecommitdiffstats
path: root/src/com/android/settings/cyanogenmod/DisplayRotation.java
diff options
context:
space:
mode:
authorKelly <mushroomhead52e@gmail.com>2012-08-15 20:19:22 -0400
committerGerrit Code Review <gerrit@cyanogenmod.org>2013-07-10 15:41:48 -0700
commitb6d2bc789a0d87afd75503ade002d18dbb042831 (patch)
treea489f32fc8d3753afbf5dbd9f282ca9ef9280dd7 /src/com/android/settings/cyanogenmod/DisplayRotation.java
parent8182baea2433ac750e0d57dc223570475553c385 (diff)
downloadpackages_apps_settings-b6d2bc789a0d87afd75503ade002d18dbb042831.zip
packages_apps_settings-b6d2bc789a0d87afd75503ade002d18dbb042831.tar.gz
packages_apps_settings-b6d2bc789a0d87afd75503ade002d18dbb042831.tar.bz2
Add lockscreen rotation as an optional rotation setting (2/2)
This will allow the user to select wether or not to use the rotation settings for the lockscreen. This is dependent upon the rotation setting being checked. Signed-off-by: Michael Bestas <mikeioannina@gmail.com> Change-Id: If45c13a395e0d71b7c4cdcf484a6b8cef964ee37 JIRA: CYAN-339
Diffstat (limited to 'src/com/android/settings/cyanogenmod/DisplayRotation.java')
-rw-r--r--src/com/android/settings/cyanogenmod/DisplayRotation.java24
1 files changed, 17 insertions, 7 deletions
diff --git a/src/com/android/settings/cyanogenmod/DisplayRotation.java b/src/com/android/settings/cyanogenmod/DisplayRotation.java
index 15b4137..b11c2fb 100644
--- a/src/com/android/settings/cyanogenmod/DisplayRotation.java
+++ b/src/com/android/settings/cyanogenmod/DisplayRotation.java
@@ -35,6 +35,7 @@ public class DisplayRotation extends SettingsPreferenceFragment implements OnPre
private static final String TAG = "DisplayRotation";
private static final String KEY_ACCELEROMETER = "accelerometer";
+ private static final String LOCKSCREEN_ROTATION = "lockscreen_rotation";
private static final String ROTATION_0_PREF = "display_rotation_0";
private static final String ROTATION_90_PREF = "display_rotation_90";
private static final String ROTATION_180_PREF = "display_rotation_180";
@@ -42,6 +43,7 @@ public class DisplayRotation extends SettingsPreferenceFragment implements OnPre
private static final String KEY_SWAP_VOLUME_BUTTONS = "swap_volume_buttons";
private CheckBoxPreference mAccelerometer;
+ private CheckBoxPreference mLockScreenRotationPref;
private CheckBoxPreference mRotation0Pref;
private CheckBoxPreference mRotation90Pref;
private CheckBoxPreference mRotation180Pref;
@@ -74,6 +76,7 @@ public class DisplayRotation extends SettingsPreferenceFragment implements OnPre
mAccelerometer = (CheckBoxPreference) findPreference(KEY_ACCELEROMETER);
mAccelerometer.setPersistent(false);
+ mLockScreenRotationPref = (CheckBoxPreference) prefSet.findPreference(LOCKSCREEN_ROTATION);
mRotation0Pref = (CheckBoxPreference) prefSet.findPreference(ROTATION_0_PREF);
mRotation90Pref = (CheckBoxPreference) prefSet.findPreference(ROTATION_90_PREF);
mRotation180Pref = (CheckBoxPreference) prefSet.findPreference(ROTATION_180_PREF);
@@ -99,6 +102,11 @@ public class DisplayRotation extends SettingsPreferenceFragment implements OnPre
}
}
+ if (mLockScreenRotationPref != null) {
+ mLockScreenRotationPref.setChecked(Settings.System.getInt(getContentResolver(),
+ Settings.System.LOCKSCREEN_ROTATION, 0) != 0);
+ }
+
if (hasRotationLock) {
// Disable accelerometer checkbox, but leave others enabled
mAccelerometer.setEnabled(false);
@@ -159,16 +167,18 @@ public class DisplayRotation extends SettingsPreferenceFragment implements OnPre
mode |= ROTATION_0_MODE;
mRotation0Pref.setChecked(true);
}
- Settings.System.putInt(getActivity().getApplicationContext().getContentResolver(),
+ Settings.System.putInt(getActivity().getContentResolver(),
Settings.System.ACCELEROMETER_ROTATION_ANGLES, mode);
return true;
+ } else if (preference == mLockScreenRotationPref) {
+ boolean value = mLockScreenRotationPref.isChecked();
+ Settings.System.putInt(getActivity().getContentResolver(),
+ Settings.System.LOCKSCREEN_ROTATION, value ? 1 : 0);
+ return true;
} else if (preference == mSwapVolumeButtons) {
- Context context = getActivity().getApplicationContext();
- Settings.System.putInt(context.getContentResolver(),
- Settings.System.SWAP_VOLUME_KEYS_ON_ROTATION,
- mSwapVolumeButtons.isChecked()
- ? (Utils.isTablet(context) ? 2 : 1)
- : 0);
+ int value = mSwapVolumeButtons.isChecked() ? (Utils.isTablet(getActivity()) ? 2 : 1) : 0;
+ Settings.System.putInt(getActivity().getContentResolver(),
+ Settings.System.SWAP_VOLUME_KEYS_ON_ROTATION, value);
}
return super.onPreferenceTreeClick(preferenceScreen, preference);