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

Commit be18530a authored by Yohei Yukawa's avatar Yohei Yukawa Committed by Android (Google) Code Review
Browse files

Merge "Fix inconsistent behavior with the back-to-the-main-keyboard key"

parents 9c034480 576f8a5b
Loading
Loading
Loading
Loading
+8 −12
Original line number Diff line number Diff line
@@ -487,24 +487,20 @@ public final class EmojiPalettesView extends LinearLayout implements OnTabChange
        deleteKey.setTag(Constants.CODE_DELETE);
        deleteKey.setOnTouchListener(mDeleteKeyOnTouchListener);

        // alphabetKey depends only on OnTouchListener as it does everything in key-press in
        // ACTION_DOWN.
        // alphabetKey, alphabetKey2, and spaceKey depend on {@link View.OnClickListener} as well as
        // {@link View.OnTouchListener}. {@link View.OnTouchListener} is used as the trigger of
        // key-press, while {@link View.OnClickListener} is used as the trigger of key-release which
        // does not occur if the event is canceled by moving off the finger from the view.
        final ImageView alphabetKey = (ImageView)findViewById(R.id.emoji_keyboard_alphabet);
        alphabetKey.setBackgroundResource(mEmojiFunctionalKeyBackgroundId);
        alphabetKey.setTag(Constants.CODE_SWITCH_ALPHA_SYMBOL);
        alphabetKey.setTag(Constants.CODE_ALPHA_FROM_EMOJI);
        alphabetKey.setOnTouchListener(this);

        // alphabetKey2 depends only on OnTouchListener as it does everything in key-press in
        // ACTION_DOWN.
        alphabetKey.setOnClickListener(this);
        final ImageView alphabetKey2 = (ImageView)findViewById(R.id.emoji_keyboard_alphabet2);
        alphabetKey2.setBackgroundResource(mEmojiFunctionalKeyBackgroundId);
        alphabetKey2.setTag(Constants.CODE_SWITCH_ALPHA_SYMBOL);
        alphabetKey2.setTag(Constants.CODE_ALPHA_FROM_EMOJI);
        alphabetKey2.setOnTouchListener(this);

        // spaceKey depends on {@link View.OnClickListener} as well as {@link View.OnTouchListener}.
        // {@link View.OnTouchListener} is used as the trigger of key-press while
        // {@link View.OnClickListener} is used as the trigger of key-release which may not occur
        // if the event is canceled by moving off the finger from the view.
        alphabetKey2.setOnClickListener(this);
        final ImageView spaceKey = (ImageView)findViewById(R.id.emoji_keyboard_space);
        spaceKey.setBackgroundResource(mKeyBackgroundId);
        spaceKey.setTag(Constants.CODE_SPACE);
+3 −0
Original line number Diff line number Diff line
@@ -54,6 +54,7 @@ public final class KeyboardCodesSet {
        "key_shift_enter",
        "key_language_switch",
        "key_emoji",
        "key_alpha_from_emoji",
        "key_unspecified",
        "key_left_parenthesis",
        "key_right_parenthesis",
@@ -91,6 +92,7 @@ public final class KeyboardCodesSet {
        Constants.CODE_SHIFT_ENTER,
        Constants.CODE_LANGUAGE_SWITCH,
        Constants.CODE_EMOJI,
        Constants.CODE_ALPHA_FROM_EMOJI,
        Constants.CODE_UNSPECIFIED,
        CODE_LEFT_PARENTHESIS,
        CODE_RIGHT_PARENTHESIS,
@@ -119,6 +121,7 @@ public final class KeyboardCodesSet {
        DEFAULT[13],
        DEFAULT[14],
        DEFAULT[15],
        DEFAULT[16],
        CODE_RIGHT_PARENTHESIS,
        CODE_LEFT_PARENTHESIS,
        CODE_GREATER_THAN_SIGN,
+2 −0
Original line number Diff line number Diff line
@@ -645,6 +645,8 @@ public final class KeyboardState {
            updateAlphabetShiftState(autoCaps, RecapitalizeStatus.NOT_A_RECAPITALIZE_MODE);
        } else if (code == Constants.CODE_EMOJI) {
            setEmojiKeyboard();
        } else if (code == Constants.CODE_ALPHA_FROM_EMOJI) {
            setAlphabetKeyboard();
        }
    }

+3 −1
Original line number Diff line number Diff line
@@ -217,8 +217,9 @@ public final class Constants {
    public static final int CODE_EMOJI = -11;
    public static final int CODE_SHIFT_ENTER = -12;
    public static final int CODE_SYMBOL_SHIFT = -13;
    public static final int CODE_ALPHA_FROM_EMOJI = -14;
    // Code value representing the code is not specified.
    public static final int CODE_UNSPECIFIED = -14;
    public static final int CODE_UNSPECIFIED = -15;

    public static boolean isLetterCode(final int code) {
        return code >= CODE_SPACE;
@@ -241,6 +242,7 @@ public final class Constants {
        case CODE_UNSPECIFIED: return "unspec";
        case CODE_TAB: return "tab";
        case CODE_ENTER: return "enter";
        case CODE_ALPHA_FROM_EMOJI: return "alpha";
        default:
            if (code < CODE_SPACE) return String.format("'\\u%02x'", code);
            if (code < 0x100) return String.format("'%c'", code);
+4 −0
Original line number Diff line number Diff line
@@ -349,6 +349,10 @@ public final class InputLogic {
            didAutoCorrect = handleNonSpecialCharacter(settingsValues, Constants.CODE_ENTER,
                    x, y, spaceState, keyboardSwitcher, handler);
            break;
        case Constants.CODE_ALPHA_FROM_EMOJI:
            // Note: Switching back from Emoji keyboard to the main keyboard is being handled in
            // {@link KeyboardState#onCodeInput(int,int)}.
            break;
        default:
            didAutoCorrect = handleNonSpecialCharacter(settingsValues,
                    code, x, y, spaceState, keyboardSwitcher, handler);