A BitmapDrawable that uses reference counting to determine when internal resources should be freed (Disposed). On Android versions Honeycomb and higher the internal Bitmap is Dispose()d but not recycled. On all other Android versions the Bitmap is recycled then disposed.
Inheritance: Android.Graphics.Drawables.BitmapDrawable, ISelfDisposingBitmapDrawable
示例#1
0
		public void Add(string key, SelfDisposingBitmapDrawable bitmap)
		{
            if (string.IsNullOrWhiteSpace(key) || bitmap == null || _cache.ContainsKey(key))
				return;
			
			_cache.Add(key, bitmap);
		}
示例#2
0
		public void Add(string key, SelfDisposingBitmapDrawable bitmap)
		{
			if (string.IsNullOrWhiteSpace(key) || bitmap == null || bitmap.Handle == IntPtr.Zero || !bitmap.HasValidBitmap || _cache.ContainsKey(key))
				return;
			
			_cache.Add(key, bitmap);
		}
 public void SetPlaceholder(SelfDisposingBitmapDrawable drawable, int animationDuration)
 {
     if (!animating)
     {
         alpha           = 255;
         fadeDuration    = animationDuration;
         startTimeMillis = SystemClock.UptimeMillis();
         placeholder     = drawable?.GetConstantState().NewDrawable() as BitmapDrawable;
         animating       = true;
     }
 }
 public void SetPlaceholder(SelfDisposingBitmapDrawable drawable, int animationDuration)
 {
     if (!animating)
     {
         alpha = 255;
         fadeDuration = animationDuration;
         startTimeMillis = SystemClock.UptimeMillis();
         placeholder = drawable.GetConstantState().NewDrawable() as BitmapDrawable;
         animating = true;
     }
 }
 public FFBitmapDrawable(Resources res, Bitmap bitmap, SelfDisposingBitmapDrawable baseDrawable) : base(res, bitmap)
 {
     this.baseDrawable = new WeakReference <ISelfDisposingBitmapDrawable>(baseDrawable);
 }
 public FFBitmapDrawable(Resources res, Bitmap bitmap, SelfDisposingBitmapDrawable baseDrawable) : base(res, bitmap)
 {
     this.baseDrawable = new WeakReference<ISelfDisposingBitmapDrawable>(baseDrawable);
 }