Create new adapter to show single item after undo

This commit is contained in:
Martin Fietz 2019-04-06 16:28:07 +02:00
parent 4797d3ae56
commit 6c3033409d
1 changed files with 12 additions and 11 deletions

View File

@ -506,19 +506,20 @@ public class QueueFragment extends Fragment {
}
private void onFragmentLoaded(final boolean restoreScrollPosition) {
if (recyclerAdapter == null) {
MainActivity activity = (MainActivity) getActivity();
recyclerAdapter = new QueueRecyclerAdapter(activity, itemAccess,
new DefaultActionButtonCallback(activity), itemTouchHelper);
recyclerAdapter.setHasStableIds(true);
recyclerView.setAdapter(recyclerAdapter);
}
if(queue == null || queue.size() == 0) {
recyclerView.setVisibility(View.GONE);
emptyView.setVisibility(View.VISIBLE);
} else {
if (queue != null && queue.size() > 0) {
if (recyclerAdapter == null) {
MainActivity activity = (MainActivity) getActivity();
recyclerAdapter = new QueueRecyclerAdapter(activity, itemAccess,
new DefaultActionButtonCallback(activity), itemTouchHelper);
recyclerAdapter.setHasStableIds(true);
recyclerView.setAdapter(recyclerAdapter);
}
emptyView.setVisibility(View.GONE);
recyclerView.setVisibility(View.VISIBLE);
} else {
recyclerAdapter = null;
recyclerView.setVisibility(View.GONE);
emptyView.setVisibility(View.VISIBLE);
}
if (restoreScrollPosition) {