1956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov/* 2956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov * Copyright (C) 2012 The Android Open Source Project 3956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov * 4956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov * Licensed under the Apache License, Version 2.0 (the "License"); 5956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov * you may not use this file except in compliance with the License. 6956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov * You may obtain a copy of the License at 7956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov * 8956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov * http://www.apache.org/licenses/LICENSE-2.0 9956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov * 10956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov * Unless required by applicable law or agreed to in writing, software 11956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov * distributed under the License is distributed on an "AS IS" BASIS, 12956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov * See the License for the specific language governing permissions and 14956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov * limitations under the License. 15956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov */ 16956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov 17956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganovpackage android.support.v4.view.accessibility; 18956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov 19956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganovimport android.os.Build; 20d16944cf0ad052b56562a56886fed92afbb9b09fSvetoslav Ganovimport android.os.Bundle; 21956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganovimport android.view.View; 22956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov 23956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganovimport java.util.ArrayList; 24956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganovimport java.util.List; 25956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov 26956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov/** 27956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov * Helper for accessing {@link android.view.accessibility.AccessibilityNodeProvider} 28956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov * introduced after API level 4 in a backwards compatible fashion. 29956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov */ 30956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganovpublic class AccessibilityNodeProviderCompat { 31956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov 32956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov interface AccessibilityNodeProviderImpl { 33956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov public Object newAccessibilityNodeProviderBridge(AccessibilityNodeProviderCompat compat); 34956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov } 35956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov 36956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov static class AccessibilityNodeProviderStubImpl implements AccessibilityNodeProviderImpl { 37956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov @Override 38956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov public Object newAccessibilityNodeProviderBridge(AccessibilityNodeProviderCompat compat) { 39956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov return null; 40956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov } 41956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov } 42956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov 43956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov static class AccessibilityNodeProviderJellyBeanImpl extends AccessibilityNodeProviderStubImpl { 44956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov @Override 45956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov public Object newAccessibilityNodeProviderBridge( 46956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov final AccessibilityNodeProviderCompat compat) { 47956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov return AccessibilityNodeProviderCompatJellyBean.newAccessibilityNodeProviderBridge( 48956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov new AccessibilityNodeProviderCompatJellyBean.AccessibilityNodeInfoBridge() { 49956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov @Override 50d16944cf0ad052b56562a56886fed92afbb9b09fSvetoslav Ganov public boolean performAction(int virtualViewId, int action, 51d16944cf0ad052b56562a56886fed92afbb9b09fSvetoslav Ganov Bundle arguments) { 52d16944cf0ad052b56562a56886fed92afbb9b09fSvetoslav Ganov return compat.performAction(virtualViewId, action, arguments); 53956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov } 54956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov 55956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov @Override 56956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov public List<Object> findAccessibilityNodeInfosByText( 57956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov String text, int virtualViewId) { 58956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov List<AccessibilityNodeInfoCompat> compatInfos = 59956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov compat.findAccessibilityNodeInfosByText(text, virtualViewId); 60956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov List<Object> infos = new ArrayList<Object>(); 61956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov final int infoCount = compatInfos.size(); 62956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov for (int i = 0; i < infoCount; i++) { 63956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov AccessibilityNodeInfoCompat infoCompat = compatInfos.get(i); 64956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov infos.add(infoCompat.getInfo()); 65956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov } 66956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov return infos; 67956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov } 68956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov 69956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov @Override 70956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov public Object createAccessibilityNodeInfo( 71956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov int virtualViewId) { 72b1d4cb28db8b08974b651665bf4d1a7926c17b9calanv final AccessibilityNodeInfoCompat compatInfo = compat 73b1d4cb28db8b08974b651665bf4d1a7926c17b9calanv .createAccessibilityNodeInfo(virtualViewId); 74b1d4cb28db8b08974b651665bf4d1a7926c17b9calanv if (compatInfo == null) { 75b1d4cb28db8b08974b651665bf4d1a7926c17b9calanv return null; 76b1d4cb28db8b08974b651665bf4d1a7926c17b9calanv } else { 77b1d4cb28db8b08974b651665bf4d1a7926c17b9calanv return compatInfo.getInfo(); 78b1d4cb28db8b08974b651665bf4d1a7926c17b9calanv } 79b1d4cb28db8b08974b651665bf4d1a7926c17b9calanv } 80956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov }); 81956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov } 82956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov } 83956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov 84b44045ec70f92d559fe6642e9bdb49ca37cb9f71Alan Viverette static class AccessibilityNodeProviderKitKatImpl extends AccessibilityNodeProviderStubImpl { 85b44045ec70f92d559fe6642e9bdb49ca37cb9f71Alan Viverette @Override 86b44045ec70f92d559fe6642e9bdb49ca37cb9f71Alan Viverette public Object newAccessibilityNodeProviderBridge( 87b44045ec70f92d559fe6642e9bdb49ca37cb9f71Alan Viverette final AccessibilityNodeProviderCompat compat) { 88b44045ec70f92d559fe6642e9bdb49ca37cb9f71Alan Viverette return AccessibilityNodeProviderCompatKitKat.newAccessibilityNodeProviderBridge( 89b44045ec70f92d559fe6642e9bdb49ca37cb9f71Alan Viverette new AccessibilityNodeProviderCompatKitKat.AccessibilityNodeInfoBridge() { 90b44045ec70f92d559fe6642e9bdb49ca37cb9f71Alan Viverette @Override 91b44045ec70f92d559fe6642e9bdb49ca37cb9f71Alan Viverette public boolean performAction( 92b44045ec70f92d559fe6642e9bdb49ca37cb9f71Alan Viverette int virtualViewId, int action, Bundle arguments) { 93b44045ec70f92d559fe6642e9bdb49ca37cb9f71Alan Viverette return compat.performAction(virtualViewId, action, arguments); 94b44045ec70f92d559fe6642e9bdb49ca37cb9f71Alan Viverette } 95b44045ec70f92d559fe6642e9bdb49ca37cb9f71Alan Viverette 96b44045ec70f92d559fe6642e9bdb49ca37cb9f71Alan Viverette @Override 97b44045ec70f92d559fe6642e9bdb49ca37cb9f71Alan Viverette public List<Object> findAccessibilityNodeInfosByText( 98b44045ec70f92d559fe6642e9bdb49ca37cb9f71Alan Viverette String text, int virtualViewId) { 99b44045ec70f92d559fe6642e9bdb49ca37cb9f71Alan Viverette List<AccessibilityNodeInfoCompat> compatInfos = 100b44045ec70f92d559fe6642e9bdb49ca37cb9f71Alan Viverette compat.findAccessibilityNodeInfosByText(text, virtualViewId); 101b44045ec70f92d559fe6642e9bdb49ca37cb9f71Alan Viverette List<Object> infos = new ArrayList<Object>(); 102b44045ec70f92d559fe6642e9bdb49ca37cb9f71Alan Viverette final int infoCount = compatInfos.size(); 103b44045ec70f92d559fe6642e9bdb49ca37cb9f71Alan Viverette for (int i = 0; i < infoCount; i++) { 104b44045ec70f92d559fe6642e9bdb49ca37cb9f71Alan Viverette AccessibilityNodeInfoCompat infoCompat = compatInfos.get(i); 105b44045ec70f92d559fe6642e9bdb49ca37cb9f71Alan Viverette infos.add(infoCompat.getInfo()); 106b44045ec70f92d559fe6642e9bdb49ca37cb9f71Alan Viverette } 107b44045ec70f92d559fe6642e9bdb49ca37cb9f71Alan Viverette return infos; 108b44045ec70f92d559fe6642e9bdb49ca37cb9f71Alan Viverette } 109b44045ec70f92d559fe6642e9bdb49ca37cb9f71Alan Viverette 110b44045ec70f92d559fe6642e9bdb49ca37cb9f71Alan Viverette @Override 111b44045ec70f92d559fe6642e9bdb49ca37cb9f71Alan Viverette public Object createAccessibilityNodeInfo(int virtualViewId) { 112b44045ec70f92d559fe6642e9bdb49ca37cb9f71Alan Viverette final AccessibilityNodeInfoCompat compatInfo = 113b44045ec70f92d559fe6642e9bdb49ca37cb9f71Alan Viverette compat.createAccessibilityNodeInfo(virtualViewId); 114b44045ec70f92d559fe6642e9bdb49ca37cb9f71Alan Viverette if (compatInfo == null) { 115b44045ec70f92d559fe6642e9bdb49ca37cb9f71Alan Viverette return null; 116b44045ec70f92d559fe6642e9bdb49ca37cb9f71Alan Viverette } else { 117b44045ec70f92d559fe6642e9bdb49ca37cb9f71Alan Viverette return compatInfo.getInfo(); 118b44045ec70f92d559fe6642e9bdb49ca37cb9f71Alan Viverette } 119b44045ec70f92d559fe6642e9bdb49ca37cb9f71Alan Viverette } 120b44045ec70f92d559fe6642e9bdb49ca37cb9f71Alan Viverette 121b44045ec70f92d559fe6642e9bdb49ca37cb9f71Alan Viverette @Override 122b44045ec70f92d559fe6642e9bdb49ca37cb9f71Alan Viverette public Object findFocus(int focus) { 123b44045ec70f92d559fe6642e9bdb49ca37cb9f71Alan Viverette final AccessibilityNodeInfoCompat compatInfo = compat.findFocus(focus); 124b44045ec70f92d559fe6642e9bdb49ca37cb9f71Alan Viverette if (compatInfo == null) { 125b44045ec70f92d559fe6642e9bdb49ca37cb9f71Alan Viverette return null; 126b44045ec70f92d559fe6642e9bdb49ca37cb9f71Alan Viverette } else { 127b44045ec70f92d559fe6642e9bdb49ca37cb9f71Alan Viverette return compatInfo.getInfo(); 128b44045ec70f92d559fe6642e9bdb49ca37cb9f71Alan Viverette } 129b44045ec70f92d559fe6642e9bdb49ca37cb9f71Alan Viverette } 130b44045ec70f92d559fe6642e9bdb49ca37cb9f71Alan Viverette }); 131b44045ec70f92d559fe6642e9bdb49ca37cb9f71Alan Viverette } 132b44045ec70f92d559fe6642e9bdb49ca37cb9f71Alan Viverette } 133b44045ec70f92d559fe6642e9bdb49ca37cb9f71Alan Viverette 134956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov private static final AccessibilityNodeProviderImpl IMPL; 135956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov 136956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov private final Object mProvider; 137956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov 138956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov static { 139b44045ec70f92d559fe6642e9bdb49ca37cb9f71Alan Viverette if (Build.VERSION.SDK_INT >= 19) { // KitKat 140b44045ec70f92d559fe6642e9bdb49ca37cb9f71Alan Viverette IMPL = new AccessibilityNodeProviderKitKatImpl(); 141b44045ec70f92d559fe6642e9bdb49ca37cb9f71Alan Viverette } else if (Build.VERSION.SDK_INT >= 16) { // JellyBean 142956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov IMPL = new AccessibilityNodeProviderJellyBeanImpl(); 143956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov } else { 144956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov IMPL = new AccessibilityNodeProviderStubImpl(); 145956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov } 146956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov } 147956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov 148956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov /** 149956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov * Creates a new instance. 150956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov */ 151956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov public AccessibilityNodeProviderCompat() { 152956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov mProvider = IMPL.newAccessibilityNodeProviderBridge(this); 153956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov } 154956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov 155956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov /** 156956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov * Creates a new instance wrapping an 157956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov * {@link android.view.accessibility.AccessibilityNodeProvider}. 158956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov * 159956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov * @param provider The provider. 160956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov */ 161956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov public AccessibilityNodeProviderCompat(Object provider) { 162956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov mProvider = provider; 163956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov } 164956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov 165956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov /** 166956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov * @return The wrapped {@link android.view.accessibility.AccessibilityNodeProvider}. 167956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov */ 168956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov public Object getProvider() { 169956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov return mProvider; 170956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov } 171956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov 172956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov /** 173956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov * Returns an {@link AccessibilityNodeInfoCompat} representing a virtual view, 174956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov * i.e. a descendant of the host View, with the given <code>virtualViewId</code> 175956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov * or the host View itself if <code>virtualViewId</code> equals to {@link View#NO_ID}. 176956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov * <p> 177956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov * A virtual descendant is an imaginary View that is reported as a part of the view 178956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov * hierarchy for accessibility purposes. This enables custom views that draw complex 179956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov * content to report them selves as a tree of virtual views, thus conveying their 180956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov * logical structure. 181956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov * </p> 182956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov * <p> 183956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov * The implementer is responsible for obtaining an accessibility node info from the 184956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov * pool of reusable instances and setting the desired properties of the node info 185956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov * before returning it. 186956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov * </p> 187956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov * 188956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov * @param virtualViewId A client defined virtual view id. 189956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov * @return A populated {@link AccessibilityNodeInfoCompat} for a virtual descendant 190956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov * or the host View. 191956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov * 192956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov * @see AccessibilityNodeInfoCompat 193956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov */ 194956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov public AccessibilityNodeInfoCompat createAccessibilityNodeInfo(int virtualViewId) { 195956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov return null; 196956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov } 197956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov 198956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov /** 199956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov * Performs an accessibility action on a virtual view, i.e. a descendant of the 200956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov * host View, with the given <code>virtualViewId</code> or the host View itself 201956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov * if <code>virtualViewId</code> equals to {@link View#NO_ID}. 202956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov * 203956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov * @param virtualViewId A client defined virtual view id. 204d16944cf0ad052b56562a56886fed92afbb9b09fSvetoslav Ganov * @param action The action to perform. 205d16944cf0ad052b56562a56886fed92afbb9b09fSvetoslav Ganov * @param arguments Optional arguments. 206956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov * @return True if the action was performed. 207956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov * 208956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov * @see #createAccessibilityNodeInfo(int) 209956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov * @see AccessibilityNodeInfoCompat 210956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov */ 211d16944cf0ad052b56562a56886fed92afbb9b09fSvetoslav Ganov public boolean performAction(int virtualViewId, int action, Bundle arguments) { 212956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov return false; 213956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov } 214956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov 215956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov /** 216956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov * Finds {@link AccessibilityNodeInfoCompat}s by text. The match is case insensitive 217956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov * containment. The search is relative to the virtual view, i.e. a descendant of the 218956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov * host View, with the given <code>virtualViewId</code> or the host View itself 219956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov * <code>virtualViewId</code> equals to {@link View#NO_ID}. 220956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov * 221956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov * @param virtualViewId A client defined virtual view id which defined 222956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov * the root of the tree in which to perform the search. 223956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov * @param text The searched text. 224956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov * @return A list of node info. 225956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov * 226956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov * @see #createAccessibilityNodeInfo(int) 227956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov * @see AccessibilityNodeInfoCompat 228956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov */ 229956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov public List<AccessibilityNodeInfoCompat> findAccessibilityNodeInfosByText(String text, 230956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov int virtualViewId) { 231956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov return null; 232956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov } 233b44045ec70f92d559fe6642e9bdb49ca37cb9f71Alan Viverette 234b44045ec70f92d559fe6642e9bdb49ca37cb9f71Alan Viverette /** 235b44045ec70f92d559fe6642e9bdb49ca37cb9f71Alan Viverette * Find the virtual view, i.e. a descendant of the host View, that has the 236b44045ec70f92d559fe6642e9bdb49ca37cb9f71Alan Viverette * specified focus type. 237b44045ec70f92d559fe6642e9bdb49ca37cb9f71Alan Viverette * 238b44045ec70f92d559fe6642e9bdb49ca37cb9f71Alan Viverette * @param focus The focus to find. One of 239b44045ec70f92d559fe6642e9bdb49ca37cb9f71Alan Viverette * {@link AccessibilityNodeInfoCompat#FOCUS_INPUT} or 240b44045ec70f92d559fe6642e9bdb49ca37cb9f71Alan Viverette * {@link AccessibilityNodeInfoCompat#FOCUS_ACCESSIBILITY}. 241b44045ec70f92d559fe6642e9bdb49ca37cb9f71Alan Viverette * @return The node info of the focused view or null. 242b44045ec70f92d559fe6642e9bdb49ca37cb9f71Alan Viverette * @see AccessibilityNodeInfoCompat#FOCUS_INPUT 243b44045ec70f92d559fe6642e9bdb49ca37cb9f71Alan Viverette * @see AccessibilityNodeInfoCompat#FOCUS_ACCESSIBILITY 244b44045ec70f92d559fe6642e9bdb49ca37cb9f71Alan Viverette */ 245b44045ec70f92d559fe6642e9bdb49ca37cb9f71Alan Viverette public AccessibilityNodeInfoCompat findFocus(int focus) { 246b44045ec70f92d559fe6642e9bdb49ca37cb9f71Alan Viverette return null; 247b44045ec70f92d559fe6642e9bdb49ca37cb9f71Alan Viverette } 248956b013dfda37760b0232ed6d448900a546d2903Svetoslav Ganov} 249