From dc6faeae4448d99e27a8e343b11a89ca5b540df4 Mon Sep 17 00:00:00 2001 From: mig35 Date: Wed, 18 Mar 2020 16:07:29 +0700 Subject: [PATCH] we have to remove listener before creating a new one --- .../main/java/io/supercharge/shimmerlayout/ShimmerLayout.java | 1 + 1 file changed, 1 insertion(+) diff --git a/shimmerlayout/src/main/java/io/supercharge/shimmerlayout/ShimmerLayout.java b/shimmerlayout/src/main/java/io/supercharge/shimmerlayout/ShimmerLayout.java index 868ac7e..ea5787b 100644 --- a/shimmerlayout/src/main/java/io/supercharge/shimmerlayout/ShimmerLayout.java +++ b/shimmerlayout/src/main/java/io/supercharge/shimmerlayout/ShimmerLayout.java @@ -129,6 +129,7 @@ public void startShimmerAnimation() { } if (getWidth() == 0) { + getViewTreeObserver().removeOnPreDrawListener(startAnimationPreDrawListener); startAnimationPreDrawListener = new ViewTreeObserver.OnPreDrawListener() { @Override public boolean onPreDraw() {