List of usage examples for android.graphics.drawable RippleDrawable getDrawable
public Drawable getDrawable(int index)
From source file:com.varejodigital.activities.DetailActivity.java
private void updateBackground(View view, Palette palette) { int lightMutedColor = palette.getLightMutedColor(getResources().getColor(R.color.accent)); int mutedColor = palette.getMutedColor(getResources().getColor(R.color.accent)); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { RippleDrawable ripple = (RippleDrawable) view.getBackground(); GradientDrawable rippleBackground = (GradientDrawable) ripple.getDrawable(0); rippleBackground.setColor(lightMutedColor); ripple.setColor(ColorStateList.valueOf(mutedColor)); } else {/*from w ww . ja v a2 s . com*/ StateListDrawable drawable = (StateListDrawable) view.getBackground(); drawable.setColorFilter(mutedColor, PorterDuff.Mode.SRC_ATOP); } }
From source file:fr.outadev.skinswitch.DetailActivity.java
@TargetApi(Build.VERSION_CODES.LOLLIPOP) private void colorRipple(int id, int tintColor) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { FloatingActionButton buttonView = (FloatingActionButton) findViewById(id); RippleDrawable ripple = (RippleDrawable) buttonView.getBackground(); GradientDrawable rippleBackground = (GradientDrawable) ripple.getDrawable(0); rippleBackground.setColor(getResources().getColor(R.color.colorPrimary)); ripple.setColor(ColorStateList.valueOf(tintColor)); }/*from www .j a va 2s. co m*/ }