mirror of
https://github.com/mihonapp/mihon.git
synced 2025-11-01 22:58:57 +01:00
Convert some classes to Kotlin
This commit is contained in:
@@ -220,7 +220,7 @@ class CataloguePresenter : BasePresenter<CatalogueFragment>() {
|
||||
private fun getMangasPageObservable(page: Int): Observable<List<Manga>> {
|
||||
val nextMangasPage = MangasPage(page)
|
||||
if (page != 1) {
|
||||
nextMangasPage.url = lastMangasPage!!.nextPageUrl
|
||||
nextMangasPage.url = lastMangasPage!!.nextPageUrl!!
|
||||
}
|
||||
|
||||
val observable = if (query.isEmpty())
|
||||
|
||||
@@ -32,12 +32,13 @@ class DownloadHolder(private val view: View) : RecyclerView.ViewHolder(view) {
|
||||
view.manga_title.text = download.manga.title
|
||||
|
||||
// Update the progress bar and the number of downloaded pages
|
||||
if (download.pages == null) {
|
||||
val pages = download.pages
|
||||
if (pages == null) {
|
||||
view.download_progress.progress = 0
|
||||
view.download_progress.max = 1
|
||||
view.download_progress_text.text = ""
|
||||
} else {
|
||||
view.download_progress.max = download.pages.size * 100
|
||||
view.download_progress.max = pages.size * 100
|
||||
notifyProgress()
|
||||
notifyDownloadedPages()
|
||||
}
|
||||
@@ -48,7 +49,7 @@ class DownloadHolder(private val view: View) : RecyclerView.ViewHolder(view) {
|
||||
*/
|
||||
fun notifyProgress() {
|
||||
if (view.download_progress.max == 1) {
|
||||
view.download_progress.max = download.pages.size * 100
|
||||
view.download_progress.max = download.pages!!.size * 100
|
||||
}
|
||||
view.download_progress.progress = download.totalProgress
|
||||
}
|
||||
@@ -57,7 +58,7 @@ class DownloadHolder(private val view: View) : RecyclerView.ViewHolder(view) {
|
||||
* Updates the text field of the number of downloaded pages.
|
||||
*/
|
||||
fun notifyDownloadedPages() {
|
||||
view.download_progress_text.text = "${download.downloadedImages}/${download.pages.size}"
|
||||
view.download_progress_text.text = "${download.downloadedImages}/${download.pages!!.size}"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user