summaryrefslogtreecommitdiff
path: root/app/src/main/java/se/leap
diff options
context:
space:
mode:
authorcyberta <cyberta@riseup.net>2023-01-03 14:48:35 +0000
committercyberta <cyberta@riseup.net>2023-01-03 14:48:35 +0000
commit4d9d470a0fca7a921cec8ba9b421e9d04466febe (patch)
treeabc88787c67da1895b9c21fe614a144cf25664ef /app/src/main/java/se/leap
parent6128136ddf9bb3626104c739db65e9e005211116 (diff)
parente462d19473e41aa5f9c155dcec1c4daa9ecdbfa8 (diff)
Merge branch 'fix_animation_crash' into 'master'
fix crash when trying to animate a drawable after Fragment is not in resumed state anymore See merge request leap/bitmask_android!237
Diffstat (limited to 'app/src/main/java/se/leap')
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/base/fragments/EipFragment.java9
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;