Merge pull request #6110 from ByteHamster/fix-drag
Initialize swipe actions before using them
This commit is contained in:
commit
18e5e89d12
|
@ -456,6 +456,10 @@ public class QueueFragment extends Fragment implements MaterialToolbar.OnMenuIte
|
||||||
registerForContextMenu(recyclerView);
|
registerForContextMenu(recyclerView);
|
||||||
recyclerView.addOnScrollListener(new LiftOnScrollListener(root.findViewById(R.id.appbar)));
|
recyclerView.addOnScrollListener(new LiftOnScrollListener(root.findViewById(R.id.appbar)));
|
||||||
|
|
||||||
|
swipeActions = new QueueSwipeActions();
|
||||||
|
swipeActions.setFilter(new FeedItemFilter(FeedItemFilter.QUEUED));
|
||||||
|
swipeActions.attachTo(recyclerView);
|
||||||
|
|
||||||
recyclerAdapter = new QueueRecyclerAdapter((MainActivity) getActivity(), swipeActions) {
|
recyclerAdapter = new QueueRecyclerAdapter((MainActivity) getActivity(), swipeActions) {
|
||||||
@Override
|
@Override
|
||||||
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
|
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
|
||||||
|
@ -475,10 +479,6 @@ public class QueueFragment extends Fragment implements MaterialToolbar.OnMenuIte
|
||||||
getResources().getInteger(R.integer.swipe_to_refresh_duration_in_ms));
|
getResources().getInteger(R.integer.swipe_to_refresh_duration_in_ms));
|
||||||
});
|
});
|
||||||
|
|
||||||
swipeActions = new QueueSwipeActions();
|
|
||||||
swipeActions.setFilter(new FeedItemFilter(FeedItemFilter.QUEUED));
|
|
||||||
swipeActions.attachTo(recyclerView);
|
|
||||||
|
|
||||||
emptyView = new EmptyViewHandler(getContext());
|
emptyView = new EmptyViewHandler(getContext());
|
||||||
emptyView.attachToRecyclerView(recyclerView);
|
emptyView.attachToRecyclerView(recyclerView);
|
||||||
emptyView.setIcon(R.drawable.ic_playlist_play);
|
emptyView.setIcon(R.drawable.ic_playlist_play);
|
||||||
|
@ -608,7 +608,7 @@ public class QueueFragment extends Fragment implements MaterialToolbar.OnMenuIte
|
||||||
int from = viewHolder.getBindingAdapterPosition();
|
int from = viewHolder.getBindingAdapterPosition();
|
||||||
int to = target.getBindingAdapterPosition();
|
int to = target.getBindingAdapterPosition();
|
||||||
Log.d(TAG, "move(" + from + ", " + to + ") in memory");
|
Log.d(TAG, "move(" + from + ", " + to + ") in memory");
|
||||||
if (from >= queue.size() || to >= queue.size() || from < 0 || to < 0) {
|
if (queue == null || from >= queue.size() || to >= queue.size() || from < 0 || to < 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
queue.add(to, queue.remove(from));
|
queue.add(to, queue.remove(from));
|
||||||
|
|
Loading…
Reference in New Issue