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

Commit 8d7ffcb2 authored by Tadashi G. Takaoka's avatar Tadashi G. Takaoka
Browse files

Disable pop-up preview on mini keyboard

This change also disable the special behavior of long press a key that
has only one digit alternate.  If the visual design of both the pop-up
preview and the mini keyboard will look like same, I think that
showing mini keyboard is enough for the key that has one digit
alternate.

Bug: 2973546
Change-Id: I04f138c120aa58526fe054626dac856171fb7a58
parent 12659d4c
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -1073,7 +1073,8 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx
        mMiniKeyboardOriginY = y + container.getPaddingTop();
        mMiniKeyboard.setPopupOffset((x < 0) ? 0 : x, y);
        mMiniKeyboard.setShifted(isShifted());
        mMiniKeyboard.setPreviewEnabled(isPreviewEnabled());
        // Mini keyboard needs no pop-up key preview displayed.
        mMiniKeyboard.setPreviewEnabled(false);
        mMiniKeyboardPopup.setContentView(container);
        mMiniKeyboardPopup.setWidth(container.getMeasuredWidth());
        mMiniKeyboardPopup.setHeight(container.getMeasuredHeight());
+0 −18
Original line number Diff line number Diff line
@@ -78,17 +78,6 @@ public class LatinKeyboardView extends LatinKeyboardBaseView {
        setKeyboardLocal(k);
    }

    private static boolean hasOneDigitAlternate(Key key) {
        final CharSequence alternates = key.popupCharacters;
        if (alternates == null)
            return false;
        final String altChars = alternates.toString();
        if (altChars.codePointCount(0, altChars.length()) != 1)
            return false;
        final int altCode = altChars.codePointAt(0);
        return altCode >= '0' && altCode <= '9';
    }

    @Override
    protected boolean onLongPress(Key key) {
        int primaryCode = key.codes[0];
@@ -104,13 +93,6 @@ public class LatinKeyboardView extends LatinKeyboardBaseView {
                    LatinKeyboardBaseView.NOT_A_TOUCH_COORDINATE,
                    LatinKeyboardBaseView.NOT_A_TOUCH_COORDINATE);
            return true;
        } else if (hasOneDigitAlternate(key)) {
            mKeyCodes[0] = primaryCode = key.popupCharacters.charAt(0);
            // when there is only one alternate character, send it as key action.
            getOnKeyboardActionListener().onKey(primaryCode, mKeyCodes,
                    LatinKeyboardBaseView.NOT_A_TOUCH_COORDINATE,
                    LatinKeyboardBaseView.NOT_A_TOUCH_COORDINATE);
            return true;
        } else {
            return super.onLongPress(key);
        }