mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2024-12-03 15:31:02 +01:00
Removed the duplicate dialog and added another toast option
This commit is contained in:
parent
8b6e110635
commit
5fb7b3266b
@ -1,6 +1,5 @@
|
||||
package org.schabi.newpipe.local.dialog;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
@ -177,20 +176,15 @@ public final class PlaylistAppendDialog extends PlaylistDialog {
|
||||
@NonNull final PlaylistMetadataEntry playlist,
|
||||
@NonNull final List<StreamEntity> streams) {
|
||||
|
||||
final int numberOfDuplicates = manager.getPlaylistDuplicateCount(playlist.uid,
|
||||
streams.get(0).getUrl()).blockingFirst();
|
||||
if (numberOfDuplicates > 0) {
|
||||
createDuplicateDialog(numberOfDuplicates, manager, playlist, streams);
|
||||
} else {
|
||||
addStreamToPlaylist(manager, playlist, streams);
|
||||
}
|
||||
}
|
||||
final int numOfDuplicates = manager.getPlaylistDuplicateCount(playlist.uid,
|
||||
streams.get(0).getUrl()).blockingFirst();
|
||||
String toastText = getString(R.string.playlist_add_stream_success);
|
||||
|
||||
private void addStreamToPlaylist(@NonNull final LocalPlaylistManager manager,
|
||||
@NonNull final PlaylistMetadataEntry playlist,
|
||||
@NonNull final List<StreamEntity> streams) {
|
||||
final Toast successToast = Toast.makeText(getContext(),
|
||||
R.string.playlist_add_stream_success, Toast.LENGTH_SHORT);
|
||||
if (numOfDuplicates > 0) {
|
||||
toastText = getString(R.string.playlist_add_stream_success_duplicate);
|
||||
}
|
||||
|
||||
final Toast successToast = Toast.makeText(getContext(), toastText, Toast.LENGTH_SHORT);
|
||||
|
||||
if (playlist.thumbnailUrl
|
||||
.equals("drawable://" + R.drawable.placeholder_thumbnail_playlist)) {
|
||||
@ -206,21 +200,4 @@ public final class PlaylistAppendDialog extends PlaylistDialog {
|
||||
|
||||
requireDialog().dismiss();
|
||||
}
|
||||
|
||||
private void createDuplicateDialog(final int numberOfDuplicates,
|
||||
@NonNull final LocalPlaylistManager manager,
|
||||
@NonNull final PlaylistMetadataEntry playlist,
|
||||
@NonNull final List<StreamEntity> streams) {
|
||||
final AlertDialog.Builder builder = new AlertDialog.Builder(this.getActivity());
|
||||
builder.setTitle(R.string.duplicate_stream_in_playlist_title);
|
||||
builder.setMessage(getString(R.string.duplicate_stream_in_playlist_description,
|
||||
numberOfDuplicates));
|
||||
|
||||
builder.setPositiveButton(android.R.string.yes, (dialog, i) -> {
|
||||
addStreamToPlaylist(manager, playlist, streams);
|
||||
});
|
||||
builder.setNeutralButton(R.string.cancel, null);
|
||||
|
||||
builder.create().show();
|
||||
}
|
||||
}
|
||||
|
@ -446,11 +446,9 @@
|
||||
<string name="delete_playlist_prompt">Delete this playlist\?</string>
|
||||
<string name="playlist_creation_success">Playlist created</string>
|
||||
<string name="playlist_add_stream_success">Playlisted</string>
|
||||
<string name="playlist_add_stream_success_duplicate">Playlisted duplicate</string>
|
||||
<string name="playlist_thumbnail_change_success">Playlist thumbnail changed.</string>
|
||||
<string name="playlist_no_uploader">Auto-generated (no uploader found)</string>
|
||||
<string name="duplicate_stream_in_playlist_title">Duplicated Video Found</string>
|
||||
<string name="duplicate_stream_in_playlist_description">The playlist contains this stream
|
||||
already %d time(s).\nDo you want to add it one more time?</string>
|
||||
<!-- Players -->
|
||||
<string name="caption_none">No Captions</string>
|
||||
<string name="resize_fit">Fit</string>
|
||||
|
Loading…
Reference in New Issue
Block a user