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

Commit a0a49b62 authored by Sven Dawitz's avatar Sven Dawitz Committed by Steve Kondik
Browse files

Added option for 180 degree rotation. Settings part.

This patch enables the rotation to 180 degrees.
Inspired by a patch for cm61, where you could
toggle 90/180/270 degrees rotation.
Since WindowOrientationListener.java got completly
changed, i couldnt port that patch, but had
to implement it in a different way.

Change-Id: Iba1a323bf5058d5392fc287593cbd367561cfb73
parent d50d4a16
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -14,6 +14,10 @@
    <string name="pref_electron_beam_animation_on">Screen-on animation</string>
    <string name="pref_electron_beam_animation_off">Screen-off animation</string>

    <!-- User interface : 180 degree rotation -->
    <string name="pref_rotate_180_title">Rotate 180 degrees</string>
    <string name="pref_rotate_180_summary">Allows additional 180 degree rotation when auto-rotate screen is activated</string>

    <!-- User interface : LED Notifications -->
    <string name="trackball_title">LED notifications</string>
    <string name="trackball_summary">Control trackball/LED notification colors and pulse</string>
+7 −2
Original line number Diff line number Diff line
@@ -31,6 +31,11 @@
                android:targetClass="com.cyanogenmod.cmparts.activities.BacklightActivity" />
        </PreferenceScreen>

        <!-- 180 degree rotation toggle -->
        <CheckBoxPreference android:key="pref_rotate_180"
            android:title="@string/pref_rotate_180_title"
            android:summary="@string/pref_rotate_180_summary" />

        <CheckBoxPreference android:key="electron_beam_animation_on"
            android:title="@string/pref_electron_beam_animation_on" />

+14 −1
Original line number Diff line number Diff line
@@ -66,6 +66,8 @@ public class UIActivity extends PreferenceActivity implements OnPreferenceChange

    private static final String OVERSCROLL_WEIGHT_PREF = "pref_overscroll_weight";

    private static final String ROTATE_180_PREF = "pref_rotate_180";

    /* Screen Lock */
    private static final String LOCKSCREEN_TIMEOUT_DELAY_PREF = "pref_lockscreen_timeout_delay";

@@ -97,6 +99,8 @@ public class UIActivity extends PreferenceActivity implements OnPreferenceChange

    private ListPreference mOverscrollWeightPref;

    private CheckBoxPreference mRotate180Pref;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
@@ -189,7 +193,10 @@ public class UIActivity extends PreferenceActivity implements OnPreferenceChange
        mOverscrollWeightPref.setValue(String.valueOf(overscrollWeight));
        mOverscrollWeightPref.setOnPreferenceChangeListener(this);


        /* Rotate 180 */
        mRotate180Pref = (CheckBoxPreference) prefSet.findPreference(ROTATE_180_PREF);
        mRotate180Pref.setChecked(Settings.System.getInt(getContentResolver(),
                Settings.System.ACCELEROMETER_ROTATE_180, 0) == 1);
    }

    public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
@@ -257,6 +264,12 @@ public class UIActivity extends PreferenceActivity implements OnPreferenceChange
                    Settings.System.ELECTRON_BEAM_ANIMATION_OFF, value ? 1 : 0);
        }

        if (preference == mRotate180Pref) {
            value = mRotate180Pref.isChecked();
            Settings.System.putInt(getContentResolver(),
                    Settings.System.ACCELEROMETER_ROTATE_180, value ? 1 : 0);
        }

        return true;
    }