summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorByteHamster <ByteHamster@users.noreply.github.com>2022-10-02 11:54:44 +0200
committerGitHub <noreply@github.com>2022-10-02 11:54:44 +0200
commit18e5e89d12c4040474940de0362667b4b3d081d8 (patch)
tree0951a66057886822391927f17015d4aca5f3b63c
parentf1381a93582774280f03876e704034aa6de11bb2 (diff)
parent0aa50b8d23b6eb6c46a6d41dd3bd744c075ffbb9 (diff)
downloadAntennaPod-18e5e89d12c4040474940de0362667b4b3d081d8.zip
Merge pull request #6110 from ByteHamster/fix-drag
Initialize swipe actions before using them
-rw-r--r--app/src/main/java/de/danoeh/antennapod/fragment/QueueFragment.java10
1 files changed, 5 insertions, 5 deletions
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 c54374059..6cc914cd6 100644
--- a/app/src/main/java/de/danoeh/antennapod/fragment/QueueFragment.java
+++ b/app/src/main/java/de/danoeh/antennapod/fragment/QueueFragment.java
@@ -456,6 +456,10 @@ public class QueueFragment extends Fragment implements MaterialToolbar.OnMenuIte
registerForContextMenu(recyclerView);
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) {
@Override
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));
});
- swipeActions = new QueueSwipeActions();
- swipeActions.setFilter(new FeedItemFilter(FeedItemFilter.QUEUED));
- swipeActions.attachTo(recyclerView);
-
emptyView = new EmptyViewHandler(getContext());
emptyView.attachToRecyclerView(recyclerView);
emptyView.setIcon(R.drawable.ic_playlist_play);
@@ -608,7 +608,7 @@ public class QueueFragment extends Fragment implements MaterialToolbar.OnMenuIte
int from = viewHolder.getBindingAdapterPosition();
int to = target.getBindingAdapterPosition();
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;
}
queue.add(to, queue.remove(from));