From c67e62bac34ed24ed9db4b137c60b60ee52a89aa Mon Sep 17 00:00:00 2001 From: arkon Date: Fri, 3 Apr 2020 21:57:40 -0400 Subject: [PATCH] Remove some relayed chapter info from main manga info view --- .../ui/manga/chapter/ChaptersPresenter.kt | 10 +--- .../ui/manga/info/MangaInfoController.kt | 28 +---------- .../ui/manga/info/MangaInfoPresenter.kt | 12 ----- .../res/layout-land/manga_info_controller.xml | 48 +----------------- .../main/res/layout/manga_info_controller.xml | 49 +------------------ app/src/main/res/values/strings.xml | 2 - 6 files changed, 5 insertions(+), 144 deletions(-) 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 172121062f..963f50278e 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 @@ -14,7 +14,6 @@ import eu.kanade.tachiyomi.source.Source import eu.kanade.tachiyomi.ui.base.presenter.BasePresenter import eu.kanade.tachiyomi.util.chapter.syncChaptersWithSource import eu.kanade.tachiyomi.util.lang.isNullOrUnsubscribed -import java.util.Date import rx.Observable import rx.Subscription import rx.android.schedulers.AndroidSchedulers @@ -22,6 +21,7 @@ import rx.schedulers.Schedulers import timber.log.Timber import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get +import java.util.Date /** * Presenter of [ChaptersController]. @@ -90,14 +90,6 @@ class ChaptersPresenter( // Listen for download status changes observeDownloads() - - // Emit the number of chapters to the info tab. - chapterCountRelay.call(chapters.maxBy { it.chapter_number }?.chapter_number - ?: 0f) - - // Emit the upload date of the most recent chapter - lastUpdateRelay.call(Date(chapters.maxBy { it.date_upload }?.date_upload - ?: 0)) } .subscribe { chaptersRelay.call(it) }) } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaInfoController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaInfoController.kt index af311ff053..5fa761f473 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaInfoController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaInfoController.kt @@ -54,13 +54,11 @@ import eu.kanade.tachiyomi.ui.webview.WebViewActivity import eu.kanade.tachiyomi.util.lang.truncateCenter import eu.kanade.tachiyomi.util.system.toast import eu.kanade.tachiyomi.util.view.snack -import java.text.DateFormat -import java.text.DecimalFormat -import java.util.Date import jp.wasabeef.glide.transformations.CropSquareTransformation import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get import uy.kohesive.injekt.injectLazy +import java.text.DateFormat /** * Fragment that shows manga information. @@ -85,8 +83,7 @@ class MangaInfoController : NucleusController(), override fun createPresenter(): MangaInfoPresenter { val ctrl = parentController as MangaController - return MangaInfoPresenter(ctrl.manga!!, ctrl.source!!, - ctrl.chapterCountRelay, ctrl.lastUpdateRelay, ctrl.mangaFavoriteRelay) + return MangaInfoPresenter(ctrl.manga!!, ctrl.source!!, ctrl.mangaFavoriteRelay) } override fun inflateView(inflater: LayoutInflater, container: ViewGroup): View { @@ -268,27 +265,6 @@ class MangaInfoController : NucleusController(), } } - /** - * Update chapter count TextView. - * - * @param count number of chapters. - */ - fun setChapterCount(count: Float) { - if (count > 0f) { - binding.mangaChapters.text = DecimalFormat("#.#").format(count) - } else { - binding.mangaChapters.text = resources?.getString(R.string.unknown) - } - } - - fun setLastUpdateDate(date: Date) { - if (date.time != 0L) { - binding.mangaLastUpdate.text = dateFormat.format(date) - } else { - binding.mangaLastUpdate.text = resources?.getString(R.string.unknown) - } - } - /** * Toggles the favorite status and asks for confirmation to delete downloaded chapters. */ diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaInfoPresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaInfoPresenter.kt index 3296af3125..cb048f7d7d 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaInfoPresenter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaInfoPresenter.kt @@ -1,7 +1,6 @@ package eu.kanade.tachiyomi.ui.manga.info import android.os.Bundle -import com.jakewharton.rxrelay.BehaviorRelay import com.jakewharton.rxrelay.PublishRelay import eu.kanade.tachiyomi.data.cache.CoverCache import eu.kanade.tachiyomi.data.database.DatabaseHelper @@ -12,7 +11,6 @@ import eu.kanade.tachiyomi.data.download.DownloadManager import eu.kanade.tachiyomi.source.Source import eu.kanade.tachiyomi.ui.base.presenter.BasePresenter import eu.kanade.tachiyomi.util.lang.isNullOrUnsubscribed -import java.util.Date import rx.Observable import rx.Subscription import rx.android.schedulers.AndroidSchedulers @@ -28,8 +26,6 @@ import uy.kohesive.injekt.api.get class MangaInfoPresenter( val manga: Manga, val source: Source, - private val chapterCountRelay: BehaviorRelay, - private val lastUpdateRelay: BehaviorRelay, private val mangaFavoriteRelay: PublishRelay, private val db: DatabaseHelper = Injekt.get(), private val downloadManager: DownloadManager = Injekt.get(), @@ -50,18 +46,10 @@ class MangaInfoPresenter( super.onCreate(savedState) sendMangaToView() - // Update chapter count - chapterCountRelay.observeOn(AndroidSchedulers.mainThread()) - .subscribeLatestCache(MangaInfoController::setChapterCount) - // Update favorite status mangaFavoriteRelay.observeOn(AndroidSchedulers.mainThread()) .subscribe { setFavorite(it) } .apply { add(this) } - - // update last update date - lastUpdateRelay.observeOn(AndroidSchedulers.mainThread()) - .subscribeLatestCache(MangaInfoController::setLastUpdateDate) } /** diff --git a/app/src/main/res/layout-land/manga_info_controller.xml b/app/src/main/res/layout-land/manga_info_controller.xml index 4aa2b462bf..a8f2a33d78 100644 --- a/app/src/main/res/layout-land/manga_info_controller.xml +++ b/app/src/main/res/layout-land/manga_info_controller.xml @@ -113,52 +113,6 @@ app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toEndOf="@+id/manga_artist_label" /> - - - - - - - - + app:layout_constraintTop_toBottomOf="@+id/manga_artist_label" /> @@ -141,52 +140,6 @@ app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toEndOf="@+id/manga_artist_label" /> - - - - - - - - + app:layout_constraintTop_toBottomOf="@+id/manga_artist_label" /> Author Artist Chapters - Last chapter - Updated Status Source Genres