Example usage for android.view.accessibility AccessibilityNodeInfo ACTION_ARGUMENT_SELECTION_END_INT

List of usage examples for android.view.accessibility AccessibilityNodeInfo ACTION_ARGUMENT_SELECTION_END_INT

Introduction

In this page you can find the example usage for android.view.accessibility AccessibilityNodeInfo ACTION_ARGUMENT_SELECTION_END_INT.

Prototype

String ACTION_ARGUMENT_SELECTION_END_INT

To view the source code for android.view.accessibility AccessibilityNodeInfo ACTION_ARGUMENT_SELECTION_END_INT.

Click Source Link

Document

Argument for specifying the selection end.

Usage

From source file:com.google.android.marvin.screenspeak.ScreenSpeakService.java

public void resetFocusedNode(long delay) {
    final Handler handler = new Handler();
    handler.postDelayed(new Runnable() {
        @SuppressLint("InlinedApi")
        @Override//from   www  .  jav a  2  s.co  m
        public void run() {
            AccessibilityNodeInfoCompat node = mSavedNode.getNode();
            if (node == null) {
                return;
            }

            AccessibilityNodeInfoCompat refreshed = AccessibilityNodeInfoUtils.refreshNode(node);

            if (refreshed != null) {
                if (!refreshed.isAccessibilityFocused()) {
                    mCursorController.setGranularity(mSavedNode.getGranularity(), refreshed, false);
                    SavedNode.Selection selection = mSavedNode.getSelection();
                    if (selection != null) {
                        Bundle args = new Bundle();
                        args.putInt(AccessibilityNodeInfo.ACTION_ARGUMENT_SELECTION_START_INT, selection.start);
                        args.putInt(AccessibilityNodeInfo.ACTION_ARGUMENT_SELECTION_END_INT, selection.end);
                        PerformActionUtils.performAction(refreshed,
                                AccessibilityNodeInfoCompat.ACTION_SET_SELECTION, args);
                    }

                    PerformActionUtils.performAction(refreshed,
                            AccessibilityNodeInfoCompat.ACTION_ACCESSIBILITY_FOCUS);
                }

                refreshed.recycle();
            }

            mSavedNode.recycle();
        }
    }, delay);
}