Search in sources :

Example 6 with ShadowView

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

the class DrawerLayout 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 && (Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT_WATCH || ((ShadowView) child).getElevationShadowColor() != null)) {
        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.MATRIX_SAVE_FLAG);
            canvas.translate(child.getLeft(), child.getTop());
            canvas.concat(MatrixHelper.getMatrix(child));
            rippleDrawable.draw(canvas);
            canvas.restoreToCount(saveCount);
        }
    }
    return super.drawChild(canvas, child, drawingTime);
}
Also used : ShadowView(carbon.shadow.ShadowView) RippleView(carbon.drawable.ripple.RippleView) Paint(android.graphics.Paint) RippleDrawable(carbon.drawable.ripple.RippleDrawable)

Example 7 with ShadowView

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

the class FlowLayout method drawChild.

@Override
protected boolean drawChild(@NonNull Canvas canvas, @NonNull View child, long drawingTime) {
    if (child instanceof ShadowView && (Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT_WATCH || ((ShadowView) child).getElevationShadowColor() != null)) {
        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.MATRIX_SAVE_FLAG);
            canvas.translate(child.getLeft(), child.getTop());
            canvas.concat(MatrixHelper.getMatrix(child));
            rippleDrawable.draw(canvas);
            canvas.restoreToCount(saveCount);
        }
    }
    return super.drawChild(canvas, child, drawingTime);
}
Also used : ShadowView(carbon.shadow.ShadowView) RippleView(carbon.drawable.ripple.RippleView) Paint(android.graphics.Paint) RippleDrawable(carbon.drawable.ripple.RippleDrawable)

Example 8 with ShadowView

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

the class ExpandableRecyclerView method drawChild.

@Override
public boolean drawChild(@NonNull Canvas canvas, @NonNull View child, long drawingTime) {
    // TODO: why isShown() returns false after being reattached?
    if (child instanceof ShadowView && (Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT_WATCH || ((ShadowView) child).getElevationShadowColor() != null)) {
        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.MATRIX_SAVE_FLAG);
            canvas.translate(child.getLeft(), child.getTop());
            canvas.concat(MatrixHelper.getMatrix(child));
            rippleDrawable.draw(canvas);
            canvas.restoreToCount(saveCount);
        }
    }
    return super.drawChild(canvas, child, drawingTime);
}
Also used : ShadowView(carbon.shadow.ShadowView) RippleView(carbon.drawable.ripple.RippleView) Paint(android.graphics.Paint) RippleDrawable(carbon.drawable.ripple.RippleDrawable)

Example 9 with ShadowView

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

the class Toolbar method drawChild.

@Override
protected boolean drawChild(@NonNull Canvas canvas, @NonNull View child, long drawingTime) {
    if (child instanceof ShadowView && (Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT_WATCH || ((ShadowView) child).getElevationShadowColor() != null)) {
        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.MATRIX_SAVE_FLAG);
            canvas.translate(child.getLeft(), child.getTop());
            canvas.concat(MatrixHelper.getMatrix(child));
            rippleDrawable.draw(canvas);
            canvas.restoreToCount(saveCount);
        }
    }
    return super.drawChild(canvas, child, drawingTime);
}
Also used : ShadowView(carbon.shadow.ShadowView) RippleView(carbon.drawable.ripple.RippleView) Paint(android.graphics.Paint) RippleDrawable(carbon.drawable.ripple.RippleDrawable)

Example 10 with ShadowView

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

the class CollapsingToolbarLayout method drawChild.

@Override
protected boolean drawChild(@NonNull Canvas canvas, @NonNull View child, long drawingTime) {
    if (child instanceof ShadowView && (Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT_WATCH || ((ShadowView) child).getElevationShadowColor() != null)) {
        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.MATRIX_SAVE_FLAG);
            canvas.translate(child.getLeft(), child.getTop());
            canvas.concat(MatrixHelper.getMatrix(child));
            rippleDrawable.draw(canvas);
            canvas.restoreToCount(saveCount);
        }
    }
    return super.drawChild(canvas, child, drawingTime);
}
Also used : ShadowView(carbon.shadow.ShadowView) RippleView(carbon.drawable.ripple.RippleView) Paint(android.graphics.Paint) RippleDrawable(carbon.drawable.ripple.RippleDrawable)

Aggregations

ShadowView (carbon.shadow.ShadowView)14 Paint (android.graphics.Paint)13 RippleDrawable (carbon.drawable.ripple.RippleDrawable)13 RippleView (carbon.drawable.ripple.RippleView)13 FrameLayout (android.widget.FrameLayout)1 Button (carbon.widget.Button)1