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);
|
final PlaylistAppendDialog d = PlaylistAppendDialog.fromStreamInfo(currentInfo);
|
||||||
disposables.add(
|
disposables.add(
|
||||||
PlaylistAppendDialog.checkPlaylists(getContext(),
|
PlaylistAppendDialog.onPlaylistFound(getContext(),
|
||||||
() -> d.show(getFM(), TAG),
|
() -> d.show(getFM(), TAG),
|
||||||
() -> PlaylistCreationDialog.newInstance(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();
|
private CompositeDisposable playlistDisposables = new CompositeDisposable();
|
||||||
|
|
||||||
public static Disposable checkPlaylists(
|
public static Disposable onPlaylistFound(
|
||||||
final Context context, final Invoker onSuccess, final Invoker onFailed
|
final Context context, final Runnable onSuccess, final Runnable onFailed
|
||||||
) {
|
) {
|
||||||
final LocalPlaylistManager playlistManager =
|
final LocalPlaylistManager playlistManager =
|
||||||
new LocalPlaylistManager(NewPipeDatabase.getInstance(context));
|
new LocalPlaylistManager(NewPipeDatabase.getInstance(context));
|
||||||
|
@ -50,17 +50,13 @@ public final class PlaylistAppendDialog extends PlaylistDialog {
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.subscribe(hasPlaylists -> {
|
.subscribe(hasPlaylists -> {
|
||||||
if (hasPlaylists) {
|
if (hasPlaylists) {
|
||||||
onSuccess.invoke();
|
onSuccess.run();
|
||||||
} else {
|
} else {
|
||||||
onFailed.invoke();
|
onFailed.run();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface Invoker {
|
|
||||||
void invoke();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static PlaylistAppendDialog fromStreamInfo(final StreamInfo info) {
|
public static PlaylistAppendDialog fromStreamInfo(final StreamInfo info) {
|
||||||
final PlaylistAppendDialog dialog = new PlaylistAppendDialog();
|
final PlaylistAppendDialog dialog = new PlaylistAppendDialog();
|
||||||
dialog.setInfo(Collections.singletonList(new StreamEntity(info)));
|
dialog.setInfo(Collections.singletonList(new StreamEntity(info)));
|
||||||
|
|
|
@ -574,7 +574,7 @@ public abstract class ServicePlayerActivity extends AppCompatActivity
|
||||||
private void openPlaylistAppendDialog(final List<PlayQueueItem> playlist) {
|
private void openPlaylistAppendDialog(final List<PlayQueueItem> playlist) {
|
||||||
final PlaylistAppendDialog d = PlaylistAppendDialog.fromPlayQueueItems(playlist);
|
final PlaylistAppendDialog d = PlaylistAppendDialog.fromPlayQueueItems(playlist);
|
||||||
|
|
||||||
PlaylistAppendDialog.checkPlaylists(getApplicationContext(),
|
PlaylistAppendDialog.onPlaylistFound(getApplicationContext(),
|
||||||
() -> d.show(getSupportFragmentManager(), getTag()),
|
() -> d.show(getSupportFragmentManager(), getTag()),
|
||||||
() -> PlaylistCreationDialog.newInstance(d)
|
() -> PlaylistCreationDialog.newInstance(d)
|
||||||
.show(getSupportFragmentManager(), getTag()
|
.show(getSupportFragmentManager(), getTag()
|
||||||
|
|
|
@ -62,7 +62,7 @@ public enum StreamDialogEntry {
|
||||||
final PlaylistAppendDialog d = PlaylistAppendDialog
|
final PlaylistAppendDialog d = PlaylistAppendDialog
|
||||||
.fromStreamInfoItems(Collections.singletonList(item));
|
.fromStreamInfoItems(Collections.singletonList(item));
|
||||||
|
|
||||||
PlaylistAppendDialog.checkPlaylists(fragment.getContext(),
|
PlaylistAppendDialog.onPlaylistFound(fragment.getContext(),
|
||||||
() -> d.show(fragment.getFragmentManager(), "StreamDialogEntry@append_playlist"),
|
() -> d.show(fragment.getFragmentManager(), "StreamDialogEntry@append_playlist"),
|
||||||
() -> PlaylistCreationDialog.newInstance(d)
|
() -> PlaylistCreationDialog.newInstance(d)
|
||||||
.show(fragment.getFragmentManager(), "StreamDialogEntry@create_playlist")
|
.show(fragment.getFragmentManager(), "StreamDialogEntry@create_playlist")
|
||||||
|
|
Loading…
Reference in New Issue