GC and recreate queue adapter

This commit is contained in:
Martin Fietz 2015-11-06 21:48:31 +01:00
parent 8c546df054
commit 5380bcd6d0
1 changed files with 10 additions and 11 deletions

View File

@ -107,14 +107,6 @@ public class QueueFragment extends Fragment {
setHasOptionsMenu(true);
}
@Override
public void onResume() {
super.onResume();
loadItems();
EventDistributor.getInstance().register(contentUpdate);
EventBus.getDefault().register(this);
}
@Override
public void onStart() {
super.onStart();
@ -127,6 +119,15 @@ public class QueueFragment extends Fragment {
}
}
@Override
public void onResume() {
super.onResume();
recyclerView.setAdapter(recyclerAdapter);
loadItems();
EventDistributor.getInstance().register(contentUpdate);
EventBus.getDefault().register(this);
}
@Override
public void onPause() {
super.onPause();
@ -217,6 +218,7 @@ public class QueueFragment extends Fragment {
}
private void resetViewState() {
recyclerAdapter = null;
blockDownloadObserverUpdate = false;
if (downloadObserver != null) {
downloadObserver.onPause();
@ -552,9 +554,6 @@ public class QueueFragment extends Fragment {
progLoading.setVisibility(View.GONE);
queue = items;
onFragmentLoaded();
if(recyclerAdapter != null) {
recyclerAdapter.notifyDataSetChanged();
}
}
}, error -> {
Log.e(TAG, Log.getStackTraceString(error));