Search in sources :

Example 1 with ShadowView

use of carbon.view.ShadowView in project Carbon by ZieIony.

the class CoordinatorLayout method drawChild.

@Override
protected boolean drawChild(@NonNull Canvas canvas, @NonNull View child, long drawingTime) {
    if (child instanceof ShadowView && (!Carbon.IS_LOLLIPOP_OR_HIGHER || ((ShadowView) child).getElevationShadowColor() != null && !Carbon.IS_PIE_OR_HIGHER)) {
        ShadowView shadowView = (ShadowView) child;
        shadowView.drawShadow(canvas);
    }
    if (child instanceof RippleView) {
        RippleView rippleView = (RippleView) child;
        RippleDrawable rippleDrawable = rippleView.getRippleDrawable();
        if (rippleDrawable != null && rippleDrawable.getStyle() == RippleDrawable.Style.Borderless) {
            int saveCount = canvas.save();
            canvas.translate(child.getLeft(), child.getTop());
            canvas.concat(child.getMatrix());
            rippleDrawable.draw(canvas);
            canvas.restoreToCount(saveCount);
        }
    }
    return super.drawChild(canvas, child, drawingTime);
}
Also used : ShadowView(carbon.view.ShadowView) RippleView(carbon.drawable.ripple.RippleView) Paint(android.graphics.Paint) SuppressLint(android.annotation.SuppressLint) Point(android.graphics.Point) RippleDrawable(carbon.drawable.ripple.RippleDrawable)

Example 2 with ShadowView

use of carbon.view.ShadowView in project Carbon by ZieIony.

the class ConstraintLayout method drawChild.

@Override
protected boolean drawChild(@NonNull Canvas canvas, @NonNull View child, long drawingTime) {
    if (child instanceof ShadowView && (!Carbon.IS_LOLLIPOP_OR_HIGHER || ((ShadowView) child).getElevationShadowColor() != null && !Carbon.IS_PIE_OR_HIGHER)) {
        ShadowView shadowView = (ShadowView) child;
        shadowView.drawShadow(canvas);
    }
    if (child instanceof RippleView) {
        RippleView rippleView = (RippleView) child;
        RippleDrawable rippleDrawable = rippleView.getRippleDrawable();
        if (rippleDrawable != null && rippleDrawable.getStyle() == RippleDrawable.Style.Borderless) {
            int saveCount = canvas.save();
            canvas.translate(child.getLeft(), child.getTop());
            canvas.concat(child.getMatrix());
            rippleDrawable.draw(canvas);
            canvas.restoreToCount(saveCount);
        }
    }
    return super.drawChild(canvas, child, drawingTime);
}
Also used : ShadowView(carbon.view.ShadowView) RippleView(carbon.drawable.ripple.RippleView) Paint(android.graphics.Paint) SuppressLint(android.annotation.SuppressLint) Point(android.graphics.Point) RippleDrawable(carbon.drawable.ripple.RippleDrawable)

Example 3 with ShadowView

use of carbon.view.ShadowView in project Carbon by ZieIony.

the class FrameLayout method drawChild.

@Override
protected boolean drawChild(@NonNull Canvas canvas, @NonNull View child, long drawingTime) {
    // TODO: why isShown() returns false after being reattached?
    if (child instanceof ShadowView && (!Carbon.IS_LOLLIPOP_OR_HIGHER || ((ShadowView) child).getElevationShadowColor() != null && !Carbon.IS_PIE_OR_HIGHER)) {
        ShadowView shadowView = (ShadowView) child;
        shadowView.drawShadow(canvas);
    }
    if (child instanceof RippleView) {
        RippleView rippleView = (RippleView) child;
        RippleDrawable rippleDrawable = rippleView.getRippleDrawable();
        if (rippleDrawable != null && rippleDrawable.getStyle() == RippleDrawable.Style.Borderless) {
            int saveCount = canvas.save();
            canvas.translate(child.getLeft(), child.getTop());
            canvas.concat(child.getMatrix());
            rippleDrawable.draw(canvas);
            canvas.restoreToCount(saveCount);
        }
    }
    return super.drawChild(canvas, child, drawingTime);
}
Also used : ShadowView(carbon.view.ShadowView) RippleView(carbon.drawable.ripple.RippleView) Paint(android.graphics.Paint) SuppressLint(android.annotation.SuppressLint) Point(android.graphics.Point) RippleDrawable(carbon.drawable.ripple.RippleDrawable)

