diff options
author | cyBerta <cyberta@riseup.net> | 2022-12-28 16:12:50 +0100 |
---|---|---|
committer | cyBerta <cyberta@riseup.net> | 2022-12-28 16:12:50 +0100 |
commit | e462d19473e41aa5f9c155dcec1c4daa9ecdbfa8 (patch) | |
tree | d3fe1ef2864ebc69fd8a53e7babea9ef76754d41 /app/src/main/java | |
parent | 9d64ea1f6274ca66c4e44f7bd24698a1f64c3ffe (diff) |
fix crash when trying to animate a drawable after Fragment is not in resumed state anymore
Diffstat (limited to 'app/src/main/java')
-rw-r--r-- | app/src/main/java/se/leap/bitmaskclient/base/fragments/EipFragment.java | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/base/fragments/EipFragment.java b/app/src/main/java/se/leap/bitmaskclient/base/fragments/EipFragment.java index 409efcf0..a2fb2683 100644 --- a/app/src/main/java/se/leap/bitmaskclient/base/fragments/EipFragment.java +++ b/app/src/main/java/se/leap/bitmaskclient/base/fragments/EipFragment.java @@ -227,6 +227,12 @@ public class EipFragment extends Fragment implements Observer { public void onPause() { super.onPause(); Log.d(TAG, "onPause"); + if (stateView.getDrawable() instanceof Animatable) { + Animatable animatedDrawable = (Animatable) stateView.getDrawable(); + if (animatedDrawable.isRunning()) { + animatedDrawable.stop(); + } + } } @Override @@ -575,6 +581,9 @@ public class EipFragment extends Fragment implements Observer { @Override public void onAnimationEnd(Drawable drawable) { super.onAnimationEnd(drawable); + if (!isResumed()) { + return; + } if (pendingAnimationState != 0) { int newAnimationRes = pendingAnimationState; pendingAnimationState = 0; |