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

Commit 6bc91864 authored by Tadashi G. Takaoka's avatar Tadashi G. Takaoka
Browse files

Disabled key should respond if it is in the altCodeWhileTyping state

Bug: 6128215
Change-Id: I81e9980f8ffa5c5eaba30676c8433f542645de1d
parent 3848ca67
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -21,6 +21,6 @@
<animator
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:valueType="intType"
    android:duration="400"
    android:duration="70"
    android:valueFrom="255"
    android:valueTo="128" />
+1 −1
Original line number Diff line number Diff line
@@ -908,7 +908,7 @@ public class LatinKeyboardView extends KeyboardView implements PointerTracker.Ke

    @Override
    protected void onDrawKeyTopVisuals(Key key, Canvas canvas, Paint paint, KeyDrawParams params) {
        if (key.altCodeWhileTyping()) {
        if (key.altCodeWhileTyping() && key.isEnabled()) {
            params.mAnimAlpha = mAltCodeKeyWhileTypingAnimAlpha;
        }
        if (key.mCode == Keyboard.CODE_SPACE) {
+15 −6
Original line number Diff line number Diff line
@@ -251,18 +251,19 @@ public class PointerTracker {
    // primaryCode is different from {@link Key#mCode}.
    private void callListenerOnCodeInput(Key key, int primaryCode, int x, int y) {
        final boolean ignoreModifierKey = mIgnoreModifierKey && key.isModifier();
        final boolean alterCode = key.altCodeWhileTyping() && mTimerProxy.isTypingState();
        final int code = alterCode ? key.mAltCode : primaryCode;
        final boolean altersCode = key.altCodeWhileTyping() && mTimerProxy.isTypingState();
        final int code = altersCode ? key.mAltCode : primaryCode;
        if (DEBUG_LISTENER) {
            Log.d(TAG, "onCodeInput: " + Keyboard.printableCode(code) + " text=" + key.mOutputText
                    + " x=" + x + " y=" + y
                    + " ignoreModifier=" + ignoreModifierKey + " alterCode=" + alterCode
                    + " ignoreModifier=" + ignoreModifierKey + " altersCode=" + altersCode
                    + " enabled=" + key.isEnabled());
        }
        if (ignoreModifierKey) {
            return;
        }
        if (key.isEnabled()) {
        // Even if the key is disabled, it should respond if it is in the altCodeWhileTyping state.
        if (key.isEnabled() || altersCode) {
            if (code == Keyboard.CODE_OUTPUT_TEXT) {
                mListener.onTextInput(key.mOutputText);
            } else if (code != Keyboard.CODE_UNSPECIFIED) {
@@ -322,10 +323,11 @@ public class PointerTracker {

    private void setReleasedKeyGraphics(Key key) {
        mDrawingProxy.dismissKeyPreview(this);
        if (key == null || !key.isEnabled()) {
        if (key == null) {
            return;
        }

        // Even if the key is disabled, update the key release graphics just in case.
        updateReleaseKeyGraphics(key);

        if (key.isShift()) {
@@ -351,7 +353,14 @@ public class PointerTracker {
    }

    private void setPressedKeyGraphics(Key key) {
        if (key == null || !key.isEnabled()) {
        if (key == null) {
            return;
        }

        // Even if the key is disabled, it should respond if it is in the altCodeWhileTyping state.
        final boolean altersCode = key.altCodeWhileTyping() && mTimerProxy.isTypingState();
        final boolean needsToUpdateGraphics = key.isEnabled() || altersCode;
        if (!needsToUpdateGraphics) {
            return;
        }