mirror of
https://github.com/mihonapp/mihon.git
synced 2024-11-07 11:17:25 +01:00
Info shows last chapter instead of chapter count. Resolves #765
This commit is contained in:
parent
ff190e02d4
commit
0da2f91771
@ -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(),
|
||||
|
@ -134,7 +134,7 @@
|
||||
style="@style/TextAppearance.Medium.Body2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/manga_info_chapters_label"
|
||||
android:text="@string/manga_info_last_chapter_label"
|
||||
android:textIsSelectable="false"
|
||||
app:layout_constraintTop_toBottomOf="@+id/manga_artist_label"
|
||||
app:layout_constraintLeft_toLeftOf="parent"/>
|
||||
|
@ -289,6 +289,7 @@
|
||||
<string name="manga_info_author_label">Author</string>
|
||||
<string name="manga_info_artist_label">Artist</string>
|
||||
<string name="manga_info_chapters_label">Chapters</string>
|
||||
<string name="manga_info_last_chapter_label">Last chapter</string>
|
||||
<string name="manga_info_status_label">Status</string>
|
||||
<string name="manga_info_source_label">Source</string>
|
||||
<string name="manga_info_genres_label">Genres</string>
|
||||
|
Loading…
Reference in New Issue
Block a user