List of usage examples for android.view.accessibility AccessibilityNodeInfo ACTION_ARGUMENT_MOVEMENT_GRANULARITY_INT
String ACTION_ARGUMENT_MOVEMENT_GRANULARITY_INT
To view the source code for android.view.accessibility AccessibilityNodeInfo ACTION_ARGUMENT_MOVEMENT_GRANULARITY_INT.
Click Source Link
From source file:org.chromium.content.browser.accessibility.JellyBeanAccessibilityInjector.java
/** * Packs an accessibility action into a JSON object and sends it to AndroidVox. * * @param action The action identifier.//from w ww. jav a 2s. c o m * @param arguments The action arguments, if applicable. * @return The result of the action. */ private boolean sendActionToAndroidVox(int action, Bundle arguments) { if (mCallback == null) return false; if (mAccessibilityJSONObject == null) { mAccessibilityJSONObject = new JSONObject(); } else { // Remove all keys from the object. final Iterator<?> keys = mAccessibilityJSONObject.keys(); while (keys.hasNext()) { keys.next(); keys.remove(); } } try { mAccessibilityJSONObject.accumulate("action", action); if (arguments != null) { if (action == AccessibilityNodeInfo.ACTION_NEXT_AT_MOVEMENT_GRANULARITY || action == AccessibilityNodeInfo.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY) { final int granularity = arguments .getInt(AccessibilityNodeInfo.ACTION_ARGUMENT_MOVEMENT_GRANULARITY_INT); mAccessibilityJSONObject.accumulate("granularity", granularity); } else if (action == AccessibilityNodeInfo.ACTION_NEXT_HTML_ELEMENT || action == AccessibilityNodeInfo.ACTION_PREVIOUS_HTML_ELEMENT) { final String element = arguments .getString(AccessibilityNodeInfo.ACTION_ARGUMENT_HTML_ELEMENT_STRING); mAccessibilityJSONObject.accumulate("element", element); } } } catch (JSONException ex) { return false; } final String jsonString = mAccessibilityJSONObject.toString(); final String jsCode = String.format(ACCESSIBILITY_ANDROIDVOX_TEMPLATE, jsonString); return mCallback.performAction(mContentViewCore, jsCode); }
From source file:android.webkit.AccessibilityInjector.java
/** * Packs an accessibility action into a JSON object and sends it to AndroidVox. * * @param action The action identifier.//from w w w .ja v a2 s .c om * @param arguments The action arguments, if applicable. * @return The result of the action. */ private boolean sendActionToAndroidVox(int action, Bundle arguments) { if (mAccessibilityJSONObject == null) { mAccessibilityJSONObject = new JSONObject(); } else { // Remove all keys from the object. final Iterator<?> keys = mAccessibilityJSONObject.keys(); while (keys.hasNext()) { keys.next(); keys.remove(); } } try { mAccessibilityJSONObject.accumulate("action", action); switch (action) { case AccessibilityNodeInfo.ACTION_NEXT_AT_MOVEMENT_GRANULARITY: case AccessibilityNodeInfo.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY: if (arguments != null) { final int granularity = arguments .getInt(AccessibilityNodeInfo.ACTION_ARGUMENT_MOVEMENT_GRANULARITY_INT); mAccessibilityJSONObject.accumulate("granularity", granularity); } break; case AccessibilityNodeInfo.ACTION_NEXT_HTML_ELEMENT: case AccessibilityNodeInfo.ACTION_PREVIOUS_HTML_ELEMENT: if (arguments != null) { final String element = arguments .getString(AccessibilityNodeInfo.ACTION_ARGUMENT_HTML_ELEMENT_STRING); mAccessibilityJSONObject.accumulate("element", element); } break; } } catch (JSONException e) { return false; } final String jsonString = mAccessibilityJSONObject.toString(); final String jsCode = String.format(ACCESSIBILITY_ANDROIDVOX_TEMPLATE, jsonString); return mCallback.performAction(mWebView, jsCode); }
From source file:com.ucmap.dingdinghelper.services.DingDingHelperAccessibilityService.java
/** * /* w w w. j ava2s . 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); // } }