use of carbon.drawable.ripple.RippleDrawable in project Carbon by ZieIony.
the class AppBarLayout 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);
}
use of carbon.drawable.ripple.RippleDrawable in project Carbon by ZieIony.
the class Carbon method createRippleDrawable.
public static RippleDrawable createRippleDrawable(ColorStateList color, RippleDrawable.Style style, View view, boolean useHotspot, int radius) {
RippleDrawable rippleDrawable;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
rippleDrawable = new RippleDrawableMarshmallow(color, style == RippleDrawable.Style.Background ? view.getBackground() : null, style);
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
rippleDrawable = new RippleDrawableLollipop(color, style == RippleDrawable.Style.Background ? view.getBackground() : null, style);
} else {
rippleDrawable = new RippleDrawableFroyo(color, style == RippleDrawable.Style.Background ? view.getBackground() : null, style);
}
rippleDrawable.setCallback(view);
rippleDrawable.setHotspotEnabled(useHotspot);
rippleDrawable.setRadius(radius);
return rippleDrawable;
}
use of carbon.drawable.ripple.RippleDrawable in project Carbon by ZieIony.
the class Carbon method createRippleDrawable.
public static RippleDrawable createRippleDrawable(ColorStateList color, RippleDrawable.Style style, View view, Drawable background, boolean useHotspot, int radius) {
RippleDrawable rippleDrawable;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
rippleDrawable = new RippleDrawableMarshmallow(color, background, style);
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
rippleDrawable = new RippleDrawableLollipop(color, background, style);
} else {
rippleDrawable = new RippleDrawableFroyo(color, background, style);
}
rippleDrawable.setCallback(view);
rippleDrawable.setHotspotEnabled(useHotspot);
rippleDrawable.setRadius(radius);
return rippleDrawable;
}
use of carbon.drawable.ripple.RippleDrawable in project Carbon by ZieIony.
the class RecyclerView 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);
}
use of carbon.drawable.ripple.RippleDrawable in project Carbon by ZieIony.
the class LinearLayout 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);
}
Aggregations