Java Code Examples for androidx.core.view.accessibility.AccessibilityNodeInfoCompat#ACTION_CUT

The following examples show how to use androidx.core.view.accessibility.AccessibilityNodeInfoCompat#ACTION_CUT . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SwitchAccessAction.java    From talkback with Apache License 2.0 5 votes vote down vote up
@Override
@Nullable
// LINT.IfChange(generateInverseAction)
public TimelineAction generateInverseAction() {
  Bundle args = new Bundle();
  switch (getId()) {
    case AccessibilityNodeInfoCompat.ACTION_NEXT_AT_MOVEMENT_GRANULARITY:
    case AccessibilityNodeInfoCompat.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY:
    case AccessibilityNodeInfoCompat.ACTION_SET_SELECTION:
      // If previousSelectionStart == -1 or previousSelectionEnd == -1, performing this action
      // does nothing.
      args.putInt(
          AccessibilityNodeInfo.ACTION_ARGUMENT_SELECTION_START_INT, previousSelectionStart);
      args.putInt(AccessibilityNodeInfo.ACTION_ARGUMENT_SELECTION_END_INT, previousSelectionEnd);
      return new SwitchAccessAction(
          nodeCompat, AccessibilityActionCompat.ACTION_SET_SELECTION, args);
    case AccessibilityNodeInfoCompat.ACTION_CUT:
    case AccessibilityNodeInfoCompat.ACTION_PASTE:
    case TextEditingUtils.ACTION_DELETE_TEXT:
      args.putInt(
          AccessibilityNodeInfo.ACTION_ARGUMENT_SELECTION_START_INT, previousSelectionStart);
      args.putInt(AccessibilityNodeInfo.ACTION_ARGUMENT_SELECTION_END_INT, previousSelectionEnd);
      args.putCharSequence(
          AccessibilityNodeInfo.ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE, previousTextContent);
      return new SwitchAccessAction(nodeCompat, AccessibilityActionCompat.ACTION_SET_TEXT, args);
    default:
      // Action is not undoable.
      return null;
  }
}
 
Example 2
Source File: NodeActionMenuItem.java    From talkback with Apache License 2.0 5 votes vote down vote up
private static SwitchAccessMenuItemEnum.MenuItem getMenuItemForAction(SwitchAccessAction action) {
  switch (action.getId()) {
    case AccessibilityNodeInfoCompat.ACTION_CLICK:
      return SwitchAccessMenuItemEnum.MenuItem.ACTION_MENU_CLICK;
    case AccessibilityNodeInfoCompat.ACTION_LONG_CLICK:
      return SwitchAccessMenuItemEnum.MenuItem.ACTION_MENU_LONG_CLICK;
    case AccessibilityNodeInfoCompat.ACTION_SCROLL_FORWARD:
      return SwitchAccessMenuItemEnum.MenuItem.ACTION_MENU_SCROLL_FORWARD;
    case AccessibilityNodeInfoCompat.ACTION_SCROLL_BACKWARD:
      return SwitchAccessMenuItemEnum.MenuItem.ACTION_MENU_SCROLL_BACKWARD;
    case AccessibilityNodeInfoCompat.ACTION_DISMISS:
      return SwitchAccessMenuItemEnum.MenuItem.ACTION_MENU_DISMISS;
    case AccessibilityNodeInfoCompat.ACTION_COLLAPSE:
      return SwitchAccessMenuItemEnum.MenuItem.ACTION_MENU_COLLAPSE;
    case AccessibilityNodeInfoCompat.ACTION_EXPAND:
      return SwitchAccessMenuItemEnum.MenuItem.ACTION_MENU_EXPAND;
    case AccessibilityNodeInfoCompat.ACTION_SET_SELECTION:
      return getMenuItemForSetSelectionAction(action);
    case AccessibilityNodeInfoCompat.ACTION_CUT:
      return getMenuItemForCutAction(action);
    case AccessibilityNodeInfoCompat.ACTION_COPY:
      return getMenuItemForCopyAction(action);
    case AccessibilityNodeInfoCompat.ACTION_PASTE:
      return SwitchAccessMenuItemEnum.MenuItem.ACTION_MENU_PASTE;
    case TextEditingUtils.ACTION_DELETE_TEXT:
      return getMenuItemForDeleteTextAction(action);
    case AccessibilityNodeInfoCompat.ACTION_NEXT_AT_MOVEMENT_GRANULARITY:
      return getMenuItemForNextAtMovementGranularityAction(action);
    case AccessibilityNodeInfoCompat.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY:
      return getMenuItemForPreviousAtMovementGranularityAction(action);
    case TextEditingUtils.ACTION_UNDO:
      return SwitchAccessMenuItemEnum.MenuItem.ACTION_MENU_UNDO;
    case TextEditingUtils.ACTION_REDO:
      return SwitchAccessMenuItemEnum.MenuItem.ACTION_MENU_REDO;
    default:
      // Other actions such as "App info", "Add to home screen" etc.
      return SwitchAccessMenuItemEnum.MenuItem.ACTION_MENU_CUSTOM_ACTION;
  }
}
 
