refactore some more lambda functions

This commit is contained in:
Christian Schabesberger 2018-01-20 15:24:45 +01:00
parent 677865f347
commit 86eccf219d
1 changed files with 12 additions and 26 deletions

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
public void accept(@NonNull I result) throws Exception {
isLoading.set(false); isLoading.set(false);
currentInfo = result; currentInfo = result;
currentNextItemsUrl = result.next_streams_url; currentNextItemsUrl = result.next_streams_url;
handleResult(result); handleResult(result);
} }, (@NonNull Throwable throwable) -> onError(throwable));
}, 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
public void accept(@io.reactivex.annotations.NonNull ListExtractor.NextItemsResult nextItemsResult) throws Exception {
isLoading.set(false); isLoading.set(false);
handleNextItems(nextItemsResult); handleNextItems(nextItemsResult);
} }, (@io.reactivex.annotations.NonNull Throwable throwable) -> {
}, new Consumer<Throwable>() {
@Override
public void accept(@io.reactivex.annotations.NonNull Throwable throwable) throws Exception {
isLoading.set(false); isLoading.set(false);
onError(throwable); onError(throwable);
}
}); });
} }