mirror of
https://github.com/AntennaPod/AntennaPod.git
synced 2025-01-31 10:54:50 +01:00
RxJava defer -> fromCallable
This commit is contained in:
parent
6bf4d28c34
commit
cc00d03bf0
@ -772,7 +772,7 @@ public class AudioplayerActivity extends MediaplayerActivity implements ItemDesc
|
||||
private DBReader.NavDrawerData navDrawerData;
|
||||
|
||||
private void loadData() {
|
||||
subscription = Observable.defer(() -> Observable.just(DBReader.getNavDrawerData()))
|
||||
subscription = Observable.fromCallable(() -> DBReader.getNavDrawerData())
|
||||
.subscribeOn(Schedulers.newThread())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(result -> {
|
||||
|
@ -636,7 +636,7 @@ public class MainActivity extends ActionBarActivity implements NavDrawerActivity
|
||||
};
|
||||
|
||||
private void loadData() {
|
||||
subscription = Observable.defer(() -> Observable.just(DBReader.getNavDrawerData()))
|
||||
subscription = Observable.fromCallable(() -> DBReader.getNavDrawerData())
|
||||
.subscribeOn(Schedulers.newThread())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(result -> {
|
||||
|
@ -116,7 +116,7 @@ public class OnlineFeedViewActivity extends ActionBarActivity {
|
||||
@Override
|
||||
public void update(EventDistributor eventDistributor, Integer arg) {
|
||||
if ((arg & EventDistributor.FEED_LIST_UPDATE) != 0) {
|
||||
updater = Observable.defer(() -> Observable.just(DBReader.getFeedList()))
|
||||
updater = Observable.fromCallable(() -> DBReader.getFeedList())
|
||||
.subscribeOn(Schedulers.newThread())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(feeds -> {
|
||||
|
@ -427,7 +427,7 @@ public class AllEpisodesFragment extends Fragment {
|
||||
recyclerView.setVisibility(View.GONE);
|
||||
progLoading.setVisibility(View.VISIBLE);
|
||||
}
|
||||
subscription = Observable.defer(() -> Observable.just(loadData()))
|
||||
subscription = Observable.fromCallable(() -> loadData())
|
||||
.subscribeOn(Schedulers.newThread())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(data -> {
|
||||
|
@ -156,7 +156,7 @@ public class CompletedDownloadsFragment extends ListFragment {
|
||||
if (!itemsLoaded && viewCreated) {
|
||||
setListShown(false);
|
||||
}
|
||||
subscription = Observable.defer(() -> Observable.just(DBReader.getDownloadedItems()))
|
||||
subscription = Observable.fromCallable(() -> DBReader.getDownloadedItems())
|
||||
.subscribeOn(Schedulers.newThread())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(result -> {
|
||||
|
@ -147,7 +147,7 @@ public class DownloadLogFragment extends ListFragment {
|
||||
if(subscription != null) {
|
||||
subscription.unsubscribe();
|
||||
}
|
||||
subscription = Observable.defer(() -> Observable.just(DBReader.getDownloadLog()))
|
||||
subscription = Observable.fromCallable(() -> DBReader.getDownloadLog())
|
||||
.subscribeOn(Schedulers.newThread())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(result -> {
|
||||
|
@ -520,7 +520,7 @@ public class ItemFragment extends Fragment {
|
||||
if(subscription != null) {
|
||||
subscription.unsubscribe();
|
||||
}
|
||||
subscription = Observable.defer(() -> Observable.just(loadInBackground()))
|
||||
subscription = Observable.fromCallable(() -> loadInBackground())
|
||||
.subscribeOn(Schedulers.newThread())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(result -> {
|
||||
|
@ -627,7 +627,7 @@ public class ItemlistFragment extends ListFragment {
|
||||
subscription.unsubscribe();
|
||||
}
|
||||
|
||||
subscription = Observable.defer(() -> Observable.just(loadData()))
|
||||
subscription = Observable.fromCallable(() -> loadData())
|
||||
.subscribeOn(Schedulers.newThread())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(result -> {
|
||||
|
@ -252,7 +252,7 @@ public class PlaybackHistoryFragment extends ListFragment {
|
||||
if(subscription != null) {
|
||||
subscription.unsubscribe();
|
||||
}
|
||||
subscription = Observable.defer(() -> Observable.just(loadData()))
|
||||
subscription = Observable.fromCallable(() -> loadData())
|
||||
.subscribeOn(Schedulers.newThread())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(result -> {
|
||||
|
@ -204,7 +204,7 @@ public class SearchFragment extends ListFragment {
|
||||
if (viewCreated && !itemsLoaded) {
|
||||
setListShown(false);
|
||||
}
|
||||
subscription = Observable.defer(() -> Observable.just(performSearch()))
|
||||
subscription = Observable.fromCallable(() -> performSearch())
|
||||
.subscribeOn(Schedulers.newThread())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(result -> {
|
||||
|
Loading…
x
Reference in New Issue
Block a user