mirror of
https://github.com/mihonapp/mihon.git
synced 2025-11-15 13:37:29 +01:00
Change filename for downloaded chapters, using the last path from the url is not reliable. This will break compatibility with previously downloaded chapters, they have to be deleted and downloaded again.
Disable download progress in the chapters view, it will avoid some crashes.
This commit is contained in:
@@ -90,6 +90,7 @@ public class DownloadPresenter extends BasePresenter<DownloadFragment> {
|
||||
.flatMap(tick -> Observable.from(download.pages)
|
||||
.map(Page::getProgress)
|
||||
.reduce((x, y) -> x + y))
|
||||
.onBackpressureLatest()
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(progress -> {
|
||||
if (download.totalProgress != progress) {
|
||||
|
||||
@@ -19,13 +19,13 @@ public class MangaPresenter extends BasePresenter<MangaActivity> {
|
||||
|
||||
@State Manga manga;
|
||||
|
||||
private static final int DB_MANGA = 1;
|
||||
private static final int GET_MANGA = 1;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedState) {
|
||||
super.onCreate(savedState);
|
||||
|
||||
restartableLatestCache(DB_MANGA, this::getDbMangaObservable, MangaActivity::setManga);
|
||||
restartableLatestCache(GET_MANGA, this::getMangaObservable, MangaActivity::setManga);
|
||||
|
||||
if (savedState == null)
|
||||
registerForStickyEvents();
|
||||
@@ -38,7 +38,7 @@ public class MangaPresenter extends BasePresenter<MangaActivity> {
|
||||
EventBus.getDefault().removeStickyEvent(MangaEvent.class);
|
||||
}
|
||||
|
||||
private Observable<Manga> getDbMangaObservable() {
|
||||
private Observable<Manga> getMangaObservable() {
|
||||
return Observable.just(manga)
|
||||
.doOnNext(manga -> EventBus.getDefault().postSticky(new MangaEvent(manga)));
|
||||
}
|
||||
@@ -48,7 +48,7 @@ public class MangaPresenter extends BasePresenter<MangaActivity> {
|
||||
EventBus.getDefault().removeStickyEvent(manga);
|
||||
unregisterForEvents();
|
||||
this.manga = manga;
|
||||
start(DB_MANGA);
|
||||
start(GET_MANGA);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -103,18 +103,6 @@ public class ChaptersFragment extends BaseRxFragment<ChaptersPresenter> implemen
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
observeChapterDownloadProgress();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
unsubscribeChapterDownloadProgress();
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
public void onNextChapters(List<Chapter> chapters) {
|
||||
// If the list is empty, fetch chapters from source if the conditions are met
|
||||
// We use presenter chapters instead because they are always unfiltered
|
||||
|
||||
Reference in New Issue
Block a user