Example 4 with ShadowView

use of carbon.view.ShadowView in project Carbon by ZieIony.

the class GridLayout method drawChild.

@Override
protected boolean drawChild(@NonNull Canvas canvas, @NonNull View child, long drawingTime) {
    if (child instanceof ShadowView && (!Carbon.IS_LOLLIPOP_OR_HIGHER || ((ShadowView) child).getElevationShadowColor() != null && !Carbon.IS_PIE_OR_HIGHER)) {
        ShadowView shadowView = (ShadowView) child;
        shadowView.drawShadow(canvas);
    }
    if (child instanceof RippleView) {
        RippleView rippleView = (RippleView) child;
        RippleDrawable rippleDrawable = rippleView.getRippleDrawable();
        if (rippleDrawable != null && rippleDrawable.getStyle() == RippleDrawable.Style.Borderless) {
            int saveCount = canvas.save();
            canvas.translate(child.getLeft(), child.getTop());
            canvas.concat(child.getMatrix());
            rippleDrawable.draw(canvas);
            canvas.restoreToCount(saveCount);
        }
    }
    return super.drawChild(canvas, child, drawingTime);
}
Also used : ShadowView(carbon.view.ShadowView) RippleView(carbon.drawable.ripple.RippleView) Paint(android.graphics.Paint) SuppressLint(android.annotation.SuppressLint) Point(android.graphics.Point) RippleDrawable(carbon.drawable.ripple.RippleDrawable)

Example 5 with ShadowView

use of carbon.view.ShadowView in project Carbon by ZieIony.

the class RelativeLayout method drawChild.

@Override
protected boolean drawChild(@NonNull Canvas canvas, @NonNull View child, long drawingTime) {
    // TODO: why isShown() returns false after being reattached?
    if (child instanceof ShadowView && (!Carbon.IS_LOLLIPOP_OR_HIGHER || ((ShadowView) child).getElevationShadowColor() != null && !Carbon.IS_PIE_OR_HIGHER)) {
        ShadowView shadowView = (ShadowView) child;
        shadowView.drawShadow(canvas);
    }
    if (child instanceof RippleView) {
        RippleView rippleView = (RippleView) child;
        RippleDrawable rippleDrawable = rippleView.getRippleDrawable();
        if (rippleDrawable != null && rippleDrawable.getStyle() == RippleDrawable.Style.Borderless) {
            int saveCount = canvas.save();
            canvas.translate(child.getLeft(), child.getTop());
            canvas.concat(child.getMatrix());
            rippleDrawable.draw(canvas);
            canvas.restoreToCount(saveCount);
        }
    }
    return super.drawChild(canvas, child, drawingTime);
}
Also used : ShadowView(carbon.view.ShadowView) RippleView(carbon.drawable.ripple.RippleView) Paint(android.graphics.Paint) SuppressLint(android.annotation.SuppressLint) Point(android.graphics.Point) RippleDrawable(carbon.drawable.ripple.RippleDrawable)

Aggregations

ShadowView (carbon.view.ShadowView)14 SuppressLint (android.annotation.SuppressLint)13 Paint (android.graphics.Paint)13 Point (android.graphics.Point)13 RippleDrawable (carbon.drawable.ripple.RippleDrawable)13 RippleView (carbon.drawable.ripple.RippleView)13 FrameLayout (android.widget.FrameLayout)1 Button (carbon.widget.Button)1