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
1 changed files with 4 additions and 7 deletions

View File

@ -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<SinglePlayQueue> 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));
}
}
}