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

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

Added more options for rotary lockscreen

after getting some user feedback, i added:

- Drag down to unlock (like know from other roms)
- Hide directional hint arrows
- Toggle custom app starter icon

i also cleaned up the growing lockscreen options screen a bit

Change-Id: Ieef90e333730c9d64a39c5f24f8edcf7e0c74209
parent d1cb9bd3
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -2113,6 +2113,26 @@ public final class Settings {
         */
        public static final String LOCKSCREEN_CUSTOM_APP_ACTIVITY = "lockscreen_custom_app_activity";

        /**
         * 1: Show custom app icon (currently cm logo) as with new patch
         * 2: Show messaging app icon as in old lockscreen
         * possibly more in the future (if more png files are drawn)
         * @hide
         */
        public static final String LOCKSCREEN_CUSTOM_ICON_STYLE = "lockscreen_custom_icon_style";

        /**
         * When enabled, rotary lockscreen switches app starter and unlock, so you can drag down to unlock
         * @hide
         */
        public static final String LOCKSCREEN_ROTARY_UNLOCK_DOWN = "lockscreen_rotary_unlock_down";

        /**
         * When enabled, directional hint arrows are supressed
         * @hide
         */
        public static final String LOCKSCREEN_ROTARY_HIDE_ARROWS = "lockscreen_rotary_hide_arrows";

        /**
         * Sets the lockscreen style
         * @hide
+50 −39
Original line number Diff line number Diff line
@@ -82,6 +82,8 @@ public class RotarySelector extends View {
    private int mEventStartY;
    // controls display of custom app dimple
    private boolean mCustomAppDimple=false;
    // controls hiding of directional arrows
    private boolean mHideArrows=false;

    // state of the animation used to bring the handle back to its start position when
    // the user lets go before triggering an action
@@ -345,6 +347,7 @@ public class RotarySelector extends View {
        mBgMatrix.setTranslate(0, - (float)(mRotaryOffsetY + bgTop));

        // Draw the correct arrow(s) depending on the current state:
        if (!mHideArrows) {
            mArrowMatrix.reset();
            switch (mGrabbedState) {
                case NOTHING_GRABBED:
@@ -385,6 +388,7 @@ public class RotarySelector extends View {
                default:
                    throw new IllegalStateException("invalid mGrabbedState: " + mGrabbedState);
            }
        }

        if (VISUAL_DEBUG) {
            // draw circle bounding arc drawable: good sanity check we're doing the math correctly
@@ -879,6 +883,13 @@ public class RotarySelector extends View {
        mCustomAppDimple=newState;
    }

    /**
     * Sets weather or not to display the directional arrows
     */
    public void hideArrows(boolean newState){
        mHideArrows=newState;
    }


    // Debugging / testing code

+40 −5
Original line number Diff line number Diff line
@@ -163,6 +163,15 @@ class LockScreen extends LinearLayout implements KeyguardScreen, KeyguardUpdateM
    private int mLockscreenStyle = (Settings.System.getInt(mContext.getContentResolver(),
            Settings.System.LOCKSCREEN_STYLE_PREF, 1));

    private int mCustomIconStyle = Settings.System.getInt(mContext.getContentResolver(),
            Settings.System.LOCKSCREEN_CUSTOM_ICON_STYLE, 1);

    private boolean mRotaryUnlockDown = (Settings.System.getInt(mContext.getContentResolver(),
            Settings.System.LOCKSCREEN_ROTARY_UNLOCK_DOWN, 0) == 1);

    private boolean mRotaryHideArrows = (Settings.System.getInt(mContext.getContentResolver(),
            Settings.System.LOCKSCREEN_ROTARY_HIDE_ARROWS, 0) == 1);

    private boolean mUseRotaryLockscreen = (mLockscreenStyle == 2);

    private double mGestureSensitivity;
@@ -391,9 +400,18 @@ class LockScreen extends LinearLayout implements KeyguardScreen, KeyguardUpdateM
        mAudioManager = (AudioManager) getContext().getSystemService(Context.AUDIO_SERVICE);
        mSilentMode = isSilentMode();


        //Rotary setup
        if(!mRotaryUnlockDown){
            mRotarySelector.setLeftHandleResource(R.drawable.ic_jog_dial_unlock);
        mRotarySelector.setMidHandleResource(R.drawable.ic_jog_dial_custom);
            mRotarySelector.setMidHandleResource((mCustomIconStyle == 1) ? R.drawable.ic_jog_dial_custom : R.drawable.ic_jog_dial_messaging);
        }else{
            mRotarySelector.setLeftHandleResource((mCustomIconStyle == 1) ? R.drawable.ic_jog_dial_custom : R.drawable.ic_jog_dial_messaging);
            mRotarySelector.setMidHandleResource(R.drawable.ic_jog_dial_unlock);
        }
        mRotarySelector.enableCustomAppDimple(mCustomAppToggle);
        if(mRotaryHideArrows)
            mRotarySelector.hideArrows(true);

        mTabSelector.setLeftTabResources(
                R.drawable.ic_jog_dial_unlock,
@@ -411,7 +429,8 @@ class LockScreen extends LinearLayout implements KeyguardScreen, KeyguardUpdateM
                    R.drawable.jog_tab_target_green, R.drawable.jog_tab_bar_left_generic,
                    R.drawable.jog_tab_left_generic);

            mSelector2.setRightTabResources(R.drawable.ic_jog_dial_custom,
            mSelector2.setRightTabResources((mCustomIconStyle == 1) ? R.drawable.ic_jog_dial_custom 
                         : R.drawable.ic_jog_dial_messaging,
                    R.drawable.jog_tab_target_green, R.drawable.jog_tab_bar_right_generic,
                    R.drawable.jog_tab_right_generic);

@@ -569,9 +588,25 @@ class LockScreen extends LinearLayout implements KeyguardScreen, KeyguardUpdateM

    /** {@inheritDoc} */
    public void onDialTrigger(View v, int whichHandle) {
        boolean mUnlockTrigger=false;
        boolean mCustomAppTrigger=false;

        if(whichHandle == RotarySelector.OnDialTriggerListener.LEFT_HANDLE){
            if(mRotaryUnlockDown)
                mCustomAppTrigger=true;
            else
                mUnlockTrigger=true;
        }
        if(whichHandle == RotarySelector.OnDialTriggerListener.MID_HANDLE){
            if(mRotaryUnlockDown)
                mUnlockTrigger=true;
            else
                mCustomAppTrigger=true;
        }

        if (mUnlockTrigger) {
            mCallback.goToUnlockScreen();
        } else if (whichHandle == RotarySelector.OnDialTriggerListener.MID_HANDLE) {
        } else if (mCustomAppTrigger) {
            if (mCustomAppActivity != null) {
                try {
                    Intent i = Intent.parseUri(mCustomAppActivity, 0);