mirror of
https://github.com/TeamNewPipe/NewPipe.git
synced 2024-11-22 02:53:09 +01:00
Fix PlaylistAppendDialog: Renamed method and replaced with Runnable
This commit is contained in:
parent
2680d41a3d
commit
32a142bf79
@ -486,7 +486,7 @@ public class VideoDetailFragment
|
||||
|
||||
final PlaylistAppendDialog d = PlaylistAppendDialog.fromStreamInfo(currentInfo);
|
||||
disposables.add(
|
||||
PlaylistAppendDialog.checkPlaylists(getContext(),
|
||||
PlaylistAppendDialog.onPlaylistFound(getContext(),
|
||||
() -> d.show(getFM(), TAG),
|
||||
() -> PlaylistCreationDialog.newInstance(d).show(getFM(), TAG)
|
||||
)
|
||||
|
@ -40,8 +40,8 @@ public final class PlaylistAppendDialog extends PlaylistDialog {
|
||||
|
||||
private CompositeDisposable playlistDisposables = new CompositeDisposable();
|
||||
|
||||
public static Disposable checkPlaylists(
|
||||
final Context context, final Invoker onSuccess, final Invoker onFailed
|
||||
public static Disposable onPlaylistFound(
|
||||
final Context context, final Runnable onSuccess, final Runnable onFailed
|
||||
) {
|
||||
final LocalPlaylistManager playlistManager =
|
||||
new LocalPlaylistManager(NewPipeDatabase.getInstance(context));
|
||||
@ -50,17 +50,13 @@ public final class PlaylistAppendDialog extends PlaylistDialog {
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(hasPlaylists -> {
|
||||
if (hasPlaylists) {
|
||||
onSuccess.invoke();
|
||||
onSuccess.run();
|
||||
} else {
|
||||
onFailed.invoke();
|
||||
onFailed.run();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public interface Invoker {
|
||||
void invoke();
|
||||
}
|
||||
|
||||
public static PlaylistAppendDialog fromStreamInfo(final StreamInfo info) {
|
||||
final PlaylistAppendDialog dialog = new PlaylistAppendDialog();
|
||||
dialog.setInfo(Collections.singletonList(new StreamEntity(info)));
|
||||
|
@ -574,7 +574,7 @@ public abstract class ServicePlayerActivity extends AppCompatActivity
|
||||
private void openPlaylistAppendDialog(final List<PlayQueueItem> playlist) {
|
||||
final PlaylistAppendDialog d = PlaylistAppendDialog.fromPlayQueueItems(playlist);
|
||||
|
||||
PlaylistAppendDialog.checkPlaylists(getApplicationContext(),
|
||||
PlaylistAppendDialog.onPlaylistFound(getApplicationContext(),
|
||||
() -> d.show(getSupportFragmentManager(), getTag()),
|
||||
() -> PlaylistCreationDialog.newInstance(d)
|
||||
.show(getSupportFragmentManager(), getTag()
|
||||
|
@ -62,7 +62,7 @@ public enum StreamDialogEntry {
|
||||
final PlaylistAppendDialog d = PlaylistAppendDialog
|
||||
.fromStreamInfoItems(Collections.singletonList(item));
|
||||
|
||||
PlaylistAppendDialog.checkPlaylists(fragment.getContext(),
|
||||
PlaylistAppendDialog.onPlaylistFound(fragment.getContext(),
|
||||
() -> d.show(fragment.getFragmentManager(), "StreamDialogEntry@append_playlist"),
|
||||
() -> PlaylistCreationDialog.newInstance(d)
|
||||
.show(fragment.getFragmentManager(), "StreamDialogEntry@create_playlist")
|
||||
|
Loading…
Reference in New Issue
Block a user