List of usage examples for android.view.accessibility AccessibilityNodeInfo ACTION_SET_TEXT
int ACTION_SET_TEXT
To view the source code for android.view.accessibility AccessibilityNodeInfo ACTION_SET_TEXT.
Click Source Link
From source file:com.fenlisproject.elf.core.widget.ExtendedEditText.java
@Override public boolean performAccessibilityAction(int action, Bundle arguments) { switch (action) { case AccessibilityNodeInfo.ACTION_SET_TEXT: { CharSequence text = (arguments != null) ? arguments.getCharSequence(AccessibilityNodeInfo.ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE) : null;// w ww .j a v a 2 s .co m setText(text); if (text != null && text.length() > 0) { setSelection(text.length()); } return true; } default: { return super.performAccessibilityAction(action, arguments); } } }
From source file:com.ucmap.dingdinghelper.services.DingDingHelperAccessibilityService.java
/** * /* w ww.j a va 2 s.c om*/ */ private void setTextToView(AccessibilityNodeInfo node, String text) { Bundle arguments = new Bundle(); arguments.putInt(AccessibilityNodeInfo.ACTION_ARGUMENT_MOVEMENT_GRANULARITY_INT, AccessibilityNodeInfo.MOVEMENT_GRANULARITY_WORD); arguments.putBoolean(AccessibilityNodeInfo.ACTION_ARGUMENT_EXTEND_SELECTION_BOOLEAN, true); node.performAction(AccessibilityNodeInfo.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY, arguments); /*?*/ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { Bundle args = new Bundle(); args.putCharSequence(AccessibilityNodeInfo.ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE, text); node.performAction(AccessibilityNodeInfo.ACTION_SET_TEXT, args); } else { ClipData data = ClipData.newPlainText("reply", text); ClipboardManager clipboardManager = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE); clipboardManager.setPrimaryClip(data); node.performAction(AccessibilityNodeInfo.ACTION_FOCUS); // ? node.performAction(AccessibilityNodeInfo.ACTION_PASTE); // } }