Merge "Improvement of IME Enter Action" into rvc-dev
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 =
|
public static final String ACTION_ARGUMENT_PRESS_AND_HOLD_DURATION_MILLIS_INT =
|
||||||
"android.view.accessibility.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
|
// Focus types
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -4973,10 +4965,11 @@ public class AccessibilityNodeInfo implements Parcelable {
|
|||||||
new AccessibilityAction(R.id.accessibilityActionPressAndHold);
|
new AccessibilityAction(R.id.accessibilityActionPressAndHold);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Action to send an ime action which is from
|
* Action to send an ime actionId which is from
|
||||||
* {@link android.view.inputmethod.EditorInfo#actionId}. This action would be
|
* {@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
|
* {@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.
|
* with input focus and editable.
|
||||||
*/
|
*/
|
||||||
@NonNull public static final AccessibilityAction ACTION_IME_ENTER =
|
@NonNull public static final AccessibilityAction ACTION_IME_ENTER =
|
||||||
|
|||||||
@@ -11763,13 +11763,8 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
|
|||||||
if (isTextEditable() && isFocused()) {
|
if (isTextEditable() && isFocused()) {
|
||||||
CharSequence imeActionLabel = mContext.getResources().getString(
|
CharSequence imeActionLabel = mContext.getResources().getString(
|
||||||
com.android.internal.R.string.keyboardview_keycode_enter);
|
com.android.internal.R.string.keyboardview_keycode_enter);
|
||||||
if (getImeActionId() != 0 && getImeActionLabel() != null) {
|
if (getImeActionLabel() != null) {
|
||||||
imeActionLabel = getImeActionLabel();
|
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 =
|
AccessibilityNodeInfo.AccessibilityAction action =
|
||||||
new AccessibilityNodeInfo.AccessibilityAction(
|
new AccessibilityNodeInfo.AccessibilityAction(
|
||||||
@@ -12100,13 +12095,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
|
|||||||
} return true;
|
} return true;
|
||||||
case R.id.accessibilityActionImeEnter: {
|
case R.id.accessibilityActionImeEnter: {
|
||||||
if (isFocused() && isTextEditable()) {
|
if (isFocused() && isTextEditable()) {
|
||||||
final int imeActionId = (arguments != null) ? arguments.getInt(
|
onEditorAction(getImeActionId());
|
||||||
AccessibilityNodeInfo.ACTION_ARGUMENT_IME_ACTION_ID_INT,
|
|
||||||
EditorInfo.IME_ACTION_UNSPECIFIED)
|
|
||||||
: EditorInfo.IME_ACTION_UNSPECIFIED;
|
|
||||||
if (imeActionId == getImeActionId()) {
|
|
||||||
onEditorAction(imeActionId);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} return true;
|
} return true;
|
||||||
default: {
|
default: {
|
||||||
|
|||||||
Reference in New Issue
Block a user