Example 3
Source File: AccessibilityNodeInfoUtils.java    From talkback with Apache License 2.0 4 votes vote down vote up
public static String actionToString(int action) {
  switch (action) {
    case AccessibilityNodeInfoCompat.ACTION_ACCESSIBILITY_FOCUS:
      return "ACTION_ACCESSIBILITY_FOCUS";
    case AccessibilityNodeInfoCompat.ACTION_CLEAR_ACCESSIBILITY_FOCUS:
      return "ACTION_CLEAR_ACCESSIBILITY_FOCUS";
    case AccessibilityNodeInfoCompat.ACTION_CLEAR_FOCUS:
      return "ACTION_CLEAR_FOCUS";
    case AccessibilityNodeInfoCompat.ACTION_CLEAR_SELECTION:
      return "ACTION_CLEAR_SELECTION";
    case AccessibilityNodeInfoCompat.ACTION_CLICK:
      return "ACTION_CLICK";
    case AccessibilityNodeInfoCompat.ACTION_COLLAPSE:
      return "ACTION_COLLAPSE";
    case AccessibilityNodeInfoCompat.ACTION_COPY:
      return "ACTION_COPY";
    case AccessibilityNodeInfoCompat.ACTION_CUT:
      return "ACTION_CUT";
    case AccessibilityNodeInfoCompat.ACTION_DISMISS:
      return "ACTION_DISMISS";
    case AccessibilityNodeInfoCompat.ACTION_EXPAND:
      return "ACTION_EXPAND";
    case AccessibilityNodeInfoCompat.ACTION_FOCUS:
      return "ACTION_FOCUS";
    case AccessibilityNodeInfoCompat.ACTION_LONG_CLICK:
      return "ACTION_LONG_CLICK";
    case AccessibilityNodeInfoCompat.ACTION_NEXT_AT_MOVEMENT_GRANULARITY:
      return "ACTION_NEXT_AT_MOVEMENT_GRANULARITY";
    case AccessibilityNodeInfoCompat.ACTION_NEXT_HTML_ELEMENT:
      return "ACTION_NEXT_HTML_ELEMENT";
    case AccessibilityNodeInfoCompat.ACTION_PASTE:
      return "ACTION_PASTE";
    case AccessibilityNodeInfoCompat.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY:
      return "ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY";
    case AccessibilityNodeInfoCompat.ACTION_PREVIOUS_HTML_ELEMENT:
      return "ACTION_PREVIOUS_HTML_ELEMENT";
    case AccessibilityNodeInfoCompat.ACTION_SCROLL_BACKWARD:
      return "ACTION_SCROLL_BACKWARD";
    case AccessibilityNodeInfoCompat.ACTION_SCROLL_FORWARD:
      return "ACTION_SCROLL_FORWARD";
    case AccessibilityNodeInfoCompat.ACTION_SELECT:
      return "ACTION_SELECT";
    case AccessibilityNodeInfoCompat.ACTION_SET_SELECTION:
      return "ACTION_SET_SELECTION";
    case AccessibilityNodeInfoCompat.ACTION_SET_TEXT:
      return "ACTION_SET_TEXT";
    default:
      return "(unhandled)";
  }
}
 
Example 4
Source File: NodeActionMenuItem.java    From talkback with Apache License 2.0 4 votes vote down vote up
/** Returns an icon resource id associated with the current action. */
@Override
public int getIconResource() {
  int actionId = action.getId();
  switch (actionId) {
    case AccessibilityNodeInfoCompat.ACTION_CLICK:
      return R.drawable.ic_select;
    case AccessibilityNodeInfoCompat.ACTION_LONG_CLICK:
      return R.drawable.ic_long_press;
    case AccessibilityNodeInfoCompat.ACTION_SCROLL_FORWARD:
      return R.drawable.ic_scroll_down;
    case AccessibilityNodeInfoCompat.ACTION_SCROLL_BACKWARD:
      return R.drawable.ic_scroll_up;
    case AccessibilityNodeInfoCompat.ACTION_DISMISS:
      return R.drawable.ic_dismiss;
    case AccessibilityNodeInfoCompat.ACTION_NEXT_AT_MOVEMENT_GRANULARITY:
    case AccessibilityNodeInfoCompat.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY:
      return R.drawable.ic_text;
    case AccessibilityNodeInfoCompat.ACTION_COLLAPSE:
      return R.drawable.ic_collapse;
    case AccessibilityNodeInfoCompat.ACTION_EXPAND:
      return R.drawable.ic_expand;
    case AccessibilityNodeInfoCompat.ACTION_SET_SELECTION:
      return R.drawable.ic_highlight_text;
    case AccessibilityNodeInfoCompat.ACTION_CUT:
      return R.drawable.ic_cut;
    case AccessibilityNodeInfoCompat.ACTION_COPY:
      return R.drawable.ic_copy;
    case AccessibilityNodeInfoCompat.ACTION_PASTE:
      return R.drawable.ic_paste;
    case TextEditingUtils.ACTION_DELETE_TEXT:
      return R.drawable.ic_delete_text;
    case TextEditingUtils.ACTION_UNDO:
      return R.drawable.ic_undo;
    case TextEditingUtils.ACTION_REDO:
      return R.drawable.ic_redo;
    default:
      // We don't know what the action is. Don't show an icon.
      return 0;
  }
}