diff --git a/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java b/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java index 463a264e1..801bc4293 100644 --- a/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java +++ b/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java @@ -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) ) diff --git a/app/src/main/java/org/schabi/newpipe/local/dialog/PlaylistAppendDialog.java b/app/src/main/java/org/schabi/newpipe/local/dialog/PlaylistAppendDialog.java index 800ec427e..7a63bee30 100644 --- a/app/src/main/java/org/schabi/newpipe/local/dialog/PlaylistAppendDialog.java +++ b/app/src/main/java/org/schabi/newpipe/local/dialog/PlaylistAppendDialog.java @@ -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))); diff --git a/app/src/main/java/org/schabi/newpipe/player/ServicePlayerActivity.java b/app/src/main/java/org/schabi/newpipe/player/ServicePlayerActivity.java index 7e8b50419..72f56cb1b 100644 --- a/app/src/main/java/org/schabi/newpipe/player/ServicePlayerActivity.java +++ b/app/src/main/java/org/schabi/newpipe/player/ServicePlayerActivity.java @@ -574,7 +574,7 @@ public abstract class ServicePlayerActivity extends AppCompatActivity private void openPlaylistAppendDialog(final List playlist) { final PlaylistAppendDialog d = PlaylistAppendDialog.fromPlayQueueItems(playlist); - PlaylistAppendDialog.checkPlaylists(getApplicationContext(), + PlaylistAppendDialog.onPlaylistFound(getApplicationContext(), () -> d.show(getSupportFragmentManager(), getTag()), () -> PlaylistCreationDialog.newInstance(d) .show(getSupportFragmentManager(), getTag() diff --git a/app/src/main/java/org/schabi/newpipe/util/StreamDialogEntry.java b/app/src/main/java/org/schabi/newpipe/util/StreamDialogEntry.java index 80233c5c3..34ff637ad 100644 --- a/app/src/main/java/org/schabi/newpipe/util/StreamDialogEntry.java +++ b/app/src/main/java/org/schabi/newpipe/util/StreamDialogEntry.java @@ -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")