mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-17 13:09:17 +01:00
Don't query db twice
This commit is contained in:
parent
a52e33b628
commit
c6df23b1aa
@ -10,7 +10,6 @@ import eu.kanade.mangafeed.data.tables.MangasTable;
|
|||||||
@StorIOSQLiteType(table = MangasTable.TABLE)
|
@StorIOSQLiteType(table = MangasTable.TABLE)
|
||||||
public class Manga {
|
public class Manga {
|
||||||
|
|
||||||
@Nullable
|
|
||||||
@StorIOSQLiteColumn(name = MangasTable.COLUMN_ID, key = true)
|
@StorIOSQLiteColumn(name = MangasTable.COLUMN_ID, key = true)
|
||||||
public Long id;
|
public Long id;
|
||||||
|
|
||||||
|
@ -36,12 +36,9 @@ public class MangaInfoPresenter extends BasePresenter<MangaInfoFragment> {
|
|||||||
|
|
||||||
private void getMangaInfo() {
|
private void getMangaInfo() {
|
||||||
if (mangaInfoSubscription != null)
|
if (mangaInfoSubscription != null)
|
||||||
return;
|
remove(mangaInfoSubscription);
|
||||||
|
|
||||||
add(mangaInfoSubscription = db.getManga(manga.id)
|
add(mangaInfoSubscription = Observable.just(manga)
|
||||||
.subscribeOn(Schedulers.io())
|
|
||||||
.take(1)
|
|
||||||
.flatMap(Observable::from)
|
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.compose(deliverLatestCache())
|
.compose(deliverLatestCache())
|
||||||
.subscribe(split(MangaInfoFragment::setMangaInfo)));
|
.subscribe(split(MangaInfoFragment::setMangaInfo)));
|
||||||
|
Loading…
Reference in New Issue
Block a user