Java Code Examples for android.view.View#isRootNamespace()

The following examples show how to use android.view.View#isRootNamespace() . 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: ListView.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
View findViewInHeadersOrFooters(ArrayList<FixedViewInfo> where, int id) {
    // Look in the passed in list of headers or footers for the view.
    if (where != null) {
        int len = where.size();
        View v;

        for (int i = 0; i < len; i++) {
            v = where.get(i).view;

            if (!v.isRootNamespace()) {
                v = v.findViewById(id);

                if (v != null) {
                    return v;
                }
            }
        }
    }
    return null;
}
 
Example 2
Source File: ListView.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
View findViewWithTagInHeadersOrFooters(ArrayList<FixedViewInfo> where, Object tag) {
    // Look in the passed in list of headers or footers for the view with
    // the tag.
    if (where != null) {
        int len = where.size();
        View v;

        for (int i = 0; i < len; i++) {
            v = where.get(i).view;

            if (!v.isRootNamespace()) {
                v = v.findViewWithTag(tag);

                if (v != null) {
                    return v;
                }
            }
        }
    }
    return null;
}
 
Example 3
Source File: ListView.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
/**
 * Look in the passed in list of headers or footers for the first view that
 * matches the predicate.
 */
View findViewByPredicateInHeadersOrFooters(ArrayList<FixedViewInfo> where,
        Predicate<View> predicate, View childToSkip) {
    if (where != null) {
        int len = where.size();
        View v;

        for (int i = 0; i < len; i++) {
            v = where.get(i).view;

            if (v != childToSkip && !v.isRootNamespace()) {
                v = v.findViewByPredicate(predicate);

                if (v != null) {
                    return v;
                }
            }
        }
    }
    return null;
}
 
Example 4
Source File: RemoteViews.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
private void addViewChild(View v) {
    // ViewTree only contains Views which can be found using findViewById.
    // If isRootNamespace is true, this view is skipped.
    // @see ViewGroup#findViewTraversal(int)
    if (v.isRootNamespace()) {
        return;
    }
    final ViewTree target;

    // If the view has a valid id, i.e., if can be found using findViewById, add it to the
    // tree, otherwise skip this view and add its children instead.
    if (v.getId() != 0) {
        ViewTree tree = new ViewTree(v);
        mChildren.add(tree);
        target = tree;
    } else {
        target = this;
    }

    if (v instanceof ViewGroup) {
        if (target.mChildren == null) {
            target.mChildren = new ArrayList<>();
            ViewGroup vg = (ViewGroup) v;
            int count = vg.getChildCount();
            for (int i = 0; i < count; i++) {
                target.addViewChild(vg.getChildAt(i));
            }
        }
    }
}