1 /* 2 * Copyright (C) 2013 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package android.support.v4.view.accessibility; 18 19 import android.view.accessibility.AccessibilityNodeInfo; 20 21 import java.util.List; 22 23 class AccessibilityNodeInfoCompatJellybeanMr2 { 24 25 public static void setViewIdResourceName(Object info, String viewId) { 26 ((AccessibilityNodeInfo) info).setViewIdResourceName(viewId); 27 } 28 29 public static String getViewIdResourceName(Object info) { 30 return ((AccessibilityNodeInfo) info).getViewIdResourceName(); 31 } 32 33 @SuppressWarnings("unchecked") 34 public static List<Object> findAccessibilityNodeInfosByViewId(Object info, String viewId) { 35 Object result = ((AccessibilityNodeInfo) info).findAccessibilityNodeInfosByViewId(viewId); 36 return (List<Object>) result; 37 } 38 39 public static void setTextSelection(Object info, int start, int end) { 40 ((AccessibilityNodeInfo) info).setTextSelection(start, end); 41 } 42 43 public static int getTextSelectionStart(Object info) { 44 return ((AccessibilityNodeInfo) info).getTextSelectionStart(); 45 } 46 47 public static int getTextSelectionEnd(Object info) { 48 return ((AccessibilityNodeInfo) info).getTextSelectionEnd(); 49 } 50 51 public static boolean isEditable(Object info) { 52 return ((AccessibilityNodeInfo) info).isEditable(); 53 } 54 55 public static void setEditable(Object info, boolean editable) { 56 ((AccessibilityNodeInfo) info).setEditable(editable); 57 } 58 59 public static boolean refresh(Object info) { 60 return ((AccessibilityNodeInfo) info).refresh(); 61 } 62 } 63