本文整理汇总了Java中android.view.accessibility.AccessibilityWindowInfo类的典型用法代码示例。如果您正苦于以下问题:Java AccessibilityWindowInfo类的具体用法?Java AccessibilityWindowInfo怎么用?Java AccessibilityWindowInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AccessibilityWindowInfo类属于android.view.accessibility包,在下文中一共展示了AccessibilityWindowInfo类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: isLastWindow
import android.view.accessibility.AccessibilityWindowInfo; //导入依赖的package包/类
/**
* returns true if there is no window with windowType after baseWindow
*/
public boolean isLastWindow(AccessibilityWindowInfo baseWindow, int windowType) {
int index = getWindowIndex(baseWindow);
if (index == WRONG_INDEX) {
return true;
}
int count = mWindows.size();
for (int i = index + 1; i < count; i++) {
AccessibilityWindowInfo window = mWindows.get(i);
if (window != null && window.getType() == windowType) {
return false;
}
}
return true;
}
开发者ID:google,项目名称:talkback,代码行数:20,代码来源:WindowManager.java
示例2: isFirstWindow
import android.view.accessibility.AccessibilityWindowInfo; //导入依赖的package包/类
/**
* returns true if there is no window with windowType before baseWindow
*/
public boolean isFirstWindow(AccessibilityWindowInfo baseWindow, int windowType) {
int index = getWindowIndex(baseWindow);
if (index <= 0) {
return true;
}
for (int i = index - 1; i > 0; i--) {
AccessibilityWindowInfo window = mWindows.get(i);
if (window != null && window.getType() == windowType) {
return false;
}
}
return true;
}
开发者ID:google,项目名称:talkback,代码行数:19,代码来源:WindowManager.java
示例3: getCurrentWindow
import android.view.accessibility.AccessibilityWindowInfo; //导入依赖的package包/类
/**
* @return window that currently accessibilityFocused window.
* If there is no accessibility focused window it returns first window that has TYPE_APPLICATION
* or null if there is no window with TYPE_APPLICATION type
*/
public AccessibilityWindowInfo getCurrentWindow(boolean useInputFocus) {
int currentWindowIndex = getFocusedWindowIndex(mWindows,
AccessibilityNodeInfo.FOCUS_ACCESSIBILITY);
if (currentWindowIndex != WRONG_INDEX) {
return mWindows.get(currentWindowIndex);
}
if (!useInputFocus) {
return null;
}
currentWindowIndex = getFocusedWindowIndex(mWindows, AccessibilityNodeInfo.FOCUS_INPUT);
if (currentWindowIndex != WRONG_INDEX) {
return mWindows.get(currentWindowIndex);
}
return null;
}
开发者ID:google,项目名称:talkback,代码行数:24,代码来源:WindowManager.java
示例4: getAnchoredWindow
import android.view.accessibility.AccessibilityWindowInfo; //导入依赖的package包/类
/**
* Gets the window whose anchor equals the given node.
*/
public AccessibilityWindowInfo getAnchoredWindow(
@Nullable AccessibilityNodeInfoCompat targetAnchor) {
if (!BuildCompat.isAtLeastN() || targetAnchor == null) {
return null;
}
int windowCount = mWindows.size();
for (int i = 0; i < windowCount; ++i) {
AccessibilityWindowInfo window = mWindows.get(i);
if (window != null) {
AccessibilityNodeInfo anchor = window.getAnchor();
if (anchor != null) {
try {
if (anchor.equals(targetAnchor.getInfo())) {
return window;
}
} finally {
anchor.recycle();
}
}
}
}
return null;
}
开发者ID:google,项目名称:talkback,代码行数:29,代码来源:WindowManager.java
示例5: getWindow
import android.view.accessibility.AccessibilityWindowInfo; //导入依赖的package包/类
private AccessibilityWindowInfo getWindow(AccessibilityWindowInfo pivotWindow, int direction) {
if (mWindows == null || pivotWindow == null ||
(direction != NEXT && direction != PREVIOUS)) {
return null;
}
int currentWindowIndex = getWindowIndex(pivotWindow);
int resultIndex;
if (direction == NEXT) {
resultIndex = getNextWindowIndex(currentWindowIndex);
} else {
resultIndex = getPreviousWindowIndex(currentWindowIndex);
}
if (resultIndex == WRONG_INDEX) {
return null;
}
return mWindows.get(resultIndex);
}
开发者ID:google,项目名称:talkback,代码行数:21,代码来源:WindowManager.java
示例6: getFocusedWindowIndex
import android.view.accessibility.AccessibilityWindowInfo; //导入依赖的package包/类
private static int getFocusedWindowIndex(List<AccessibilityWindowInfo> windows, int focusType) {
if (windows == null) {
return WRONG_INDEX;
}
for (int i = 0, size = windows.size(); i < size; i++) {
AccessibilityWindowInfo window = windows.get(i);
if (window == null) {
continue;
}
if (focusType == AccessibilityNodeInfo.FOCUS_ACCESSIBILITY &&
window.isAccessibilityFocused()) {
return i;
} else if (focusType == AccessibilityNodeInfo.FOCUS_INPUT && window.isFocused()) {
return i;
}
}
return WRONG_INDEX;
}
开发者ID:google,项目名称:talkback,代码行数:22,代码来源:WindowManager.java
示例7: addWindowListToTree
import android.view.accessibility.AccessibilityWindowInfo; //导入依赖的package包/类
@Override
public OptionScanNode addWindowListToTree(List<SwitchAccessWindowInfo> windowList,
OptionScanNode tree) {
if (windowList != null) {
List<SwitchAccessWindowInfo> wList = new ArrayList<>(windowList);
sortWindowListForTraversalOrder(wList);
removeSystemButtonsWindowFromWindowList(wList);
if (mOptionScanningEnabled) {
return mOptionScanTreeBuilder.addWindowListToTree(wList, tree);
}
for (SwitchAccessWindowInfo window : wList) {
SwitchAccessNodeCompat windowRoot = window.getRoot();
if (windowRoot != null) {
if (window.getType() == AccessibilityWindowInfo.TYPE_INPUT_METHOD) {
tree = mRowColumnTreeBuilder.addViewHierarchyToTree(windowRoot, tree);
} else {
tree = addViewHierarchyToTree(windowRoot, tree);
}
windowRoot.recycle();
}
}
}
return tree;
}
开发者ID:google,项目名称:talkback,代码行数:25,代码来源:MainTreeBuilder.java
示例8: getWindowTitle
import android.view.accessibility.AccessibilityWindowInfo; //导入依赖的package包/类
private CharSequence getWindowTitle(int windowId) {
// Try to get window title from the map.
CharSequence windowTitle = mWindowTitlesMap.get(windowId);
if (windowTitle != null) {
return windowTitle;
}
if (!BuildCompat.isAtLeastN()) {
return null;
}
// Do not try to get system window title from AccessibilityWindowInfo.getTitle, it can
// return non-translated value.
if (isSystemWindow(windowId)) {
return null;
}
// Try to get window title from AccessibilityWindowInfo.
for (AccessibilityWindowInfo window : mService.getWindows()) {
if (window.getId() == windowId) {
return window.getTitle();
}
}
return null;
}
开发者ID:google,项目名称:talkback,代码行数:27,代码来源:ProcessorScreen.java
示例9: isSystemWindow
import android.view.accessibility.AccessibilityWindowInfo; //导入依赖的package包/类
private boolean isSystemWindow(int windowId) {
if (mSystemWindowIdsSet.contains(windowId)) {
return true;
}
if (!mIsSplitScreenModeAvailable) {
return false;
}
for (AccessibilityWindowInfo window : mService.getWindows()) {
if (window.getId() == windowId &&
window.getType() == AccessibilityWindowInfo.TYPE_SYSTEM) {
return true;
}
}
return false;
}
开发者ID:google,项目名称:talkback,代码行数:19,代码来源:ProcessorScreen.java
示例10: onMenuItemClick
import android.view.accessibility.AccessibilityWindowInfo; //导入依赖的package包/类
@Override
public boolean onMenuItemClick(MenuItem item) {
if (mAnchor != null) {
WindowManager windowManager = new WindowManager(mService.isScreenLayoutRTL());
windowManager.setWindows(mService.getWindows());
AccessibilityWindowInfo anchoredWindow = windowManager.getAnchoredWindow(mAnchor);
if (anchoredWindow != null) {
AccessibilityNodeInfoCompat firstNode = getFirstNode(anchoredWindow);
if (firstNode != null) {
CursorController cursorController = mService.getCursorController();
cursorController.setCursor(firstNode);
firstNode.recycle();
}
}
mAnchor.recycle();
mAnchor = null;
}
return true;
}
开发者ID:google,项目名称:talkback,代码行数:21,代码来源:RuleSuggestions.java
示例11: getFirstNode
import android.view.accessibility.AccessibilityWindowInfo; //导入依赖的package包/类
private AccessibilityNodeInfoCompat getFirstNode(AccessibilityWindowInfo window) {
AccessibilityNodeInfo root = window.getRoot();
if (root != null) {
AccessibilityNodeInfoCompat compatRoot = new AccessibilityNodeInfoCompat(root);
TraversalStrategy traversalStrategy = TraversalStrategyUtils.getTraversalStrategy(
compatRoot, TraversalStrategy.SEARCH_FOCUS_FORWARD);
AccessibilityNodeInfoCompat firstNode = AccessibilityNodeInfoUtils.searchFocus(
traversalStrategy,
compatRoot,
TraversalStrategy.SEARCH_FOCUS_FORWARD,
AccessibilityNodeInfoUtils.FILTER_SHOULD_FOCUS);
compatRoot.recycle(); // This will also recycle the underlying node (root).
return firstNode;
}
return null;
}
开发者ID:google,项目名称:talkback,代码行数:20,代码来源:RuleSuggestions.java
示例12: getRootInAccessibilityFocusedWindow
import android.view.accessibility.AccessibilityWindowInfo; //导入依赖的package包/类
/**
* @return root node of the window that currently has accessibility focus
*/
public static AccessibilityNodeInfoCompat getRootInAccessibilityFocusedWindow(
AccessibilityService service) {
if (service == null) {
return null;
}
AccessibilityNodeInfo focusedRoot = null;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) {
List<AccessibilityWindowInfo> windows = service.getWindows();
// Create window manager with fake value of isInRTL = false. This is okay here since
// isInRTL will not change the result of getCurrentWindow.
WindowManager manager = new WindowManager(false /* isInRTL */);
manager.setWindows(windows);
AccessibilityWindowInfo accessibilityFocusedWindow =
manager.getCurrentWindow(false /* useInputFocus */);
if (accessibilityFocusedWindow != null) {
focusedRoot = accessibilityFocusedWindow.getRoot();
}
}
if (focusedRoot == null) {
focusedRoot = service.getRootInActiveWindow();
}
if (focusedRoot == null) {
return null;
}
return new AccessibilityNodeInfoCompat(focusedRoot);
}
开发者ID:google,项目名称:talkback,代码行数:35,代码来源:AccessibilityServiceCompatUtils.java
示例13: refreshNodeFuzzy
import android.view.accessibility.AccessibilityWindowInfo; //导入依赖的package包/类
/**
* Returns a fresh copy of node by traversing the given window for a similar node.
* For example, the node that you want might be in a popup window that has closed and re-opened,
* causing the accessibility IDs of its views to be different.
* Note: you must recycle the node that is returned from this method.
*/
public static AccessibilityNodeInfoCompat refreshNodeFuzzy(
final AccessibilityNodeInfoCompat node,
AccessibilityWindowInfo window) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
return null;
}
if (window == null || node == null) {
return null;
}
AccessibilityNodeInfo root = window.getRoot();
if (root == null) {
return null;
}
NodeFilter similarFilter = new NodeFilter() {
@Override
public boolean accept(AccessibilityNodeInfoCompat other) {
return other != null && TextUtils.equals(node.getText(), other.getText());
}
};
AccessibilityNodeInfoCompat rootCompat = new AccessibilityNodeInfoCompat(root);
try {
return getMatchingDescendant(rootCompat, similarFilter);
} finally {
rootCompat.recycle();
}
}
开发者ID:google,项目名称:talkback,代码行数:37,代码来源:AccessibilityNodeInfoUtils.java
示例14: getAnchor
import android.view.accessibility.AccessibilityWindowInfo; //导入依赖的package包/类
/**
* Returns the node to which the given node's window is anchored, if there is an anchor.
* Note: you must recycle the node that is returned from this method.
*/
public static AccessibilityNodeInfoCompat getAnchor(
@Nullable AccessibilityNodeInfoCompat node) {
if (!BuildCompat.isAtLeastN()) {
return null;
}
if (node == null) {
return null;
}
AccessibilityNodeInfo nativeNode = (AccessibilityNodeInfo) node.getInfo();
if (nativeNode == null) {
return null;
}
AccessibilityWindowInfo nativeWindow = nativeNode.getWindow();
if (nativeWindow == null) {
return null;
}
AccessibilityNodeInfo nativeAnchor = nativeWindow.getAnchor();
if (nativeAnchor == null) {
return null;
}
return new AccessibilityNodeInfoCompat(nativeAnchor);
}
开发者ID:google,项目名称:talkback,代码行数:32,代码来源:AccessibilityNodeInfoUtils.java
示例15: compare
import android.view.accessibility.AccessibilityWindowInfo; //导入依赖的package包/类
@Override
public int compare(AccessibilityWindowInfo windowA, AccessibilityWindowInfo windowB) {
windowA.getBoundsInScreen(mRectA);
windowB.getBoundsInScreen(mRectB);
if (mRectA.top != mRectB.top) {
return mRectA.top - mRectB.top;
} else {
return mIsInRTL ? mRectB.right - mRectA.right : mRectA.left - mRectB.left;
}
}
开发者ID:google,项目名称:talkback,代码行数:12,代码来源:WindowManager.java
示例16: setWindows
import android.view.accessibility.AccessibilityWindowInfo; //导入依赖的package包/类
/**
* Set windows that would be used by WindowManager
* @param windows Set the windows on the screen.
*/
public void setWindows(List<AccessibilityWindowInfo> windows) {
// Copy list not to sort the original one.
mWindows.clear();
mWindows.addAll(windows);
Collections.sort(mWindows, new WindowPositionComparator(mIsInRTL));
}
开发者ID:google,项目名称:talkback,代码行数:12,代码来源:WindowManager.java
示例17: isInputWindowOnScreen
import android.view.accessibility.AccessibilityWindowInfo; //导入依赖的package包/类
public boolean isInputWindowOnScreen() {
if (mWindows == null) {
return false;
}
for (AccessibilityWindowInfo window : mWindows) {
if (window != null && window.getType() == AccessibilityWindowInfo.TYPE_INPUT_METHOD) {
return true;
}
}
return false;
}
开发者ID:google,项目名称:talkback,代码行数:14,代码来源:WindowManager.java
示例18: getWindowType
import android.view.accessibility.AccessibilityWindowInfo; //导入依赖的package包/类
public int getWindowType(int windowId) {
if (mWindows != null) {
for (AccessibilityWindowInfo window : mWindows) {
if (window != null && window.getId() == windowId) {
return window.getType();
}
}
}
return WRONG_WINDOW_TYPE;
}
开发者ID:google,项目名称:talkback,代码行数:12,代码来源:WindowManager.java
示例19: isStatusBar
import android.view.accessibility.AccessibilityWindowInfo; //导入依赖的package包/类
public boolean isStatusBar(int windowId) {
if (mWindows == null || mWindows.size() == 0) {
return false;
}
return mWindows.get(0).getId() == windowId &&
mWindows.get(0).getType() == AccessibilityWindowInfo.TYPE_SYSTEM;
}
开发者ID:google,项目名称:talkback,代码行数:9,代码来源:WindowManager.java
示例20: isNavigationBar
import android.view.accessibility.AccessibilityWindowInfo; //导入依赖的package包/类
public boolean isNavigationBar(int windowId) {
if (mWindows == null || mWindows.size() < 2) {
return false;
}
int lastIndex = mWindows.size() - 1;
return mWindows.get(lastIndex).getId() == windowId &&
mWindows.get(lastIndex).getType() == AccessibilityWindowInfo.TYPE_SYSTEM;
}
开发者ID:google,项目名称:talkback,代码行数:10,代码来源:WindowManager.java
注:本文中的android.view.accessibility.AccessibilityWindowInfo类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论