List of usage examples for android.graphics.drawable Drawable setAlpha
public abstract void setAlpha(@IntRange(from = 0, to = 255) int alpha);
From source file:com.bt.download.android.gui.util.UIUtils.java
/** * Android devices with SDK below target=11 do not support textView.setAlpha(). * This is a work around. //ww w . j a v a 2 s . com * @param v - the text view * @param alpha - a value from 0 to 255. (0=transparent, 255=fully visible) */ public static void setTextViewAlpha(TextView v, int alpha) { v.setTextColor(v.getTextColors().withAlpha(alpha)); v.setHintTextColor(v.getHintTextColors().withAlpha(alpha)); v.setLinkTextColor(v.getLinkTextColors().withAlpha(alpha)); Drawable[] compoundDrawables = v.getCompoundDrawables(); for (int i = 0; i < compoundDrawables.length; i++) { Drawable d = compoundDrawables[i]; if (d != null) { d.setAlpha(alpha); } } }
From source file:de.grobox.liberario.utils.TransportrUtils.java
static private Drawable getToolbarDrawable(Context context, Drawable drawable) { if (drawable != null) { drawable.setColorFilter(ContextCompat.getColor(context, R.color.drawableTintDark), PorterDuff.Mode.SRC_IN); drawable.setAlpha(255); drawable.mutate();/*from w w w.ja v a 2 s . c om*/ } return drawable; }
From source file:jahirfiquitiva.iconshowcase.utilities.color.ToolbarTinter.java
/** * Sets the color filter and/or the alpha transparency on a {@link MenuItem}'s icon. * * @param menuItem The {@link MenuItem} to theme. * @param color The color to set for the color filter or {@code null} for no changes. *///from ww w . java 2 s . c o m public static void colorMenuItem(MenuItem menuItem, Integer color, Integer alpha) { if (color == null) { return; // nothing to do. } Drawable drawable = menuItem.getIcon(); if (drawable != null) { // If we don't mutate the drawable, then all drawables with this id will have the ColorFilter drawable.mutate(); drawable.setColorFilter(color, PorterDuff.Mode.SRC_ATOP); if (alpha != null) { drawable.setAlpha(alpha); } else { drawable.setAlpha(255); } } }
From source file:com.weebly.opus1269.copyeverywhere.ui.shared.MenuTint.java
/** * Sets the color filter and/or the alpha transparency on a {@link MenuItem}'s icon. * * @param menuItem The {@link MenuItem} to theme. * @param color The color to set for the color filter or {@code null} for no changes. * @param alpha The alpha value (0...255) to set on the icon or {@code null} for no changes. *///ww w . j av a 2 s .co m public static void colorMenuItem(MenuItem menuItem, Integer color, Integer alpha) { if (color == null && alpha == null) { return; // nothing to do. } Drawable drawable = menuItem.getIcon(); if (drawable != null) { // If we don't mutate the drawable, then all drawables with this id will have the ColorFilter drawable.mutate(); if (color != null) { drawable.setColorFilter(color, PorterDuff.Mode.SRC_ATOP); } if (alpha != null) { drawable.setAlpha(alpha); } } }
From source file:co.carlosjimenez.android.currencyalerts.app.MenuTint.java
/** * Sets the color filter and/or the alpha transparency on a {@link MenuItem}'s icon. * * @param menuItem The {@link MenuItem} to theme. * @param color The color to set for the color filter or {@code null} for no changes. * @param alpha The alpha value (0...255) to set on the icon or {@code null} for no changes. *//* w ww . ja v a 2 s .c o m*/ public static void colorMenuItem(MenuItem menuItem, Integer color, Integer alpha) { if (color == null && alpha == null) { return; // nothing to do. } Drawable drawable = menuItem.getIcon(); if (drawable != null) { // If we don't mutate the drawable, then all drawables with this id will have the ColorFilter drawable.mutate(); if (color != null) { drawable.setColorFilter(new PorterDuffColorFilter(color, PorterDuff.Mode.SRC_ATOP)); } if (alpha != null) { drawable.setAlpha(alpha); } } }
From source file:de.vanita5.twittnuker.util.ThemeUtils.java
public static void applyThemeAlphaToDrawable(final Context context, final Drawable d) { if (context == null || d == null) return;/*w w w . j a va 2 s . c o m*/ d.setAlpha(getThemeAlpha(getThemeResource(context))); }
From source file:de.vanita5.twittnuker.util.ThemeUtils.java
public static void applyThemeBackgroundAlphaToDrawable(final Context context, final Drawable d) { if (context == null || d == null) return;// w w w .jav a 2s . c o m d.setAlpha(getUserThemeBackgroundAlpha(context)); }
From source file:de.vanita5.twittnuker.util.ThemeUtils.java
public static Drawable getImageHighlightDrawable(final Context context) { final Drawable d = getSelectableItemBackgroundDrawable(context); if (d != null) { d.setAlpha(0x80); }/* w w w. j a v a2 s.co m*/ return d; }
From source file:com.negusoft.greenmatter.drawable.CompoundDrawableWrapper.java
@Override public void setAlpha(int alpha) { for (Drawable d : mSecondaryDrawables) d.setAlpha(alpha); super.setAlpha(alpha); }
From source file:com.myfuture.view.ScheduleActivity.java
@Override public void onTabUnselected(Tab arg0, FragmentTransaction arg1) { Drawable icon = actionBar.getSelectedTab().getIcon(); if (icon != null) { icon.setAlpha(80); }//from w w w .j av a 2s . c om }