use of android.graphics.drawable.RippleDrawable in project BoomMenu by Nightonke.
the class BoomMenuButton method setButtonBackground.
private void setButtonBackground() {
if (backgroundEffect && !inList) {
if (rippleEffect && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
RippleDrawable rippleDrawable = new RippleDrawable(ColorStateList.valueOf(highlightedColor), Util.getOvalDrawable(button, normalColor), null);
Util.setDrawable(button, rippleDrawable);
} else {
StateListDrawable stateListDrawable = Util.getOvalStateListBitmapDrawable(button, buttonRadius, normalColor, highlightedColor, unableColor);
Util.setDrawable(button, stateListDrawable);
}
} else {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
Util.setDrawable(button, Util.getSystemDrawable(context, android.R.attr.selectableItemBackgroundBorderless));
} else {
Util.setDrawable(button, Util.getSystemDrawable(context, android.R.attr.selectableItemBackground));
}
}
}
use of android.graphics.drawable.RippleDrawable in project material-calendarview by prolificinteractive.
the class DayView method generateRippleDrawable.
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private static Drawable generateRippleDrawable(final int color, Rect bounds) {
ColorStateList list = ColorStateList.valueOf(color);
Drawable mask = generateCircleDrawable(Color.WHITE);
RippleDrawable rippleDrawable = new RippleDrawable(list, null, mask);
// API 21
if (Build.VERSION.SDK_INT == Build.VERSION_CODES.LOLLIPOP) {
rippleDrawable.setBounds(bounds);
}
// API 22. Technically harmless to leave on for API 21 and 23, but not worth risking for 23+
if (Build.VERSION.SDK_INT == Build.VERSION_CODES.LOLLIPOP_MR1) {
int center = (bounds.left + bounds.right) / 2;
rippleDrawable.setHotspotBounds(center, bounds.top, center, bounds.bottom);
}
return rippleDrawable;
}
use of android.graphics.drawable.RippleDrawable in project LuaViewSDK by alibaba.
the class ForegroundDelegate method setupForeground.
private static void setupForeground(View view, Drawable drawable, Integer color, Integer alpha) {
if (view instanceof IForeground) {
if (color != null) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
if (drawable instanceof RippleDrawable) {
RippleDrawable rippleDrawable = (RippleDrawable) drawable;
rippleDrawable.setColor(ColorStateList.valueOf(color));
if (alpha != null) {
rippleDrawable.setAlpha(alpha);
}
}
}
}
((IForeground) view).setForeground(drawable);
}
}
use of android.graphics.drawable.RippleDrawable in project material-camera by afollestad.
the class BaseCameraFragment method setImageRes.
protected void setImageRes(ImageView iv, @DrawableRes int res) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && iv.getBackground() instanceof RippleDrawable) {
RippleDrawable rd = (RippleDrawable) iv.getBackground();
rd.setColor(ColorStateList.valueOf(CameraUtil.adjustAlpha(mIconTextColor, 0.3f)));
}
Drawable d = AppCompatResources.getDrawable(iv.getContext(), res);
d = DrawableCompat.wrap(d.mutate());
DrawableCompat.setTint(d, mIconTextColor);
iv.setImageDrawable(d);
}
use of android.graphics.drawable.RippleDrawable in project material-components-android by material-components.
the class FloatingActionButtonLollipop method setBackgroundDrawable.
@Override
void setBackgroundDrawable(ColorStateList backgroundTint, PorterDuff.Mode backgroundTintMode, int rippleColor, int borderWidth) {
// Now we need to tint the shape background with the tint
mShapeDrawable = DrawableCompat.wrap(createShapeDrawable());
DrawableCompat.setTintList(mShapeDrawable, backgroundTint);
if (backgroundTintMode != null) {
DrawableCompat.setTintMode(mShapeDrawable, backgroundTintMode);
}
final Drawable rippleContent;
if (borderWidth > 0) {
mBorderDrawable = createBorderDrawable(borderWidth, backgroundTint);
rippleContent = new LayerDrawable(new Drawable[] { mBorderDrawable, mShapeDrawable });
} else {
mBorderDrawable = null;
rippleContent = mShapeDrawable;
}
mRippleDrawable = new RippleDrawable(ColorStateList.valueOf(rippleColor), rippleContent, null);
mContentBackground = mRippleDrawable;
mShadowViewDelegate.setBackgroundDrawable(mRippleDrawable);
}
Aggregations