Example usage for android.view.accessibility AccessibilityWindowInfo isAccessibilityFocused

List of usage examples for android.view.accessibility AccessibilityWindowInfo isAccessibilityFocused

Introduction

In this page you can find the example usage for android.view.accessibility AccessibilityWindowInfo isAccessibilityFocused.

Prototype

public boolean isAccessibilityFocused() 

Source Link

Document

Gets if this window has accessibility focus.

Usage

From source file:com.android.utils.WindowManager.java

private static int getFocusedWindowIndex(List<AccessibilityWindowInfo> windows, int focusType) {
    if (windows == null) {
        return WRONG_INDEX;
    }//  w  w w  . ja va2 s  .c  o  m

    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;
}