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

Commit 6cd9135c authored by LuK1337's avatar LuK1337 Committed by Bruno Martins
Browse files

Keyguard: Fix mapping mismatch between KeyEvent and NumPadKey

Change-Id: Ida28a4f037c2f3fa843ac136779e026020d711db
parent 01b994ac
Loading
Loading
Loading
Loading
+12 −3
Original line number Diff line number Diff line
@@ -51,6 +51,7 @@ public class KeyguardPINView extends KeyguardPinBasedInputView {
    private View mDivider;
    private int mDisappearYTranslation;
    private View[][] mViews;
    private boolean mScramblePin;
    private final KeyguardUpdateMonitor mKeyguardUpdateMonitor;

    private static List<Integer> sNumbers = Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 0);
@@ -131,9 +132,9 @@ public class KeyguardPINView extends KeyguardPinBasedInputView {
            });
        }

        boolean scramblePin = (LineageSettings.System.getInt(getContext().getContentResolver(),
                LineageSettings.System.LOCKSCREEN_PIN_SCRAMBLE_LAYOUT, 0) == 1);
        if (scramblePin) {
        mScramblePin = LineageSettings.System.getInt(getContext().getContentResolver(),
                LineageSettings.System.LOCKSCREEN_PIN_SCRAMBLE_LAYOUT, 0) == 1;
        if (mScramblePin) {
            Collections.shuffle(sNumbers);
            // get all children who are NumPadKey's
            LinearLayout container = (LinearLayout) findViewById(R.id.container);
@@ -214,6 +215,14 @@ public class KeyguardPINView extends KeyguardPinBasedInputView {
        setClipChildren(enable);
    }

    @Override
    protected int getNumberIndex(int number) {
        if (mScramblePin) {
            return (sNumbers.indexOf(number) + 1) % sNumbers.size();
        }
        return super.getNumberIndex(number);
    }

    @Override
    public boolean hasOverlappingRendering() {
        return false;
+5 −1
Original line number Diff line number Diff line
@@ -125,12 +125,16 @@ public abstract class KeyguardPinBasedInputView extends KeyguardAbsKeyInputView
        }
    }

    protected int getNumberIndex(int number) {
        return number;
    }

    private void performClick(View view) {
        view.performClick();
    }

    private void performNumberClick(int number) {
        switch (number) {
        switch (getNumberIndex(number)) {
            case 0:
                performClick(mButton0);
                break;