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

Commit 8c8b9fb0 authored by Vishwath Mohan's avatar Vishwath Mohan
Browse files

Provide the option to disable fading the pattern.

This CL adds a setPatternFade() method that allows enabling or
disabling the pattern fade (it's enabled by default).

Test: Pattern fades everywhere else but during the setup flow.
Bug: 72798512
Change-Id: I2bb87975b1e50eb1add9e18a224a81f3448ec91a
parent f759af6f
Loading
Loading
Loading
Loading
+19 −2
Original line number Diff line number Diff line
@@ -125,6 +125,7 @@ public class LockPatternView extends View {
    private boolean mInStealthMode = false;
    private boolean mEnableHapticFeedback = true;
    private boolean mPatternInProgress = false;
    private boolean mFadePattern = true;

    private float mHitFactor = 0.6f;

@@ -375,6 +376,14 @@ public class LockPatternView extends View {
        mInStealthMode = inStealthMode;
    }

    /**
     * Set whether the pattern should fade as it's being drawn. If
     * true, each segment of the pattern fades over time.
     */
    public void setFadePattern(boolean fadePattern) {
        mFadePattern = fadePattern;
    }

    /**
     * Set whether the view will use tactile feedback.  If true, there will be
     * tactile feedback as the user enters the pattern.
@@ -1167,10 +1176,18 @@ public class LockPatternView extends View {
                    currentPath.moveTo(lastX, lastY);
                    if (state.lineEndX != Float.MIN_VALUE && state.lineEndY != Float.MIN_VALUE) {
                        currentPath.lineTo(state.lineEndX, state.lineEndY);
                        if (mFadePattern) {
                            mPathPaint.setAlpha((int) 255 - lineFadeVal );
                        } else {
                            mPathPaint.setAlpha(255);
                        }
                    } else {
                        currentPath.lineTo(centerX, centerY);
                        if (mFadePattern) {
                            mPathPaint.setAlpha((int) 255 - lineFadeVal );
                        } else {
                            mPathPaint.setAlpha(255);
                        }
                    }
                    canvas.drawPath(currentPath, mPathPaint);
                }