We do all the moving ourselves, no need to react on it

This commit is contained in:
Martin Fietz 2015-11-23 21:29:02 +01:00
parent 24d0efad1e
commit f12362c776
2 changed files with 15 additions and 19 deletions

View File

@ -162,14 +162,6 @@ public class QueueFragment extends Fragment {
recyclerAdapter.notifyDataSetChanged();
break;
case MOVED:
int from = FeedItemUtil.indexOfItemWithId(queue, event.item.getId());
int to = event.position;
if(from != to) {
queue.add(to, queue.remove(from));
recyclerAdapter.notifyItemMoved(from, to);
} else {
// QueueFragment itself sent the event and already moved the item
}
break;
}
onFragmentLoaded();
@ -331,12 +323,21 @@ public class QueueFragment extends Fragment {
return super.onContextItemSelected(item);
}
try {
return FeedItemMenuHandler.onMenuItemClicked(getActivity(), item.getItemId(), selectedItem);
} catch (DownloadRequestException e) {
e.printStackTrace();
Toast.makeText(getActivity(), e.getMessage(), Toast.LENGTH_LONG).show();
return true;
switch(item.getItemId()) {
case R.id.move_to_top_item:
DBWriter.moveQueueItemToTop(selectedItem.getId(), true);
return true;
case R.id.move_to_bottom_item:
DBWriter.moveQueueItemToBottom(selectedItem.getId(), true);
return true;
default:
try {
return FeedItemMenuHandler.onMenuItemClicked(getActivity(), item.getItemId(), selectedItem);
} catch (DownloadRequestException e) {
e.printStackTrace();
Toast.makeText(getActivity(), e.getMessage(), Toast.LENGTH_LONG).show();
return true;
}
}
}

View File

@ -186,11 +186,6 @@ public class FeedItemMenuHandler {
GpodnetPreferences.enqueueEpisodeAction(actionNew);
}
break;
case R.id.move_to_top_item:
DBWriter.moveQueueItemToTop(selectedItem.getId(), true);
return true;
case R.id.move_to_bottom_item:
DBWriter.moveQueueItemToBottom(selectedItem.getId(), true);
case R.id.add_to_queue_item:
DBWriter.addQueueItem(context, selectedItem);
break;