diff --git a/app/src/main/java/de/danoeh/antennapod/adapter/QueueRecyclerAdapter.java b/app/src/main/java/de/danoeh/antennapod/adapter/QueueRecyclerAdapter.java index 062f883bc..8593e0dde 100644 --- a/app/src/main/java/de/danoeh/antennapod/adapter/QueueRecyclerAdapter.java +++ b/app/src/main/java/de/danoeh/antennapod/adapter/QueueRecyclerAdapter.java @@ -2,6 +2,7 @@ package de.danoeh.antennapod.adapter; import android.graphics.drawable.Drawable; import android.net.Uri; +import android.support.annotation.Nullable; import android.support.v4.view.MotionEventCompat; import android.support.v7.widget.PopupMenu; import android.support.v7.widget.RecyclerView; @@ -59,7 +60,7 @@ public class QueueRecyclerAdapter extends RecyclerView.Adapter { - position = pos; + selectedItem = item; return false; }); } - public int getItemCount() { - return itemAccess.getCount(); + @Nullable + public FeedItem getSelectedItem() { + return selectedItem; } - public int getPosition() { - return position; + public int getItemCount() { + return itemAccess.getCount(); } public class ViewHolder extends RecyclerView.ViewHolder diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/QueueFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/QueueFragment.java index 3c3f7f01c..0f900c369 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/QueueFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/QueueFragment.java @@ -327,11 +327,9 @@ public class QueueFragment extends Fragment { if(!isVisible()) { return false; } - int pos = recyclerAdapter.getPosition(); - FeedItem selectedItem = itemAccess.getItem(pos); - + FeedItem selectedItem = recyclerAdapter.getSelectedItem(); if (selectedItem == null) { - Log.i(TAG, "Selected item at position " + pos + " was null, ignoring selection"); + Log.i(TAG, "Selected item was null, ignoring selection"); return super.onContextItemSelected(item); }