mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2024-12-11 19:29:25 +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;
|
package org.schabi.newpipe.local.dialog;
|
||||||
|
|
||||||
import android.app.AlertDialog;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@ -177,20 +176,15 @@ public final class PlaylistAppendDialog extends PlaylistDialog {
|
|||||||
@NonNull final PlaylistMetadataEntry playlist,
|
@NonNull final PlaylistMetadataEntry playlist,
|
||||||
@NonNull final List<StreamEntity> streams) {
|
@NonNull final List<StreamEntity> streams) {
|
||||||
|
|
||||||
final int numberOfDuplicates = manager.getPlaylistDuplicateCount(playlist.uid,
|
final int numOfDuplicates = manager.getPlaylistDuplicateCount(playlist.uid,
|
||||||
streams.get(0).getUrl()).blockingFirst();
|
streams.get(0).getUrl()).blockingFirst();
|
||||||
if (numberOfDuplicates > 0) {
|
String toastText = getString(R.string.playlist_add_stream_success);
|
||||||
createDuplicateDialog(numberOfDuplicates, manager, playlist, streams);
|
|
||||||
} else {
|
|
||||||
addStreamToPlaylist(manager, playlist, streams);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void addStreamToPlaylist(@NonNull final LocalPlaylistManager manager,
|
if (numOfDuplicates > 0) {
|
||||||
@NonNull final PlaylistMetadataEntry playlist,
|
toastText = getString(R.string.playlist_add_stream_success_duplicate);
|
||||||
@NonNull final List<StreamEntity> streams) {
|
}
|
||||||
final Toast successToast = Toast.makeText(getContext(),
|
|
||||||
R.string.playlist_add_stream_success, Toast.LENGTH_SHORT);
|
final Toast successToast = Toast.makeText(getContext(), toastText, Toast.LENGTH_SHORT);
|
||||||
|
|
||||||
if (playlist.thumbnailUrl
|
if (playlist.thumbnailUrl
|
||||||
.equals("drawable://" + R.drawable.placeholder_thumbnail_playlist)) {
|
.equals("drawable://" + R.drawable.placeholder_thumbnail_playlist)) {
|
||||||
@ -206,21 +200,4 @@ public final class PlaylistAppendDialog extends PlaylistDialog {
|
|||||||
|
|
||||||
requireDialog().dismiss();
|
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="delete_playlist_prompt">Delete this playlist\?</string>
|
||||||
<string name="playlist_creation_success">Playlist created</string>
|
<string name="playlist_creation_success">Playlist created</string>
|
||||||
<string name="playlist_add_stream_success">Playlisted</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_thumbnail_change_success">Playlist thumbnail changed.</string>
|
||||||
<string name="playlist_no_uploader">Auto-generated (no uploader found)</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 -->
|
<!-- Players -->
|
||||||
<string name="caption_none">No Captions</string>
|
<string name="caption_none">No Captions</string>
|
||||||
<string name="resize_fit">Fit</string>
|
<string name="resize_fit">Fit</string>
|
||||||
|
Loading…
Reference in New Issue
Block a user