From 416fd128baa4bf05031a1e105fe5e51b79a1fbee Mon Sep 17 00:00:00 2001 From: inorichi Date: Tue, 19 Jan 2016 15:49:13 +0100 Subject: [PATCH] Upgrade StorIO to 1.8.0 --- app/build.gradle | 2 +- .../tachiyomi/data/sync/UpdateMangaSyncService.java | 2 +- .../kanade/tachiyomi/ui/library/LibraryPresenter.java | 4 ++-- .../ui/library/category/CategoryPresenter.java | 10 +++++----- .../eu/kanade/tachiyomi/ui/manga/MangaPresenter.java | 2 +- .../tachiyomi/ui/manga/chapter/ChaptersPresenter.java | 4 ++-- .../ui/manga/myanimelist/MyAnimeListPresenter.java | 8 ++++---- .../eu/kanade/tachiyomi/ui/reader/ReaderPresenter.java | 8 ++++---- .../ui/reader/viewer/webtoon/WebtoonAdapter.java | 1 - .../ui/reader/viewer/webtoon/WebtoonReader.java | 3 +-- .../tachiyomi/ui/recent/RecentChaptersAdapter.java | 1 + .../tachiyomi/ui/recent/RecentChaptersPresenter.java | 2 +- 12 files changed, 23 insertions(+), 24 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 9b3ad221c..7d263c6c8 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -81,7 +81,7 @@ dependencies { final SUPPORT_LIBRARY_VERSION = '23.1.1' final DAGGER_VERSION = '2.0.2' final MOCKITO_VERSION = '1.10.19' - final STORIO_VERSION = '1.7.0' + final STORIO_VERSION = '1.8.0' final ICEPICK_VERSION = '3.1.0' compile fileTree(dir: 'libs', include: ['*.jar']) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/sync/UpdateMangaSyncService.java b/app/src/main/java/eu/kanade/tachiyomi/data/sync/UpdateMangaSyncService.java index c8ae78143..3b291509e 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/sync/UpdateMangaSyncService.java +++ b/app/src/main/java/eu/kanade/tachiyomi/data/sync/UpdateMangaSyncService.java @@ -63,7 +63,7 @@ public class UpdateMangaSyncService extends Service { subscriptions.add(Observable.defer(() -> sync.update(mangaSync)) .flatMap(response -> { if (response.isSuccessful()) { - return db.insertMangaSync(mangaSync).createObservable(); + return db.insertMangaSync(mangaSync).asRxObservable(); } return Observable.error(new Exception("Could not update MAL")); }) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryPresenter.java b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryPresenter.java index 7953b28fe..a70ce73c1 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryPresenter.java +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryPresenter.java @@ -70,12 +70,12 @@ public class LibraryPresenter extends BasePresenter { } private Observable> getCategoriesObservable() { - return db.getCategories().createObservable() + return db.getCategories().asRxObservable() .doOnNext(categories -> this.categories = categories); } private Observable>> getLibraryMangasObservable() { - return db.getLibraryMangas().createObservable() + return db.getLibraryMangas().asRxObservable() .flatMap(mangas -> Observable.from(mangas) .groupBy(manga -> manga.category) .flatMap(group -> group.toList() diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/category/CategoryPresenter.java b/app/src/main/java/eu/kanade/tachiyomi/ui/library/category/CategoryPresenter.java index 26e6b53af..edb305c9a 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/category/CategoryPresenter.java +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/category/CategoryPresenter.java @@ -24,7 +24,7 @@ public class CategoryPresenter extends BasePresenter { super.onCreate(savedState); restartableLatestCache(GET_CATEGORIES, - () -> db.getCategories().createObservable() + () -> db.getCategories().asRxObservable() .doOnNext(categories -> this.categories = categories) .observeOn(AndroidSchedulers.mainThread()), CategoryActivity::setCategories); @@ -46,11 +46,11 @@ public class CategoryPresenter extends BasePresenter { } cat.order = max; - db.insertCategory(cat).createObservable().subscribe(); + db.insertCategory(cat).asRxObservable().subscribe(); } public void deleteCategories(List categories) { - db.deleteCategories(categories).createObservable().subscribe(); + db.deleteCategories(categories).asRxObservable().subscribe(); } public void reorderCategories(List categories) { @@ -58,11 +58,11 @@ public class CategoryPresenter extends BasePresenter { categories.get(i).order = i; } - db.insertCategories(categories).createObservable().subscribe(); + db.insertCategories(categories).asRxObservable().subscribe(); } public void renameCategory(Category category, String name) { category.name = name; - db.insertCategory(category).createObservable().subscribe(); + db.insertCategory(category).asRxObservable().subscribe(); } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaPresenter.java b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaPresenter.java index 874047f8f..15faffb3e 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaPresenter.java +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaPresenter.java @@ -36,7 +36,7 @@ public class MangaPresenter extends BasePresenter { } private Observable getDbMangaObservable() { - return db.getManga(mangaId).createObservable() + return db.getManga(mangaId).asRxObservable() .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .doOnNext(manga -> EventBus.getDefault().postSticky(manga)); diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/ChaptersPresenter.java b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/ChaptersPresenter.java index 554d79db2..798ca4e07 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/ChaptersPresenter.java +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/ChaptersPresenter.java @@ -97,7 +97,7 @@ public class ChaptersPresenter extends BasePresenter { source = sourceManager.get(manga.source); start(DB_CHAPTERS); - add(db.getChapters(manga).createObservable() + add(db.getChapters(manga).asRxObservable() .subscribeOn(Schedulers.io()) .doOnNext(chapters -> { this.chapters = chapters; @@ -202,7 +202,7 @@ public class ChaptersPresenter extends BasePresenter { return chapter; }) .toList() - .flatMap(chapters -> db.insertChapters(chapters).createObservable()) + .flatMap(chapters -> db.insertChapters(chapters).asRxObservable()) .observeOn(AndroidSchedulers.mainThread()) .subscribe()); } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/myanimelist/MyAnimeListPresenter.java b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/myanimelist/MyAnimeListPresenter.java index 325835af0..a49b169cd 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/myanimelist/MyAnimeListPresenter.java +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/myanimelist/MyAnimeListPresenter.java @@ -46,7 +46,7 @@ public class MyAnimeListPresenter extends BasePresenter { myAnimeList = syncManager.getMyAnimeList(); restartableLatestCache(GET_MANGA_SYNC, - () -> db.getMangaSync(manga, myAnimeList).createObservable() + () -> db.getMangaSync(manga, myAnimeList).asRxObservable() .doOnNext(mangaSync -> this.mangaSync = mangaSync) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()), @@ -75,7 +75,7 @@ public class MyAnimeListPresenter extends BasePresenter { } return Observable.error(new Exception("Could not find manga")); }) - .flatMap(myManga -> db.insertMangaSync(myManga).createObservable()) + .flatMap(myManga -> db.insertMangaSync(myManga).asRxObservable()) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()), (view, result) -> view.onRefreshDone(), @@ -109,7 +109,7 @@ public class MyAnimeListPresenter extends BasePresenter { private void updateRemote() { add(myAnimeList.update(mangaSync) - .flatMap(response -> db.insertMangaSync(mangaSync).createObservable()) + .flatMap(response -> db.insertMangaSync(mangaSync).asRxObservable()) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(next -> {}, @@ -139,7 +139,7 @@ public class MyAnimeListPresenter extends BasePresenter { add(myAnimeList.bind(manga) .flatMap(response -> { if (response.isSuccessful()) { - return db.insertMangaSync(manga).createObservable(); + return db.insertMangaSync(manga).asRxObservable(); } return Observable.error(new Exception("Could not bind manga")); }) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderPresenter.java b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderPresenter.java index 2abee1582..7022d1291 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderPresenter.java +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderPresenter.java @@ -172,8 +172,8 @@ public class ReaderPresenter extends BasePresenter { private Observable> getAdjacentChaptersObservable() { return Observable.zip( - db.getPreviousChapter(chapter).createObservable().take(1), - db.getNextChapter(chapter).createObservable().take(1), + db.getPreviousChapter(chapter).asRxObservable().take(1), + db.getNextChapter(chapter).asRxObservable().take(1), Pair::create) .doOnNext(pair -> { previousChapter = pair.first; @@ -211,7 +211,7 @@ public class ReaderPresenter extends BasePresenter { } private Observable> getMangaSyncObservable() { - return db.getMangasSync(manga).createObservable() + return db.getMangasSync(manga).asRxObservable() .doOnNext(mangaSync -> this.mangaSyncList = mangaSync); } @@ -262,7 +262,7 @@ public class ReaderPresenter extends BasePresenter { if (isChapterFinished()) { chapter.read = true; } - db.insertChapter(chapter).createObservable().subscribe(); + db.insertChapter(chapter).asRxObservable().subscribe(); } // Check whether the chapter has been read diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonAdapter.java b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonAdapter.java index 5b696b35d..451f0b141 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonAdapter.java +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonAdapter.java @@ -47,7 +47,6 @@ public class WebtoonAdapter extends RecyclerView.Adapter { public void setPages(List pages) { this.pages = pages; - notifyDataSetChanged(); } public void clear() { diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonReader.java b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonReader.java index a688d6b42..d4e235958 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonReader.java +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonReader.java @@ -107,9 +107,8 @@ public class WebtoonReader extends BaseReader { if (pages != null) { unsubscribeStatus(); recycler.clearOnScrollListeners(); - adapter.clear(); - recycler.scrollTo(0, 0); adapter.setPages(pages); + recycler.setAdapter(adapter); setScrollListener(); observeStatus(0); } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/recent/RecentChaptersAdapter.java b/app/src/main/java/eu/kanade/tachiyomi/ui/recent/RecentChaptersAdapter.java index 8c2a2bb45..a4d344600 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/recent/RecentChaptersAdapter.java +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/recent/RecentChaptersAdapter.java @@ -75,6 +75,7 @@ public class RecentChaptersAdapter extends FlexibleAdapter> getRecentChaptersObservable() { - return db.getRecentChapters().createObservable() + return db.getRecentChapters().asRxObservable() // group chapters by the date they were fetched on a ordered map .flatMap(recents -> Observable.from(recents) .toMultimap(