Java Code Examples for android.app.assist.AssistStructure#getWindowNodeCount()

The following examples show how to use android.app.assist.AssistStructure#getWindowNodeCount() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ClientParser.java    From input-samples with Apache License 2.0 5 votes vote down vote up
/**
 * Traverses through the {@link AssistStructure} and does something at each {@link ViewNode}.
 *
 * @param processor contains action to be performed on each {@link ViewNode}.
 */
public void parse(NodeProcessor processor) {
    for (AssistStructure structure : mStructures) {
        int nodes = structure.getWindowNodeCount();
        for (int i = 0; i < nodes; i++) {
            AssistStructure.ViewNode viewNode = structure.getWindowNodeAt(i).getRootViewNode();
            traverseRoot(viewNode, processor);
        }
    }
}
 
Example 2
Source File: MultiStepsService.java    From input-samples with Apache License 2.0 5 votes vote down vote up
@NonNull
private ArrayMap<String, AutofillId> getAutofillableFields(@NonNull AssistStructure structure) {
    ArrayMap<String, AutofillId> fields = new ArrayMap<>();
    int nodes = structure.getWindowNodeCount();
    for (int i = 0; i < nodes; i++) {
        ViewNode node = structure.getWindowNodeAt(i).getRootViewNode();
        addAutofillableFields(fields, node);
    }
    return fields;
}
 
Example 3
Source File: BasicService.java    From input-samples with Apache License 2.0 5 votes vote down vote up
/**
 * Parses the {@link AssistStructure} representing the activity being autofilled, and returns a
 * map of autofillable fields (represented by their autofill ids) mapped by the hint associate
 * with them.
 *
 * <p>An autofillable field is a {@link ViewNode} whose {@link #getHint(ViewNode)} metho
 */
@NonNull
private Map<String, AutofillId> getAutofillableFields(@NonNull AssistStructure structure) {
    Map<String, AutofillId> fields = new ArrayMap<>();
    int nodes = structure.getWindowNodeCount();
    for (int i = 0; i < nodes; i++) {
        ViewNode node = structure.getWindowNodeAt(i).getRootViewNode();
        addAutofillableFields(fields, node);
    }
    return fields;
}
 
Example 4
Source File: DebugService.java    From input-samples with Apache License 2.0 5 votes vote down vote up
/**
 * Parses the {@link AssistStructure} representing the activity being autofilled, and returns a
 * map of autofillable fields (represented by their autofill ids) mapped by the hint associate
 * with them.
 *
 * <p>An autofillable field is a {@link ViewNode} whose {@link #getHint(ViewNode)} metho
 */
@NonNull
private ArrayMap<String, AutofillId> getAutofillableFields(@NonNull AssistStructure structure) {
    ArrayMap<String, AutofillId> fields = new ArrayMap<>();
    int nodes = structure.getWindowNodeCount();
    for (int i = 0; i < nodes; i++) {
        ViewNode node = structure.getWindowNodeAt(i).getRootViewNode();
        addAutofillableFields(fields, node);
    }
    return fields;
}
 
Example 5
Source File: Util.java    From input-samples with Apache License 2.0 5 votes vote down vote up
public static void dumpStructure(AssistStructure structure) {
    if (logVerboseEnabled()) {
        int nodeCount = structure.getWindowNodeCount();
        logv("dumpStructure(): component=%s numberNodes=%d",
                structure.getActivityComponent(), nodeCount);
        for (int i = 0; i < nodeCount; i++) {
            logv("node #%d", i);
            WindowNode node = structure.getWindowNodeAt(i);
            dumpNode(new StringBuilder(), "  ", node.getRootViewNode(), 0);
        }
    }
}
 
Example 6
Source File: Util.java    From input-samples with Apache License 2.0 5 votes vote down vote up
/**
 * Gets a node if it matches the filter criteria for the given id.
 */
public static ViewNode findNodeByFilter(@NonNull AssistStructure structure, @NonNull Object id,
        @NonNull NodeFilter filter) {
    logv("Parsing request for activity %s", structure.getActivityComponent());
    final int nodes = structure.getWindowNodeCount();
    for (int i = 0; i < nodes; i++) {
        final WindowNode windowNode = structure.getWindowNodeAt(i);
        final ViewNode rootNode = windowNode.getRootViewNode();
        final ViewNode node = findNodeByFilter(rootNode, id, filter);
        if (node != null) {
            return node;
        }
    }
    return null;
}
 
Example 7
Source File: Util.java    From input-samples with Apache License 2.0 5 votes vote down vote up
public static void dumpStructure(AssistStructure structure) {
    int nodeCount = structure.getWindowNodeCount();
    Log.v(TAG, "dumpStructure(): component=" + structure.getActivityComponent()
            + " numberNodes=" + nodeCount);
    for (int i = 0; i < nodeCount; i++) {
        Log.v(TAG, "node #" + i);
        WindowNode node = structure.getWindowNodeAt(i);
        dumpNode("  ", node.getRootViewNode());
    }
}
 
