Addendum to commit 534443d439 to cancel the callbacks so they're not called after the fragment is detached. Closes #357

main
Vavassor 7 years ago
parent 2b9f111ccf
commit d344f34ffb
  1. 9
      app/src/main/java/com/keylesspalace/tusky/fragment/ViewMediaFragment.java

@ -138,7 +138,7 @@ public class ViewMediaFragment extends BaseFragment {
@Override @Override
public void onError() { public void onError() {
// if there's no image in cache, load from network and start trnasition // if there's no image in cache, load from network and start transition
// immediately. // immediately.
photoActionsListener.onBringUp(); photoActionsListener.onBringUp();
@ -153,6 +153,13 @@ public class ViewMediaFragment extends BaseFragment {
return rootView; return rootView;
} }
@Override
public void onDetach() {
super.onDetach();
Picasso.with(getContext())
.cancelRequest(photoView);
}
private void loadImageFromNetwork(String url, ImageView photoView) { private void loadImageFromNetwork(String url, ImageView photoView) {
Picasso.with(getContext()) Picasso.with(getContext())
.load(url) .load(url)

Loading…
Cancel
Save