List of usage examples for android.graphics.drawable Drawable getColorFilter
public @Nullable ColorFilter getColorFilter()
From source file:Main.java
/** * @see android.graphics.drawable.Drawable#getColorFilter(). *//*www . j av a2 s.c o m*/ @SuppressWarnings("NewApi") public static ColorFilter getColorFilter(Drawable drawable) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { return drawable.getColorFilter(); } else { return null; } }
From source file:com.albedinsky.android.ui.graphics.drawable.DrawableWrapper.java
/** * Creates a new instance of DrawableWrapper which wraps the given <var>drawable</var>. * * @param drawable The drawable to wrap. *///from www . j a v a 2 s .c o m public DrawableWrapper(@NonNull Drawable drawable) { this.mDrawable = drawable; /** * Copy current state of the wrapped drawable. */ setState(drawable.getState()); setBounds(drawable.getBounds()); setLevel(drawable.getLevel()); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { setCallback(drawable.getCallback()); } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { setAlpha(drawable.getAlpha()); } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { setColorFilter(drawable.getColorFilter()); } mDrawable.setCallback(this); }