Fix warnings and allow moving only up and down even in grid

This commit is contained in:
Stypox 2024-03-30 14:36:31 +01:00
parent 3cc0205def
commit c9051d33c1
No known key found for this signature in database
GPG key ID: 4BDF1B40A49FDD23

View file

@ -1,7 +1,6 @@
package org.schabi.newpipe.local.bookmark; package org.schabi.newpipe.local.bookmark;
import static org.schabi.newpipe.local.bookmark.MergedPlaylistManager.getMergedOrderedPlaylists; import static org.schabi.newpipe.local.bookmark.MergedPlaylistManager.getMergedOrderedPlaylists;
import static org.schabi.newpipe.util.ThemeHelper.shouldUseGridLayout;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.os.Bundle; import android.os.Bundle;
@ -244,7 +243,7 @@ public final class BookmarkFragment extends BaseLocalListFragment<List<PlaylistL
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
private Subscriber<List<PlaylistLocalItem>> getPlaylistsSubscriber() { private Subscriber<List<PlaylistLocalItem>> getPlaylistsSubscriber() {
return new Subscriber<List<PlaylistLocalItem>>() { return new Subscriber<>() {
@Override @Override
public void onSubscribe(final Subscription s) { public void onSubscribe(final Subscription s) {
showLoading(); showLoading();
@ -276,7 +275,6 @@ public final class BookmarkFragment extends BaseLocalListFragment<List<PlaylistL
@Override @Override
public void onComplete() { public void onComplete() {
// Do nothing.
} }
}; };
} }
@ -418,11 +416,9 @@ public final class BookmarkFragment extends BaseLocalListFragment<List<PlaylistL
} }
private ItemTouchHelper.SimpleCallback getItemTouchCallback() { private ItemTouchHelper.SimpleCallback getItemTouchCallback() {
int directions = ItemTouchHelper.UP | ItemTouchHelper.DOWN; // if adding grid layout, also include ItemTouchHelper.LEFT | ItemTouchHelper.RIGHT
if (shouldUseGridLayout(requireContext())) { // with an `if (shouldUseGridLayout()) ...`
directions |= ItemTouchHelper.LEFT | ItemTouchHelper.RIGHT; return new ItemTouchHelper.SimpleCallback(ItemTouchHelper.UP | ItemTouchHelper.DOWN,
}
return new ItemTouchHelper.SimpleCallback(directions,
ItemTouchHelper.ACTION_STATE_IDLE) { ItemTouchHelper.ACTION_STATE_IDLE) {
@Override @Override
public int interpolateOutOfBoundsScroll(@NonNull final RecyclerView recyclerView, public int interpolateOutOfBoundsScroll(@NonNull final RecyclerView recyclerView,