From 7c89108cea01d3183204237c84f345de62cca104 Mon Sep 17 00:00:00 2001 From: Trogel Date: Mon, 9 Oct 2017 12:39:22 +0200 Subject: [PATCH 1/2] Stop refresh animation on pause Workaround for Android bug https://issuetracker.google.com/issues/37008170 --- .../java/com/fsck/k9/fragment/MessageListFragment.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/k9mail/src/main/java/com/fsck/k9/fragment/MessageListFragment.java b/k9mail/src/main/java/com/fsck/k9/fragment/MessageListFragment.java index 8768843ef..d7b6af1a7 100644 --- a/k9mail/src/main/java/com/fsck/k9/fragment/MessageListFragment.java +++ b/k9mail/src/main/java/com/fsck/k9/fragment/MessageListFragment.java @@ -664,6 +664,13 @@ public class MessageListFragment extends Fragment implements OnItemClickListener localBroadcastManager.unregisterReceiver(cacheBroadcastReceiver); activityListener.onPause(getActivity()); messagingController.removeListener(activityListener); + + // Workaround for Android bug https://issuetracker.google.com/issues/37008170 + if (swipeRefreshLayout != null) { + swipeRefreshLayout.setRefreshing(false); + swipeRefreshLayout.destroyDrawingCache(); + swipeRefreshLayout.clearAnimation(); + } } /** From 655e86b4f5580aa44ccfa437e65d9e80275c98a9 Mon Sep 17 00:00:00 2001 From: cketti Date: Sat, 14 Oct 2017 02:28:32 +0200 Subject: [PATCH 2/2] Move swipe refresh animation workaround from onPause() to onStop() onPause() is also called when we don't want the animation to stop, e.g. when changing the focus to another window in multi window mode. However, adding a new Fragment will stop the old one. So onStop() is a better place to cancel the animation. --- .../com/fsck/k9/fragment/MessageListFragment.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/k9mail/src/main/java/com/fsck/k9/fragment/MessageListFragment.java b/k9mail/src/main/java/com/fsck/k9/fragment/MessageListFragment.java index d7b6af1a7..e0048437b 100644 --- a/k9mail/src/main/java/com/fsck/k9/fragment/MessageListFragment.java +++ b/k9mail/src/main/java/com/fsck/k9/fragment/MessageListFragment.java @@ -664,13 +664,6 @@ public class MessageListFragment extends Fragment implements OnItemClickListener localBroadcastManager.unregisterReceiver(cacheBroadcastReceiver); activityListener.onPause(getActivity()); messagingController.removeListener(activityListener); - - // Workaround for Android bug https://issuetracker.google.com/issues/37008170 - if (swipeRefreshLayout != null) { - swipeRefreshLayout.setRefreshing(false); - swipeRefreshLayout.destroyDrawingCache(); - swipeRefreshLayout.clearAnimation(); - } } /** @@ -2267,6 +2260,14 @@ public class MessageListFragment extends Fragment implements OnItemClickListener Timber.e(e, "Could not abort remote search before going back"); } } + + // Workaround for Android bug https://issuetracker.google.com/issues/37008170 + if (swipeRefreshLayout != null) { + swipeRefreshLayout.setRefreshing(false); + swipeRefreshLayout.destroyDrawingCache(); + swipeRefreshLayout.clearAnimation(); + } + super.onStop(); }