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.
This commit is contained in:
cketti 2017-10-14 02:28:32 +02:00
parent 7c89108cea
commit 655e86b4f5

View file

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