Example 8
Source File: ClientParser.java    From android-AutofillFramework with Apache License 2.0 5 votes vote down vote up
/**
 * Traverses through the {@link AssistStructure} and does something at each {@link ViewNode}.
 *
 * @param processor contains action to be performed on each {@link ViewNode}.
 */
public void parse(NodeProcessor processor) {
    for (AssistStructure structure : mStructures) {
        int nodes = structure.getWindowNodeCount();
        for (int i = 0; i < nodes; i++) {
            AssistStructure.ViewNode viewNode = structure.getWindowNodeAt(i).getRootViewNode();
            traverseRoot(viewNode, processor);
        }
    }
}
 
Example 9
Source File: MultiStepsService.java    From android-AutofillFramework with Apache License 2.0 5 votes vote down vote up
@NonNull
private ArrayMap<String, AutofillId> getAutofillableFields(@NonNull AssistStructure structure) {
    ArrayMap<String, AutofillId> fields = new ArrayMap<>();
    int nodes = structure.getWindowNodeCount();
    for (int i = 0; i < nodes; i++) {
        ViewNode node = structure.getWindowNodeAt(i).getRootViewNode();
        addAutofillableFields(fields, node);
    }
    return fields;
}
 
Example 10
Source File: BasicService.java    From android-AutofillFramework with Apache License 2.0 5 votes vote down vote up
/**
 * Parses the {@link AssistStructure} representing the activity being autofilled, and returns a
 * map of autofillable fields (represented by their autofill ids) mapped by the hint associate
 * with them.
 *
 * <p>An autofillable field is a {@link ViewNode} whose {@link #getHint(ViewNode)} metho
 */
@NonNull
private Map<String, AutofillId> getAutofillableFields(@NonNull AssistStructure structure) {
    Map<String, AutofillId> fields = new ArrayMap<>();
    int nodes = structure.getWindowNodeCount();
    for (int i = 0; i < nodes; i++) {
        ViewNode node = structure.getWindowNodeAt(i).getRootViewNode();
        addAutofillableFields(fields, node);
    }
    return fields;
}
 
Example 11
Source File: DebugService.java    From android-AutofillFramework with Apache License 2.0 5 votes vote down vote up
/**
 * Parses the {@link AssistStructure} representing the activity being autofilled, and returns a
 * map of autofillable fields (represented by their autofill ids) mapped by the hint associate
 * with them.
 *
 * <p>An autofillable field is a {@link ViewNode} whose {@link #getHint(ViewNode)} metho
 */
@NonNull
private ArrayMap<String, AutofillId> getAutofillableFields(@NonNull AssistStructure structure) {
    ArrayMap<String, AutofillId> fields = new ArrayMap<>();
    int nodes = structure.getWindowNodeCount();
    for (int i = 0; i < nodes; i++) {
        ViewNode node = structure.getWindowNodeAt(i).getRootViewNode();
        addAutofillableFields(fields, node);
    }
    return fields;
}
 
Example 12
Source File: Util.java    From android-AutofillFramework with Apache License 2.0 5 votes vote down vote up
public static void dumpStructure(AssistStructure structure) {
    if (logVerboseEnabled()) {
        int nodeCount = structure.getWindowNodeCount();
        logv("dumpStructure(): component=%s numberNodes=%d",
                structure.getActivityComponent(), nodeCount);
        for (int i = 0; i < nodeCount; i++) {
            logv("node #%d", i);
            WindowNode node = structure.getWindowNodeAt(i);
            dumpNode(new StringBuilder(), "  ", node.getRootViewNode(), 0);
        }
    }
}
 
Example 13
Source File: Util.java    From android-AutofillFramework with Apache License 2.0 5 votes vote down vote up
/**
 * Gets a node if it matches the filter criteria for the given id.
 */
public static ViewNode findNodeByFilter(@NonNull AssistStructure structure, @NonNull Object id,
        @NonNull NodeFilter filter) {
    logv("Parsing request for activity %s", structure.getActivityComponent());
    final int nodes = structure.getWindowNodeCount();
    for (int i = 0; i < nodes; i++) {
        final WindowNode windowNode = structure.getWindowNodeAt(i);
        final ViewNode rootNode = windowNode.getRootViewNode();
        final ViewNode node = findNodeByFilter(rootNode, id, filter);
        if (node != null) {
            return node;
        }
    }
    return null;
}
 
Example 14
Source File: Util.java    From android-AutofillFramework with Apache License 2.0 5 votes vote down vote up
public static void dumpStructure(AssistStructure structure) {
    int nodeCount = structure.getWindowNodeCount();
    Log.v(TAG, "dumpStructure(): component=" + structure.getActivityComponent()
            + " numberNodes=" + nodeCount);
    for (int i = 0; i < nodeCount; i++) {
        Log.v(TAG, "node #" + i);
        WindowNode node = structure.getWindowNodeAt(i);
        dumpNode("  ", node.getRootViewNode());
    }
}