Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bb4102fd authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Kepping the rotation setting UI always enabled and accessible" into ub-launcher3-edmonton

parents 6c5e169d c919a4fa
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -183,8 +183,6 @@
    <string name="allow_rotation_title">Allow Home screen rotation</string>
    <!-- Text explaining when the home screen will get rotated. [CHAR LIMIT=100] -->
    <string name="allow_rotation_desc">When phone is rotated</string>
    <!-- Text explaining that rotation is disabled in Display settings. 'Display' refers to the Display section in system settings [CHAR LIMIT=100] -->
    <string name="allow_rotation_blocked_desc">Current Display setting doesn\'t permit rotation</string>
    <!-- Title for Notification dots setting. Tapping this will link to the system Notifications settings screen where the user can turn off notification dots globally. [CHAR LIMIT=50] -->
    <string name="icon_badging_title">Notification dots</string>
    <!-- Text to indicate that the system icon badging setting is on [CHAR LIMIT=100] -->
+1 −0
Original line number Diff line number Diff line
@@ -39,6 +39,7 @@
    <SwitchPreference
        android:key="pref_allowRotation"
        android:title="@string/allow_rotation_title"
        android:summary="@string/allow_rotation_desc"
        android:defaultValue="@bool/allow_rotation"
        android:persistent="true" />

+0 −28
Original line number Diff line number Diff line
@@ -87,7 +87,6 @@ public class SettingsActivity extends Activity {
    public static class LauncherSettingsFragment extends PreferenceFragment {

        private IconBadgingObserver mIconBadgingObserver;
        private RotationLockObserver mRotationLockObserver;

        private String mPreferenceKey;
        private boolean mPreferenceHighlighted = false;
@@ -134,12 +133,6 @@ public class SettingsActivity extends Activity {
                // Launcher supports rotation by default. No need to show this setting.
                getPreferenceScreen().removePreference(rotationPref);
            } else {
                mRotationLockObserver = new RotationLockObserver(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(getAllowRotationDefaultValue());
            }
@@ -201,10 +194,6 @@ public class SettingsActivity extends Activity {
                mIconBadgingObserver.unregister();
                mIconBadgingObserver = null;
            }
            if (mRotationLockObserver != null) {
                mRotationLockObserver.unregister();
                mRotationLockObserver = null;
            }
            super.onDestroy();
        }

@@ -228,23 +217,6 @@ public class SettingsActivity extends Activity {
        }
    }

    private static class RotationLockObserver extends SettingsObserver.System {

        private final Preference mRotationPref;

        public RotationLockObserver(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.