mirror of
https://github.com/mihonapp/mihon.git
synced 2025-10-26 12:00:41 +01:00
Info shows last chapter instead of chapter count. Resolves #765
This commit is contained in:
@@ -63,7 +63,7 @@ class MangaController : RxController, TabbedController {
|
||||
|
||||
val fromCatalogue = args.getBoolean(FROM_CATALOGUE_EXTRA, false)
|
||||
|
||||
val chapterCountRelay: BehaviorRelay<Int> = BehaviorRelay.create()
|
||||
val chapterCountRelay: BehaviorRelay<Float> = BehaviorRelay.create()
|
||||
|
||||
val mangaFavoriteRelay: PublishRelay<Boolean> = PublishRelay.create()
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ import uy.kohesive.injekt.api.get
|
||||
class ChaptersPresenter(
|
||||
val manga: Manga,
|
||||
val source: Source,
|
||||
private val chapterCountRelay: BehaviorRelay<Int>,
|
||||
private val chapterCountRelay: BehaviorRelay<Float>,
|
||||
private val mangaFavoriteRelay: PublishRelay<Boolean>,
|
||||
val preferences: PreferencesHelper = Injekt.get(),
|
||||
private val db: DatabaseHelper = Injekt.get(),
|
||||
@@ -92,7 +92,8 @@ class ChaptersPresenter(
|
||||
observeDownloads()
|
||||
|
||||
// Emit the number of chapters to the info tab.
|
||||
chapterCountRelay.call(chapters.size)
|
||||
chapterCountRelay.call(chapters.maxBy { it.chapter_number }?.chapter_number
|
||||
?: 0f)
|
||||
}
|
||||
.subscribe { chaptersRelay.call(it) })
|
||||
}
|
||||
|
||||
@@ -38,6 +38,7 @@ import rx.android.schedulers.AndroidSchedulers
|
||||
import rx.schedulers.Schedulers
|
||||
import rx.subscriptions.Subscriptions
|
||||
import uy.kohesive.injekt.injectLazy
|
||||
import java.text.DecimalFormat
|
||||
|
||||
/**
|
||||
* Fragment that shows manga information.
|
||||
@@ -171,8 +172,8 @@ class MangaInfoController : NucleusController<MangaInfoPresenter>(),
|
||||
*
|
||||
* @param count number of chapters.
|
||||
*/
|
||||
fun setChapterCount(count: Int) {
|
||||
view?.manga_chapters?.text = count.toString()
|
||||
fun setChapterCount(count: Float) {
|
||||
view?.manga_chapters?.text = DecimalFormat("#.#").format(count)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -27,7 +27,7 @@ import uy.kohesive.injekt.api.get
|
||||
class MangaInfoPresenter(
|
||||
val manga: Manga,
|
||||
val source: Source,
|
||||
private val chapterCountRelay: BehaviorRelay<Int>,
|
||||
private val chapterCountRelay: BehaviorRelay<Float>,
|
||||
private val mangaFavoriteRelay: PublishRelay<Boolean>,
|
||||
private val db: DatabaseHelper = Injekt.get(),
|
||||
private val downloadManager: DownloadManager = Injekt.get(),
|
||||
|
||||
Reference in New Issue
Block a user