Merge "Improvement of IME Enter Action" into rvc-dev am: 4686370935 am: 996f92c62f
Change-Id: I0859fd5bb5b183bb9753e1ce5cfe706dccb4fe7a
This commit is contained in:
@@ -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 =
|
||||
|
||||
@@ -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: {
|
||||
|
||||
Reference in New Issue
Block a user