/// <summary> /// Builds and returned a gray colored drawable. /// </summary> /// <returns>The gray drawable.</returns> /// <param name="drawableRes">Drawable res.</param> public Drawable GetColoredDrawable(int drawableRes, int colorRes) { var ret = new BitmapDrawable(cache.GetBitmap(drawableRes)); ret.SetColorFilter(colorRes.AsResourceColor(Activity), PorterDuff.Mode.SrcAtop); return(ret); }
public override void SetColorFilter(Color color, PorterDuff.Mode mode) { if (_placeholder != null) { _placeholder.SetColorFilter(color, mode); } base.SetColorFilter(color, mode); }
public override void SetColorFilter(Color color, PorterDuff.Mode mode) { if (IsBitmapDrawableValid(placeholder)) { placeholder.SetColorFilter(color, mode); } base.SetColorFilter(color, mode); }
public override void SetColorFilter(Color color, PorterDuff.Mode mode) { try { if (placeholder.IsValidAndHasValidBitmap()) { placeholder.SetColorFilter(color, mode); } base.SetColorFilter(color, mode); } catch (Exception) { } }
public override void SetColorFilter(Color color, PorterDuff.Mode mode) { try { if (IsBitmapDrawableValid(_placeholder)) { _placeholder.SetColorFilter(color, mode); } } catch (Exception ex) { ImageService.Instance.Config.Logger?.Error("Placeholder SetColorFilter", ex); } base.SetColorFilter(color, mode); }
public override View GetView(int position, View convertView, ViewGroup parent) { View v = base.GetView(position, convertView, parent); TextView tv = (TextView)v.FindViewById(Android.Resource.Id.Text1); tv.SetPadding(tv.PaddingLeft, 0, tv.PaddingRight, 0); PwEntry templateEntry = this.GetItem(position); int size = (int)(Util.convertDpToPixel(Util.convertDpToPixel(20, Context), Context)); var bmp = Bitmap.CreateScaledBitmap( Util.DrawableToBitmap(App.Kp2a.GetDb() .DrawableFactory.GetIconDrawable(Context, App.Kp2a.GetDb().KpDatabase, templateEntry.IconId, PwUuid.Zero, false)), size, size, true); Drawable icon = new BitmapDrawable(bmp); if ( PreferenceManager.GetDefaultSharedPreferences(Context) .GetString("IconSetKey", Context.PackageName) == Context.PackageName) { Android.Graphics.PorterDuff.Mode mMode = Android.Graphics.PorterDuff.Mode.SrcAtop; Color color = new Color(189, 189, 189); icon.SetColorFilter(color, mMode); } //Put the image on the TextView tv.SetCompoundDrawablesWithIntrinsicBounds(icon, null, null, null); tv.Text = templateEntry.Strings.ReadSafe(PwDefs.TitleField); tv.SetTextSize(ComplexUnitType.Dip, 20); tv.CompoundDrawablePadding = (int)Util.convertDpToPixel(8, Context); return(v); }