Remove unecessary interface InfoCallback

Co-authored-by: Stypox <stypox@pm.me>

Replace the unecessary callback interface InfoCallback in favour of the
standard type Consumer<SinglePlayQueue>
This commit is contained in:
Douile 2022-01-03 17:51:31 +00:00
parent 3ff00ff50e
commit 064242d962
No known key found for this signature in database
GPG key ID: DAB413485BA6CFFD

View file

@ -20,6 +20,7 @@ import org.schabi.newpipe.util.external_communication.ShareUtils;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.function.Consumer;
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers; import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
import io.reactivex.rxjava3.schedulers.Schedulers; import io.reactivex.rxjava3.schedulers.Schedulers;
@ -214,13 +215,9 @@ public enum StreamDialogEntry {
// helper functions // // helper functions //
///////////////////////////////////////////// /////////////////////////////////////////////
private interface InfoCallback {
void onInfo(SinglePlayQueue item);
}
private static void fetchItemInfoIfSparse(final Fragment fragment, private static void fetchItemInfoIfSparse(final Fragment fragment,
final StreamInfoItem item, final StreamInfoItem item,
final InfoCallback callback) { final Consumer<SinglePlayQueue> callback) {
if (!(item.getStreamType() == StreamType.LIVE_STREAM if (!(item.getStreamType() == StreamType.LIVE_STREAM
|| item.getStreamType() == StreamType.AUDIO_LIVE_STREAM) || item.getStreamType() == StreamType.AUDIO_LIVE_STREAM)
&& item.getDuration() < 0) { && item.getDuration() < 0) {
@ -242,10 +239,10 @@ public enum StreamDialogEntry {
throwable.toString())) throwable.toString()))
.subscribe(); .subscribe();
callback.onInfo(new SinglePlayQueue(result)); callback.accept(new SinglePlayQueue(result));
}, throwable -> Log.e("StreamDialogEntry", throwable.toString())); }, throwable -> Log.e("StreamDialogEntry", throwable.toString()));
} else { } else {
callback.onInfo(new SinglePlayQueue(item)); callback.accept(new SinglePlayQueue(item));
} }
} }
} }