diff --git a/source/FFImageLoading.Droid/Drawables/FFBitmapDrawable.cs b/source/FFImageLoading.Droid/Drawables/FFBitmapDrawable.cs index a9f593049..389bc0187 100644 --- a/source/FFImageLoading.Droid/Drawables/FFBitmapDrawable.cs +++ b/source/FFImageLoading.Droid/Drawables/FFBitmapDrawable.cs @@ -16,6 +16,7 @@ public class FFBitmapDrawable : SelfDisposingBitmapDrawable bool animating; int alpha = 255; float fadeDuration = 200; + float normalized = 1f; public FFBitmapDrawable(Resources res, Bitmap bitmap) : base(res, bitmap) { @@ -57,6 +58,7 @@ public void SetPlaceholder(BitmapDrawable drawable, int animationDuration) { if (!animating) { + normalized = 0f; alpha = 255; fadeDuration = animationDuration; startTimeMillis = SystemClock.UptimeMillis(); @@ -81,16 +83,17 @@ public override void Draw(Canvas canvas) { if (!animating) { + normalized = 1f; base.Draw(canvas); } else { - float normalized = (SystemClock.UptimeMillis() - startTimeMillis) / fadeDuration; + normalized = (SystemClock.UptimeMillis() - startTimeMillis) / fadeDuration; if (normalized >= 1f) { animating = false; placeholder = null; - normalized = 0f; + normalized = 1f; base.Draw(canvas); } else @@ -122,7 +125,7 @@ public override int IntrinsicHeight { try { - if (animating && IsBitmapDrawableValid(placeholder)) + if (animating && normalized < 0.8f && IsBitmapDrawableValid(placeholder)) { return placeholder.IntrinsicHeight; } @@ -139,7 +142,7 @@ public override int IntrinsicWidth { try { - if (animating && IsBitmapDrawableValid(placeholder)) + if (animating && normalized < 0.8f && IsBitmapDrawableValid(placeholder)) { return placeholder.IntrinsicWidth; }