Fix dragging

This commit is contained in:
Martin Fietz 2015-11-06 00:43:19 +01:00
parent 419e449b6f
commit 896366a625
1 changed files with 3 additions and 2 deletions

View File

@ -173,7 +173,6 @@ public class QueueFragment extends Fragment {
public void onEventMainThread(FeedItemEvent event) {
Log.d(TAG, "onEvent(" + event + ")");
IntList positions = new IntList();
for(int i=0, size = event.items.size(); i < size; i++) {
FeedItem item = event.items.get(i);
int pos = FeedItemUtil.indexOfItemWithId(queue, item.getId());
@ -367,7 +366,9 @@ public class QueueFragment extends Fragment {
int from = viewHolder.getAdapterPosition();
int to = target.getAdapterPosition();
Log.d(TAG, "move(" + from + ", " + to + ")");
DBWriter.moveQueueItem(from, to, true);
Collections.swap(queue, from, to);
recyclerAdapter.notifyItemMoved(from, to);
DBWriter.moveQueueItem(from, to, false);
return true;
}