From 064242d9626121e9c498ec19a7e4755efcc4c76b Mon Sep 17 00:00:00 2001 From: Douile <25043847+Douile@users.noreply.github.com> Date: Mon, 3 Jan 2022 17:51:31 +0000 Subject: [PATCH] Remove unecessary interface InfoCallback Co-authored-by: Stypox Replace the unecessary callback interface InfoCallback in favour of the standard type Consumer --- .../org/schabi/newpipe/util/StreamDialogEntry.java | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) 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 a0539e9a8..d87a011b4 100644 --- a/app/src/main/java/org/schabi/newpipe/util/StreamDialogEntry.java +++ b/app/src/main/java/org/schabi/newpipe/util/StreamDialogEntry.java @@ -20,6 +20,7 @@ import org.schabi.newpipe.util.external_communication.ShareUtils; import java.util.Collections; import java.util.List; +import java.util.function.Consumer; import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers; import io.reactivex.rxjava3.schedulers.Schedulers; @@ -214,13 +215,9 @@ public enum StreamDialogEntry { // helper functions // ///////////////////////////////////////////// - private interface InfoCallback { - void onInfo(SinglePlayQueue item); - } - private static void fetchItemInfoIfSparse(final Fragment fragment, final StreamInfoItem item, - final InfoCallback callback) { + final Consumer callback) { if (!(item.getStreamType() == StreamType.LIVE_STREAM || item.getStreamType() == StreamType.AUDIO_LIVE_STREAM) && item.getDuration() < 0) { @@ -242,10 +239,10 @@ public enum StreamDialogEntry { throwable.toString())) .subscribe(); - callback.onInfo(new SinglePlayQueue(result)); + callback.accept(new SinglePlayQueue(result)); }, throwable -> Log.e("StreamDialogEntry", throwable.toString())); } else { - callback.onInfo(new SinglePlayQueue(item)); + callback.accept(new SinglePlayQueue(item)); } } }