Search in sources :

Example 11 with Component

use of carbon.recycler.Component in project Carbon by ZieIony.

the class Toolbar method findComponentsById.

public List<Component> findComponentsById(int id) {
    List<Component> result = new ArrayList<>();
    List<ViewGroup> groups = new ArrayList<>();
    groups.add(this);
    while (!groups.isEmpty()) {
        ViewGroup group = groups.remove(0);
        for (int i = 0; i < group.getChildCount(); i++) {
            View child = group.getChildAt(i);
            if (child instanceof ComponentView && ((ComponentView) child).getComponent().getView().getId() == id)
                result.add(((ComponentView) child).getComponent());
            if (child instanceof ViewGroup)
                groups.add((ViewGroup) child);
        }
    }
    return result;
}
Also used : ComponentView(carbon.component.ComponentView) ViewGroup(android.view.ViewGroup) ArrayList(java.util.ArrayList) Component(carbon.recycler.Component) ComponentView(carbon.component.ComponentView) View(android.view.View) RippleView(carbon.drawable.ripple.RippleView) ShadowView(carbon.shadow.ShadowView) AnimatedView(carbon.animation.AnimatedView) Paint(android.graphics.Paint)

Example 12 with Component

use of carbon.recycler.Component in project Carbon by ZieIony.

the class DrawerLayout method findComponentsById.

public List<Component> findComponentsById(int id) {
    List<Component> result = new ArrayList<>();
    List<ViewGroup> groups = new ArrayList<>();
    groups.add(this);
    while (!groups.isEmpty()) {
        ViewGroup group = groups.remove(0);
        for (int i = 0; i < group.getChildCount(); i++) {
            View child = group.getChildAt(i);
            if (child instanceof ComponentView && ((ComponentView) child).getComponent().getView().getId() == id)
                result.add(((ComponentView) child).getComponent());
            if (child instanceof ViewGroup)
                groups.add((ViewGroup) child);
        }
    }
    return result;
}
Also used : ComponentView(carbon.component.ComponentView) ViewGroup(android.view.ViewGroup) ArrayList(java.util.ArrayList) Component(carbon.recycler.Component) ComponentView(carbon.component.ComponentView) View(android.view.View) RippleView(carbon.drawable.ripple.RippleView) ShadowView(carbon.shadow.ShadowView) AnimatedView(carbon.animation.AnimatedView) Paint(android.graphics.Paint)

Example 13 with Component

use of carbon.recycler.Component in project Carbon by ZieIony.

the class FlowLayout method findComponentsById.

public List<Component> findComponentsById(int id) {
    List<Component> result = new ArrayList<>();
    List<ViewGroup> groups = new ArrayList<>();
    groups.add(this);
    while (!groups.isEmpty()) {
        ViewGroup group = groups.remove(0);
        for (int i = 0; i < group.getChildCount(); i++) {
            View child = group.getChildAt(i);
            if (child instanceof ComponentView && ((ComponentView) child).getComponent().getView().getId() == id)
                result.add(((ComponentView) child).getComponent());
            if (child instanceof ViewGroup)
                groups.add((ViewGroup) child);
        }
    }
    return result;
}
Also used : ComponentView(carbon.component.ComponentView) ViewGroup(android.view.ViewGroup) ArrayList(java.util.ArrayList) Component(carbon.recycler.Component) ComponentView(carbon.component.ComponentView) View(android.view.View) RippleView(carbon.drawable.ripple.RippleView) ShadowView(carbon.shadow.ShadowView) AnimatedView(carbon.animation.AnimatedView) Paint(android.graphics.Paint)

Example 14 with Component

use of carbon.recycler.Component in project Carbon by ZieIony.

the class ConstraintLayout method findComponentsOfType.

public List<Component> findComponentsOfType(Class type) {
    List<Component> result = new ArrayList<>();
    List<ViewGroup> groups = new ArrayList<>();
    groups.add(this);
    while (!groups.isEmpty()) {
        ViewGroup group = groups.remove(0);
        for (int i = 0; i < group.getChildCount(); i++) {
            View child = group.getChildAt(i);
            if (child instanceof ComponentView && ((ComponentView) child).getComponent().getClass().equals(type))
                result.add(((ComponentView) child).getComponent());
            if (child instanceof ViewGroup)
                groups.add((ViewGroup) child);
        }
    }
    return result;
}
Also used : ComponentView(carbon.component.ComponentView) ViewGroup(android.view.ViewGroup) ArrayList(java.util.ArrayList) Component(carbon.recycler.Component) ComponentView(carbon.component.ComponentView) View(android.view.View) RippleView(carbon.drawable.ripple.RippleView) ShadowView(carbon.shadow.ShadowView) AnimatedView(carbon.animation.AnimatedView) Paint(android.graphics.Paint)

Example 15 with Component

use of carbon.recycler.Component in project Carbon by ZieIony.

the class Toolbar method findComponentsOfType.

public List<Component> findComponentsOfType(Class type) {
    List<Component> result = new ArrayList<>();
    List<ViewGroup> groups = new ArrayList<>();
    groups.add(this);
    while (!groups.isEmpty()) {
        ViewGroup group = groups.remove(0);
        for (int i = 0; i < group.getChildCount(); i++) {
            View child = group.getChildAt(i);
            if (child instanceof ComponentView && ((ComponentView) child).getComponent().getClass().equals(type))
                result.add(((ComponentView) child).getComponent());
            if (child instanceof ViewGroup)
                groups.add((ViewGroup) child);
        }
    }
    return result;
}
Also used : ComponentView(carbon.component.ComponentView) ViewGroup(android.view.ViewGroup) ArrayList(java.util.ArrayList) Component(carbon.recycler.Component) ComponentView(carbon.component.ComponentView) View(android.view.View) RippleView(carbon.drawable.ripple.RippleView) ShadowView(carbon.shadow.ShadowView) AnimatedView(carbon.animation.AnimatedView) Paint(android.graphics.Paint)

Aggregations

View (android.view.View)23 Component (carbon.recycler.Component)23 Paint (android.graphics.Paint)22 ViewGroup (android.view.ViewGroup)22 AnimatedView (carbon.animation.AnimatedView)22 ComponentView (carbon.component.ComponentView)22 RippleView (carbon.drawable.ripple.RippleView)22 ShadowView (carbon.shadow.ShadowView)22 ArrayList (java.util.ArrayList)22 CornerView (carbon.widget.CornerView)6 InsetView (carbon.widget.InsetView)6 MaxSizeView (carbon.widget.MaxSizeView)6 RevealView (carbon.widget.RevealView)6 StateAnimatorView (carbon.widget.StateAnimatorView)6 TouchMarginView (carbon.widget.TouchMarginView)6 TypedArray (android.content.res.TypedArray)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1