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

Commit 241b17de authored by Pawit Pornkitprasan's avatar Pawit Pornkitprasan
Browse files

Settings: rotation settings for devices with hardware rotation lock

All settings would be disabled on devices with hardware rotation
lock due to dependency setting. Disable dependency to allow setting
swap volume and rotation degrees on those devices.

Change-Id: Iee0532902d59fa80666e17b3853db8e3d7ed5ddc
parent e5b86228
Loading
Loading
Loading
Loading
+10 −3
Original line number Diff line number Diff line
@@ -74,9 +74,6 @@ public class DisplayRotation extends SettingsPreferenceFragment implements OnPre
        mAccelerometer = (CheckBoxPreference) findPreference(KEY_ACCELEROMETER);
        mAccelerometer.setPersistent(false);

        if (hasRotationLock) {
                mAccelerometer.setEnabled(false);
        }
        mRotation0Pref = (CheckBoxPreference) prefSet.findPreference(ROTATION_0_PREF);
        mRotation90Pref = (CheckBoxPreference) prefSet.findPreference(ROTATION_90_PREF);
        mRotation180Pref = (CheckBoxPreference) prefSet.findPreference(ROTATION_180_PREF);
@@ -101,6 +98,16 @@ public class DisplayRotation extends SettingsPreferenceFragment implements OnPre
                mSwapVolumeButtons.setChecked(swapVolumeKeys > 0);
            }
        }

        if (hasRotationLock) {
            // Disable accelerometer checkbox, but leave others enabled
            mAccelerometer.setEnabled(false);
            mSwapVolumeButtons.setDependency(null);
            mRotation0Pref.setDependency(null);
            mRotation90Pref.setDependency(null);
            mRotation180Pref.setDependency(null);
            mRotation270Pref.setDependency(null);
        }
    }

    @Override