Example usage for android.view.accessibility AccessibilityWindowInfo isFocused

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

Introduction

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

Prototype

public boolean isFocused() 

Source Link

Document

Gets if this window has input 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;
    }//from   w  ww .j  av a2 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;
}