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

Commit 46863709 authored by Jacky Kao's avatar Jacky Kao Committed by Android (Google) Code Review
Browse files

Merge "Improvement of IME Enter Action" into rvc-dev

parents 03b8a414 e09f66e7
Loading
Loading
Loading
Loading
+4 −11
Original line number Diff line number Diff line
@@ -559,14 +559,6 @@ public class AccessibilityNodeInfo implements Parcelable {
    public static final String ACTION_ARGUMENT_PRESS_AND_HOLD_DURATION_MILLIS_INT =
            "android.view.accessibility.action.ARGUMENT_PRESS_AND_HOLD_DURATION_MILLIS_INT";

    /**
     * Argument to represent the IME action Id to press the returning key on a node.
     * For use with R.id.accessibilityActionImeEnter
     * @hide
     */
    public static final String ACTION_ARGUMENT_IME_ACTION_ID_INT =
            "android.view.accessibility.action.ARGUMENT_IME_ACTION_ID_INT";

    // Focus types

    /**
@@ -4973,10 +4965,11 @@ public class AccessibilityNodeInfo implements Parcelable {
                new AccessibilityAction(R.id.accessibilityActionPressAndHold);

        /**
         * Action to send an ime action which is from
         * {@link android.view.inputmethod.EditorInfo#actionId}. This action would be
         * Action to send an ime actionId which is from
         * {@link android.view.inputmethod.EditorInfo#actionId}. This ime actionId sets by
         * {@link TextView#setImeActionLabel(CharSequence, int)}, or it would be
         * {@link android.view.inputmethod.EditorInfo#IME_ACTION_UNSPECIFIED} if no specific
         * actionId defined. A node should expose this action only for views that are currently
         * actionId has set. A node should expose this action only for views that are currently
         * with input focus and editable.
         */
        @NonNull public static final AccessibilityAction ACTION_IME_ENTER =
+2 −13
Original line number Diff line number Diff line
@@ -11763,13 +11763,8 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
            if (isTextEditable() && isFocused()) {
                CharSequence imeActionLabel = mContext.getResources().getString(
                        com.android.internal.R.string.keyboardview_keycode_enter);
                if (getImeActionId() != 0 && getImeActionLabel() != null) {
                if (getImeActionLabel() != null) {
                    imeActionLabel = getImeActionLabel();
                    final int imeActionId = getImeActionId();
                    // put ime action id into the extra data with ACTION_ARGUMENT_IME_ACTION_ID_INT.
                    final Bundle argument = info.getExtras();
                    argument.putInt(AccessibilityNodeInfo.ACTION_ARGUMENT_IME_ACTION_ID_INT,
                            imeActionId);
                }
                AccessibilityNodeInfo.AccessibilityAction action =
                        new AccessibilityNodeInfo.AccessibilityAction(
@@ -12100,13 +12095,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
            } return true;
            case R.id.accessibilityActionImeEnter: {
                if (isFocused() && isTextEditable()) {
                    final int imeActionId = (arguments != null) ? arguments.getInt(
                            AccessibilityNodeInfo.ACTION_ARGUMENT_IME_ACTION_ID_INT,
                            EditorInfo.IME_ACTION_UNSPECIFIED)
                            : EditorInfo.IME_ACTION_UNSPECIFIED;
                    if (imeActionId == getImeActionId()) {
                        onEditorAction(imeActionId);
                    }
                    onEditorAction(getImeActionId());
                }
            } return true;
            default: {