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.
@@ -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();
}
