use of android.graphics.drawable.RippleDrawable in project ChatExchange by HueToYou.
the class Label method onActionUp.
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
void onActionUp() {
if (mUsingStyle) {
mBackgroundDrawable = getBackground();
}
if (mBackgroundDrawable instanceof StateListDrawable) {
StateListDrawable drawable = (StateListDrawable) mBackgroundDrawable;
drawable.setState(new int[] {});
} else if (Util.hasLollipop() && mBackgroundDrawable instanceof RippleDrawable) {
RippleDrawable ripple = (RippleDrawable) mBackgroundDrawable;
ripple.setState(new int[] {});
ripple.setHotspot(getMeasuredWidth() / 2, getMeasuredHeight() / 2);
ripple.setVisible(true, true);
}
// setPressed(false);
}
use of android.graphics.drawable.RippleDrawable in project ChatExchange by HueToYou.
the class FloatingActionButton method onActionUp.
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
void onActionUp() {
if (mBackgroundDrawable instanceof StateListDrawable) {
StateListDrawable drawable = (StateListDrawable) mBackgroundDrawable;
drawable.setState(new int[] { android.R.attr.state_enabled });
} else if (Util.hasLollipop()) {
RippleDrawable ripple = (RippleDrawable) mBackgroundDrawable;
ripple.setState(new int[] { android.R.attr.state_enabled });
ripple.setHotspot(calculateCenterX(), calculateCenterY());
ripple.setVisible(true, true);
}
}
use of android.graphics.drawable.RippleDrawable in project ChatExchange by HueToYou.
the class FloatingActionButton method createFillDrawable.
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private Drawable createFillDrawable() {
StateListDrawable drawable = new StateListDrawable();
drawable.addState(new int[] { -android.R.attr.state_enabled }, createCircleDrawable(mColorDisabled));
drawable.addState(new int[] { android.R.attr.state_pressed }, createCircleDrawable(mColorPressed));
drawable.addState(new int[] {}, createCircleDrawable(mColorNormal));
if (Util.hasLollipop()) {
RippleDrawable ripple = new RippleDrawable(new ColorStateList(new int[][] { {} }, new int[] { mColorRipple }), drawable, null);
setOutlineProvider(new ViewOutlineProvider() {
@Override
public void getOutline(View view, Outline outline) {
outline.setOval(0, 0, view.getWidth(), view.getHeight());
}
});
setClipToOutline(true);
mBackgroundDrawable = ripple;
return ripple;
}
mBackgroundDrawable = drawable;
return drawable;
}
use of android.graphics.drawable.RippleDrawable in project ChatExchange by HueToYou.
the class FloatingActionButton method onActionDown.
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
void onActionDown() {
if (mBackgroundDrawable instanceof StateListDrawable) {
StateListDrawable drawable = (StateListDrawable) mBackgroundDrawable;
drawable.setState(new int[] { android.R.attr.state_enabled, android.R.attr.state_pressed });
} else if (Util.hasLollipop()) {
RippleDrawable ripple = (RippleDrawable) mBackgroundDrawable;
ripple.setState(new int[] { android.R.attr.state_enabled, android.R.attr.state_pressed });
ripple.setHotspot(calculateCenterX(), calculateCenterY());
ripple.setVisible(true, true);
}
}
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;
}
Aggregations