Search in sources :

Example 1 with Component

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

the class CoordinatorLayout 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) StateAnimatorView(carbon.widget.StateAnimatorView) ComponentView(carbon.component.ComponentView) View(android.view.View) CornerView(carbon.widget.CornerView) RippleView(carbon.drawable.ripple.RippleView) TouchMarginView(carbon.widget.TouchMarginView) MaxSizeView(carbon.widget.MaxSizeView) ShadowView(carbon.shadow.ShadowView) RevealView(carbon.widget.RevealView) AnimatedView(carbon.animation.AnimatedView) InsetView(carbon.widget.InsetView) Paint(android.graphics.Paint)

Example 2 with Component

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

the class CoordinatorLayout 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) StateAnimatorView(carbon.widget.StateAnimatorView) ComponentView(carbon.component.ComponentView) View(android.view.View) CornerView(carbon.widget.CornerView) RippleView(carbon.drawable.ripple.RippleView) TouchMarginView(carbon.widget.TouchMarginView) MaxSizeView(carbon.widget.MaxSizeView) ShadowView(carbon.shadow.ShadowView) RevealView(carbon.widget.RevealView) AnimatedView(carbon.animation.AnimatedView) InsetView(carbon.widget.InsetView) Paint(android.graphics.Paint)

Example 3 with Component

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

the class AppBarLayout 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) StateAnimatorView(carbon.widget.StateAnimatorView) ComponentView(carbon.component.ComponentView) View(android.view.View) CornerView(carbon.widget.CornerView) RippleView(carbon.drawable.ripple.RippleView) TouchMarginView(carbon.widget.TouchMarginView) MaxSizeView(carbon.widget.MaxSizeView) ShadowView(carbon.shadow.ShadowView) RevealView(carbon.widget.RevealView) AnimatedView(carbon.animation.AnimatedView) InsetView(carbon.widget.InsetView) Paint(android.graphics.Paint)

Example 4 with Component

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

the class CollapsingToolbarLayout 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) StateAnimatorView(carbon.widget.StateAnimatorView) ComponentView(carbon.component.ComponentView) View(android.view.View) CornerView(carbon.widget.CornerView) RippleView(carbon.drawable.ripple.RippleView) TouchMarginView(carbon.widget.TouchMarginView) MaxSizeView(carbon.widget.MaxSizeView) ShadowView(carbon.shadow.ShadowView) RevealView(carbon.widget.RevealView) AnimatedView(carbon.animation.AnimatedView) InsetView(carbon.widget.InsetView) Paint(android.graphics.Paint)

Example 5 with Component

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

the class ConstraintLayout 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)

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