From afdfe7f23f86795298b7ecf1f8d102f6406574d4 Mon Sep 17 00:00:00 2001 From: Vladimir Ananiev Date: Fri, 8 Jul 2016 22:10:33 +0300 Subject: [PATCH] Fix order of the inter-frame delays --- .../java/com/felipecsl/gifimageview/library/GifImageView.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/src/main/java/com/felipecsl/gifimageview/library/GifImageView.java b/library/src/main/java/com/felipecsl/gifimageview/library/GifImageView.java index 71793da..91457f4 100644 --- a/library/src/main/java/com/felipecsl/gifimageview/library/GifImageView.java +++ b/library/src/main/java/com/felipecsl/gifimageview/library/GifImageView.java @@ -153,7 +153,6 @@ public int getGifHeight() { if (!animating) { break; } - gifDecoder.advance(); try { int delay = gifDecoder.getNextDelay(); // Sleep for frame duration minus time already spent on frame decode @@ -163,6 +162,7 @@ public int getGifHeight() { if (delay > 0) { Thread.sleep(framesDisplayDuration > 0 ? framesDisplayDuration : delay); } + gifDecoder.advance(); } catch (final Exception e) { // suppress any exception // it can be InterruptedException or IllegalArgumentException