1
0
mirror of https://github.com/TeamNewPipe/NewPipe synced 2024-12-23 16:40:32 +00:00

refactore some more lambda functions

This commit is contained in:
Christian Schabesberger 2018-01-20 15:24:45 +01:00
parent 677865f347
commit 86eccf219d

View File

@ -124,20 +124,12 @@ public abstract class BaseListInfoFragment<I extends ListInfo> extends BaseListF
currentWorker = loadResult(forceLoad) currentWorker = loadResult(forceLoad)
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribe(new Consumer<I>() { .subscribe((@NonNull I result) -> {
@Override isLoading.set(false);
public void accept(@NonNull I result) throws Exception { currentInfo = result;
isLoading.set(false); currentNextItemsUrl = result.next_streams_url;
currentInfo = result; handleResult(result);
currentNextItemsUrl = result.next_streams_url; }, (@NonNull Throwable throwable) -> onError(throwable));
handleResult(result);
}
}, new Consumer<Throwable>() {
@Override
public void accept(@NonNull Throwable throwable) throws Exception {
onError(throwable);
}
});
} }
/** /**
@ -153,18 +145,12 @@ public abstract class BaseListInfoFragment<I extends ListInfo> extends BaseListF
currentWorker = loadMoreItemsLogic() currentWorker = loadMoreItemsLogic()
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribe(new Consumer<ListExtractor.NextItemsResult>() { .subscribe((@io.reactivex.annotations.NonNull ListExtractor.NextItemsResult nextItemsResult) -> {
@Override isLoading.set(false);
public void accept(@io.reactivex.annotations.NonNull ListExtractor.NextItemsResult nextItemsResult) throws Exception { handleNextItems(nextItemsResult);
isLoading.set(false); }, (@io.reactivex.annotations.NonNull Throwable throwable) -> {
handleNextItems(nextItemsResult); isLoading.set(false);
} onError(throwable);
}, new Consumer<Throwable>() {
@Override
public void accept(@io.reactivex.annotations.NonNull Throwable throwable) throws Exception {
isLoading.set(false);
onError(throwable);
}
}); });
} }