Updating Launcher rotation logic
When auto-rotate is on, launcher allways allows rotation. This allows uses to use locked rotation feature is available on the device When auto-rotate is off, workspace does not allow rotation, but overview in quickstep will allow rotation Bug: 73872056 Change-Id: Ie12365c268fd5e4958634ed97b5a33dcadc691e2
This commit is contained in:
1 parent
85f1eed52d
commit
623eddd7e8
14 files changed
+180
-172
No files matched your search
@@ -65,7 +65,6 @@ public class SettingsActivity extends Activity {
|
||||
*/
|
||||
public static class LauncherSettingsFragment extends PreferenceFragment {
|
||||
|
||||
private SystemDisplayRotationLockObserver mRotationLockObserver;
|
||||
private IconBadgingObserver mIconBadgingObserver;
|
||||
|
||||
@Override
|
||||
@@ -76,22 +75,6 @@ public class SettingsActivity extends Activity {
|
||||
|
||||
ContentResolver resolver = getActivity().getContentResolver();
|
||||
|
||||
// Setup allow rotation preference
|
||||
Preference rotationPref = findPreference(Utilities.ALLOW_ROTATION_PREFERENCE_KEY);
|
||||
if (getResources().getBoolean(R.bool.allow_rotation)) {
|
||||
// Launcher supports rotation by default. No need to show this setting.
|
||||
getPreferenceScreen().removePreference(rotationPref);
|
||||
} else {
|
||||
mRotationLockObserver = new SystemDisplayRotationLockObserver(rotationPref, resolver);
|
||||
|
||||
// Register a content observer to listen for system setting changes while
|
||||
// this UI is active.
|
||||
mRotationLockObserver.register(Settings.System.ACCELEROMETER_ROTATION);
|
||||
|
||||
// Initialize the UI once
|
||||
rotationPref.setDefaultValue(Utilities.getAllowRotationDefaultValue(getActivity()));
|
||||
}
|
||||
|
||||
ButtonPreference iconBadgingPref =
|
||||
(ButtonPreference) findPreference(ICON_BADGING_PREFERENCE_KEY);
|
||||
if (!Utilities.ATLEAST_OREO) {
|
||||
@@ -119,10 +102,6 @@ public class SettingsActivity extends Activity {
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
if (mRotationLockObserver != null) {
|
||||
mRotationLockObserver.unregister();
|
||||
mRotationLockObserver = null;
|
||||
}
|
||||
if (mIconBadgingObserver != null) {
|
||||
mIconBadgingObserver.unregister();
|
||||
mIconBadgingObserver = null;
|
||||
@@ -131,28 +110,6 @@ public class SettingsActivity extends Activity {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Content observer which listens for system auto-rotate setting changes, and enables/disables
|
||||
* the launcher rotation setting accordingly.
|
||||
*/
|
||||
private static class SystemDisplayRotationLockObserver extends SettingsObserver.System {
|
||||
|
||||
private final Preference mRotationPref;
|
||||
|
||||
public SystemDisplayRotationLockObserver(
|
||||
Preference rotationPref, ContentResolver resolver) {
|
||||
super(resolver);
|
||||
mRotationPref = rotationPref;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSettingChanged(boolean enabled) {
|
||||
mRotationPref.setEnabled(enabled);
|
||||
mRotationPref.setSummary(enabled
|
||||
? R.string.allow_rotation_desc : R.string.allow_rotation_blocked_desc);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Content observer which listens for system badging setting changes,
|
||||
* and updates the launcher badging setting subtext accordingly.
|
||||
|
||||
Reference in new issue
Block a user