From 4e784cd7c3db32cc4a79ca1d80cd43ae1135af22 Mon Sep 17 00:00:00 2001 From: len Date: Thu, 26 May 2016 16:03:55 +0200 Subject: [PATCH] Minor fixes --- .../eu/kanade/tachiyomi/data/database/models/Chapter.java | 4 ++++ .../eu/kanade/tachiyomi/ui/manga/chapter/ChaptersPresenter.kt | 2 +- .../main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt | 2 +- .../main/java/eu/kanade/tachiyomi/util/ChapterSourceSync.kt | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/database/models/Chapter.java b/app/src/main/java/eu/kanade/tachiyomi/data/database/models/Chapter.java index f3b46681d..abe111f25 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/database/models/Chapter.java +++ b/app/src/main/java/eu/kanade/tachiyomi/data/database/models/Chapter.java @@ -87,4 +87,8 @@ public class Chapter implements Serializable { public boolean isDownloaded() { return status == Download.DOWNLOADED; } + + public boolean isRecognizedNumber() { + return chapter_number >= 0f; + } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/ChaptersPresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/ChaptersPresenter.kt index eb50341e8..264bde1d3 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/ChaptersPresenter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/ChaptersPresenter.kt @@ -188,7 +188,7 @@ class ChaptersPresenter : BasePresenter() { fun markPreviousChaptersAsRead(selected: Chapter) { Observable.from(chapters) - .filter { it.chapter_number > -1 && it.chapter_number < selected.chapter_number } + .filter { it.isRecognizedNumber && it.chapter_number < selected.chapter_number } .doOnNext { it.read = true } .toList() .flatMap { db.updateChaptersProgress(it).asRxObservable() } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt index 835214055..c364a2162 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt @@ -260,7 +260,7 @@ class ReaderActivity : BaseRxActivity() { page_seekbar.max = numPages - 1 page_seekbar.progress = currentPage - setToolbarSubtitle(if (chapter.chapter_number != -1f) + setToolbarSubtitle(if (chapter.isRecognizedNumber) getString(R.string.chapter_subtitle, decimalFormat.format(chapter.chapter_number.toDouble())) else chapter.name) diff --git a/app/src/main/java/eu/kanade/tachiyomi/util/ChapterSourceSync.kt b/app/src/main/java/eu/kanade/tachiyomi/util/ChapterSourceSync.kt index 490e3deb7..f43decf3a 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/util/ChapterSourceSync.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/util/ChapterSourceSync.kt @@ -71,7 +71,7 @@ fun syncChaptersWithSource(db: DatabaseHelper, val c = toAdd[i] c.date_fetch = now++ // Try to mark already read chapters as read when the source deletes them - if (c.chapter_number != -1f && c.chapter_number in deletedReadChapterNumbers) { + if (c.isRecognizedNumber && c.chapter_number in deletedReadChapterNumbers) { c.read = true readded++ }