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.
Наследование: 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);
		}
Пример #3
0
 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;
     }
 }
Пример #5
0
 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);
 }