Added the duplicate indicator explanation & removed some unnecessary functions
This commit is contained in:
parent
ef4a6238c8
commit
c70ce791db
|
@ -11,7 +11,6 @@ import androidx.recyclerview.widget.GridLayoutManager;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
import org.schabi.newpipe.database.LocalItem;
|
import org.schabi.newpipe.database.LocalItem;
|
||||||
import org.schabi.newpipe.database.playlist.PlaylistMetadataEntry;
|
|
||||||
import org.schabi.newpipe.database.stream.model.StreamStateEntity;
|
import org.schabi.newpipe.database.stream.model.StreamStateEntity;
|
||||||
import org.schabi.newpipe.local.history.HistoryRecordManager;
|
import org.schabi.newpipe.local.history.HistoryRecordManager;
|
||||||
import org.schabi.newpipe.local.holder.LocalItemHolder;
|
import org.schabi.newpipe.local.holder.LocalItemHolder;
|
||||||
|
@ -345,16 +344,6 @@ public class LocalItemListAdapter extends RecyclerView.Adapter<RecyclerView.View
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getItemId(final int position) {
|
|
||||||
final LocalItem item = localItems.get(position);
|
|
||||||
if (item != null && item.getLocalItemType() == LocalItem.LocalItemType.
|
|
||||||
PLAYLIST_LOCAL_ITEM) {
|
|
||||||
return ((PlaylistMetadataEntry) item).uid;
|
|
||||||
}
|
|
||||||
return super.getItemId(position);
|
|
||||||
}
|
|
||||||
|
|
||||||
public GridLayoutManager.SpanSizeLookup getSpanSizeLookup(final int spanCount) {
|
public GridLayoutManager.SpanSizeLookup getSpanSizeLookup(final int spanCount) {
|
||||||
return new GridLayoutManager.SpanSizeLookup() {
|
return new GridLayoutManager.SpanSizeLookup() {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -61,7 +61,6 @@ public final class PlaylistAppendDialog extends PlaylistDialog {
|
||||||
new LocalPlaylistManager(NewPipeDatabase.getInstance(requireContext()));
|
new LocalPlaylistManager(NewPipeDatabase.getInstance(requireContext()));
|
||||||
|
|
||||||
playlistAdapter = new LocalItemListAdapter(getActivity());
|
playlistAdapter = new LocalItemListAdapter(getActivity());
|
||||||
playlistAdapter.setHasStableIds(true);
|
|
||||||
playlistAdapter.setSelectedListener(selectedItem -> {
|
playlistAdapter.setSelectedListener(selectedItem -> {
|
||||||
final List<StreamEntity> entities = getStreamEntities();
|
final List<StreamEntity> entities = getStreamEntities();
|
||||||
if (selectedItem instanceof PlaylistDuplicatesEntry && entities != null) {
|
if (selectedItem instanceof PlaylistDuplicatesEntry && entities != null) {
|
||||||
|
@ -125,8 +124,20 @@ public final class PlaylistAppendDialog extends PlaylistDialog {
|
||||||
playlistAdapter.clearStreamItemList();
|
playlistAdapter.clearStreamItemList();
|
||||||
playlistAdapter.addItems(playlists);
|
playlistAdapter.addItems(playlists);
|
||||||
playlistRecyclerView.setVisibility(View.VISIBLE);
|
playlistRecyclerView.setVisibility(View.VISIBLE);
|
||||||
|
setDuplicateIndicatorExplanation(playlists);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private void setDuplicateIndicatorExplanation(final List<PlaylistDuplicatesEntry> playlists) {
|
||||||
|
for (final PlaylistDuplicatesEntry entry : playlists) {
|
||||||
|
if (entry.timesStreamIsContained > 0) {
|
||||||
|
final View indicatorExplanation = getView()
|
||||||
|
.findViewById(R.id.playlist_duplicate);
|
||||||
|
indicatorExplanation.setVisibility(View.VISIBLE);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private void onPlaylistSelected(@NonNull final LocalPlaylistManager manager,
|
private void onPlaylistSelected(@NonNull final LocalPlaylistManager manager,
|
||||||
@NonNull final PlaylistDuplicatesEntry playlist,
|
@NonNull final PlaylistDuplicatesEntry playlist,
|
||||||
|
|
Loading…
Reference in New Issue