Search in sources :

Example 46 with ComponentView

use of carbon.component.ComponentView in project Carbon by ZieIony.

the class CoordinatorLayout method findComponentOfType.

public Component findComponentOfType(Class type) {
    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))
                return ((ComponentView) child).getComponent();
            if (child instanceof ViewGroup)
                groups.add((ViewGroup) child);
        }
    }
    return null;
}
Also used : ComponentView(carbon.component.ComponentView) ViewGroup(android.view.ViewGroup) ArrayList(java.util.ArrayList) ShadowView(carbon.view.ShadowView) ComponentView(carbon.component.ComponentView) StrokeView(carbon.view.StrokeView) View(android.view.View) RippleView(carbon.drawable.ripple.RippleView) RevealView(carbon.view.RevealView) TransformationView(carbon.view.TransformationView) InsetView(carbon.view.InsetView) AnimatedView(carbon.animation.AnimatedView) MarginView(carbon.view.MarginView) ShapeModelView(carbon.view.ShapeModelView) BehaviorView(carbon.view.BehaviorView) MaxSizeView(carbon.view.MaxSizeView) TouchMarginView(carbon.view.TouchMarginView) VisibleView(carbon.view.VisibleView) StateAnimatorView(carbon.view.StateAnimatorView) Paint(android.graphics.Paint) SuppressLint(android.annotation.SuppressLint) Point(android.graphics.Point)

Example 47 with ComponentView

use of carbon.component.ComponentView 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.component.Component) ShadowView(carbon.view.ShadowView) ComponentView(carbon.component.ComponentView) StrokeView(carbon.view.StrokeView) View(android.view.View) RippleView(carbon.drawable.ripple.RippleView) RevealView(carbon.view.RevealView) TransformationView(carbon.view.TransformationView) InsetView(carbon.view.InsetView) AnimatedView(carbon.animation.AnimatedView) MarginView(carbon.view.MarginView) ShapeModelView(carbon.view.ShapeModelView) BehaviorView(carbon.view.BehaviorView) MaxSizeView(carbon.view.MaxSizeView) TouchMarginView(carbon.view.TouchMarginView) VisibleView(carbon.view.VisibleView) StateAnimatorView(carbon.view.StateAnimatorView) Paint(android.graphics.Paint) SuppressLint(android.annotation.SuppressLint) Point(android.graphics.Point)

Example 48 with ComponentView

use of carbon.component.ComponentView 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.component.Component) ShadowView(carbon.view.ShadowView) ComponentView(carbon.component.ComponentView) StrokeView(carbon.view.StrokeView) View(android.view.View) RippleView(carbon.drawable.ripple.RippleView) RevealView(carbon.view.RevealView) TransformationView(carbon.view.TransformationView) InsetView(carbon.view.InsetView) AnimatedView(carbon.animation.AnimatedView) MarginView(carbon.view.MarginView) ShapeModelView(carbon.view.ShapeModelView) BehaviorView(carbon.view.BehaviorView) MaxSizeView(carbon.view.MaxSizeView) TouchMarginView(carbon.view.TouchMarginView) VisibleView(carbon.view.VisibleView) StateAnimatorView(carbon.view.StateAnimatorView) Paint(android.graphics.Paint) SuppressLint(android.annotation.SuppressLint) Point(android.graphics.Point)

Example 49 with ComponentView

use of carbon.component.ComponentView in project Carbon by ZieIony.

the class CoordinatorLayout method findComponentById.

public Component findComponentById(int id) {
    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)
                return ((ComponentView) child).getComponent();
            if (child instanceof ViewGroup)
                groups.add((ViewGroup) child);
        }
    }
    return null;
}
Also used : ComponentView(carbon.component.ComponentView) ViewGroup(android.view.ViewGroup) ArrayList(java.util.ArrayList) ShadowView(carbon.view.ShadowView) ComponentView(carbon.component.ComponentView) StrokeView(carbon.view.StrokeView) View(android.view.View) RippleView(carbon.drawable.ripple.RippleView) RevealView(carbon.view.RevealView) TransformationView(carbon.view.TransformationView) InsetView(carbon.view.InsetView) AnimatedView(carbon.animation.AnimatedView) MarginView(carbon.view.MarginView) ShapeModelView(carbon.view.ShapeModelView) BehaviorView(carbon.view.BehaviorView) MaxSizeView(carbon.view.MaxSizeView) TouchMarginView(carbon.view.TouchMarginView) VisibleView(carbon.view.VisibleView) StateAnimatorView(carbon.view.StateAnimatorView) Paint(android.graphics.Paint) SuppressLint(android.annotation.SuppressLint) Point(android.graphics.Point)

Example 50 with ComponentView

use of carbon.component.ComponentView in project Carbon by ZieIony.

the class AppBarLayout method findComponentById.

public Component findComponentById(int id) {
    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)
                return ((ComponentView) child).getComponent();
            if (child instanceof ViewGroup)
                groups.add((ViewGroup) child);
        }
    }
    return null;
}
Also used : ComponentView(carbon.component.ComponentView) ViewGroup(android.view.ViewGroup) ArrayList(java.util.ArrayList) ShadowView(carbon.view.ShadowView) ComponentView(carbon.component.ComponentView) StrokeView(carbon.view.StrokeView) View(android.view.View) RippleView(carbon.drawable.ripple.RippleView) RevealView(carbon.view.RevealView) InsetView(carbon.view.InsetView) AnimatedView(carbon.animation.AnimatedView) MarginView(carbon.view.MarginView) ShapeModelView(carbon.view.ShapeModelView) MaxSizeView(carbon.view.MaxSizeView) TouchMarginView(carbon.view.TouchMarginView) VisibleView(carbon.view.VisibleView) StateAnimatorView(carbon.view.StateAnimatorView) Paint(android.graphics.Paint) SuppressLint(android.annotation.SuppressLint) Point(android.graphics.Point)

Aggregations

Paint (android.graphics.Paint)52 View (android.view.View)52 ViewGroup (android.view.ViewGroup)52 AnimatedView (carbon.animation.AnimatedView)52 ComponentView (carbon.component.ComponentView)52 RippleView (carbon.drawable.ripple.RippleView)52 ArrayList (java.util.ArrayList)52 SuppressLint (android.annotation.SuppressLint)48 Point (android.graphics.Point)48 InsetView (carbon.view.InsetView)48 MarginView (carbon.view.MarginView)48 MaxSizeView (carbon.view.MaxSizeView)48 RevealView (carbon.view.RevealView)48 ShadowView (carbon.view.ShadowView)48 ShapeModelView (carbon.view.ShapeModelView)48 StateAnimatorView (carbon.view.StateAnimatorView)48 StrokeView (carbon.view.StrokeView)48 TouchMarginView (carbon.view.TouchMarginView)48 VisibleView (carbon.view.VisibleView)48 TransformationView (carbon.view.TransformationView)44