Fixed name of manga details controller

This commit is contained in:
Jay 2020-03-04 23:01:39 -08:00
parent ffb8a7bd17
commit 87ed315ad5
14 changed files with 35 additions and 36 deletions

View File

@ -32,8 +32,7 @@ import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction
import eu.kanade.tachiyomi.ui.catalogue.CatalogueController import eu.kanade.tachiyomi.ui.catalogue.CatalogueController
import eu.kanade.tachiyomi.ui.library.ChangeMangaCategoriesDialog import eu.kanade.tachiyomi.ui.library.ChangeMangaCategoriesDialog
import eu.kanade.tachiyomi.ui.main.MainActivity import eu.kanade.tachiyomi.ui.main.MainActivity
import eu.kanade.tachiyomi.ui.manga.MangaChaptersController import eu.kanade.tachiyomi.ui.manga.MangaDetailsController
import eu.kanade.tachiyomi.ui.manga.MangaController
import eu.kanade.tachiyomi.ui.webview.WebViewActivity import eu.kanade.tachiyomi.ui.webview.WebViewActivity
import eu.kanade.tachiyomi.util.system.connectivityManager import eu.kanade.tachiyomi.util.system.connectivityManager
import eu.kanade.tachiyomi.util.view.HeightTopWindowInsetsListener import eu.kanade.tachiyomi.util.view.HeightTopWindowInsetsListener
@ -501,7 +500,7 @@ open class BrowseCatalogueController(bundle: Bundle) :
*/ */
override fun onItemClick(view: View?, position: Int): Boolean { override fun onItemClick(view: View?, position: Int): Boolean {
val item = adapter?.getItem(position) as? CatalogueItem ?: return false val item = adapter?.getItem(position) as? CatalogueItem ?: return false
router.pushController(MangaChaptersController(item.manga, true).withFadeTransaction()) router.pushController(MangaDetailsController(item.manga, true).withFadeTransaction())
return false return false
} }

View File

@ -14,7 +14,7 @@ import eu.kanade.tachiyomi.data.database.models.Manga
import eu.kanade.tachiyomi.source.CatalogueSource import eu.kanade.tachiyomi.source.CatalogueSource
import eu.kanade.tachiyomi.ui.base.controller.NucleusController import eu.kanade.tachiyomi.ui.base.controller.NucleusController
import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction
import eu.kanade.tachiyomi.ui.manga.MangaChaptersController import eu.kanade.tachiyomi.ui.manga.MangaDetailsController
import eu.kanade.tachiyomi.util.view.RecyclerWindowInsetsListener import eu.kanade.tachiyomi.util.view.RecyclerWindowInsetsListener
import eu.kanade.tachiyomi.util.view.applyWindowInsetsForController import eu.kanade.tachiyomi.util.view.applyWindowInsetsForController
import kotlinx.android.synthetic.main.catalogue_global_search_controller.* import kotlinx.android.synthetic.main.catalogue_global_search_controller.*
@ -80,7 +80,7 @@ open class CatalogueSearchController(
*/ */
override fun onMangaClick(manga: Manga) { override fun onMangaClick(manga: Manga) {
// Open MangaController. // Open MangaController.
router.pushController(MangaChaptersController(manga, true).withFadeTransaction()) router.pushController(MangaDetailsController(manga, true).withFadeTransaction())
} }
/** /**
@ -195,7 +195,7 @@ open class CatalogueSearchController(
val results = searchResult.first().results val results = searchResult.first().results
if (results != null && results.size == 1) { if (results != null && results.size == 1) {
val manga = results.first().manga val manga = results.first().manga
router.replaceTopController(MangaChaptersController(manga, true) router.replaceTopController(MangaDetailsController(manga, true)
.withFadeTransaction() .withFadeTransaction()
) )
return return

View File

@ -43,7 +43,7 @@ import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction
import eu.kanade.tachiyomi.ui.download.DownloadController import eu.kanade.tachiyomi.ui.download.DownloadController
import eu.kanade.tachiyomi.ui.library.filter.SortFilterBottomSheet import eu.kanade.tachiyomi.ui.library.filter.SortFilterBottomSheet
import eu.kanade.tachiyomi.ui.main.MainActivity import eu.kanade.tachiyomi.ui.main.MainActivity
import eu.kanade.tachiyomi.ui.manga.MangaChaptersController import eu.kanade.tachiyomi.ui.manga.MangaDetailsController
import eu.kanade.tachiyomi.ui.migration.MigrationInterface import eu.kanade.tachiyomi.ui.migration.MigrationInterface
import eu.kanade.tachiyomi.ui.migration.manga.design.PreMigrationController import eu.kanade.tachiyomi.ui.migration.manga.design.PreMigrationController
import eu.kanade.tachiyomi.ui.migration.manga.process.MigrationListController import eu.kanade.tachiyomi.ui.migration.manga.process.MigrationListController
@ -655,7 +655,7 @@ open class LibraryController(
} }
fun openManga(manga: Manga, startY: Float?) { fun openManga(manga: Manga, startY: Float?) {
router.pushController(MangaChaptersController(manga).withFadeTransaction()) router.pushController(MangaDetailsController(manga).withFadeTransaction())
// router.pushController(MangaController(manga, startY).withFadeTransaction()) // router.pushController(MangaController(manga, startY).withFadeTransaction())
} }

View File

@ -50,7 +50,7 @@ import eu.kanade.tachiyomi.ui.download.DownloadController
import eu.kanade.tachiyomi.ui.extension.ExtensionController import eu.kanade.tachiyomi.ui.extension.ExtensionController
import eu.kanade.tachiyomi.ui.library.LibraryController import eu.kanade.tachiyomi.ui.library.LibraryController
import eu.kanade.tachiyomi.ui.library.LibraryListController import eu.kanade.tachiyomi.ui.library.LibraryListController
import eu.kanade.tachiyomi.ui.manga.MangaChaptersController import eu.kanade.tachiyomi.ui.manga.MangaDetailsController
import eu.kanade.tachiyomi.ui.recent_updates.RecentChaptersController import eu.kanade.tachiyomi.ui.recent_updates.RecentChaptersController
import eu.kanade.tachiyomi.ui.recently_read.RecentlyReadController import eu.kanade.tachiyomi.ui.recently_read.RecentlyReadController
import eu.kanade.tachiyomi.ui.security.SecureActivityDelegate import eu.kanade.tachiyomi.ui.security.SecureActivityDelegate
@ -452,7 +452,7 @@ open class MainActivity : BaseActivity(), DownloadServiceListener {
if (router.backstack.isEmpty()) { if (router.backstack.isEmpty()) {
navigationView.selectedItemId = R.id.nav_library navigationView.selectedItemId = R.id.nav_library
} }
router.pushController(MangaChaptersController(extras).withFadeTransaction()) router.pushController(MangaDetailsController(extras).withFadeTransaction())
} }
SHORTCUT_DOWNLOADS -> { SHORTCUT_DOWNLOADS -> {
if (router.backstack.none { it.controller() is DownloadController }) { if (router.backstack.none { it.controller() is DownloadController }) {

View File

@ -16,7 +16,7 @@ import eu.kanade.tachiyomi.util.view.setEdgeToEdge
import eu.kanade.tachiyomi.util.view.visibleIf import eu.kanade.tachiyomi.util.view.visibleIf
import kotlinx.android.synthetic.main.chapter_sort_bottom_sheet.* import kotlinx.android.synthetic.main.chapter_sort_bottom_sheet.*
class ChaptersSortBottomSheet(controller: MangaChaptersController) : BottomSheetDialog class ChaptersSortBottomSheet(controller: MangaDetailsController) : BottomSheetDialog
(controller.activity!!, R.style.BottomSheetDialogTheme) { (controller.activity!!, R.style.BottomSheetDialogTheme) {
val activity = controller.activity!! val activity = controller.activity!!

View File

@ -17,7 +17,7 @@ class ChooseShapeDialog(bundle: Bundle? = null) : DialogController(bundle) {
targetController = target targetController = target
} }
constructor(target: MangaChaptersController) : this() { constructor(target: MangaDetailsController) : this() {
targetController = target targetController = target
} }
@ -36,7 +36,7 @@ class ChooseShapeDialog(bundle: Bundle? = null) : DialogController(bundle) {
waitForPositiveButton = false) waitForPositiveButton = false)
{ _, i, _ -> { _, i, _ ->
(targetController as? MangaInfoController)?.createShortcutForShape(i) (targetController as? MangaInfoController)?.createShortcutForShape(i)
(targetController as? MangaChaptersController)?.createShortcutForShape(i) (targetController as? MangaDetailsController)?.createShortcutForShape(i)
dismissDialog() dismissDialog()
} }
} }

View File

@ -81,15 +81,15 @@ import eu.kanade.tachiyomi.util.view.updateLayoutParams
import eu.kanade.tachiyomi.util.view.updatePaddingRelative import eu.kanade.tachiyomi.util.view.updatePaddingRelative
import jp.wasabeef.glide.transformations.CropSquareTransformation import jp.wasabeef.glide.transformations.CropSquareTransformation
import jp.wasabeef.glide.transformations.MaskTransformation import jp.wasabeef.glide.transformations.MaskTransformation
import kotlinx.android.synthetic.main.big_manga_controller.*
import kotlinx.android.synthetic.main.big_manga_controller.swipe_refresh
import kotlinx.android.synthetic.main.main_activity.* import kotlinx.android.synthetic.main.main_activity.*
import kotlinx.android.synthetic.main.manga_details_controller.*
import kotlinx.android.synthetic.main.manga_details_controller.swipe_refresh
import kotlinx.android.synthetic.main.manga_info_controller.* import kotlinx.android.synthetic.main.manga_info_controller.*
import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get import uy.kohesive.injekt.api.get
import java.io.File import java.io.File
class MangaChaptersController : BaseController, class MangaDetailsController : BaseController,
FlexibleAdapter.OnItemClickListener, FlexibleAdapter.OnItemClickListener,
FlexibleAdapter.OnItemLongClickListener, FlexibleAdapter.OnItemLongClickListener,
ChaptersAdapter.MangaHeaderInterface, ChaptersAdapter.MangaHeaderInterface,
@ -125,7 +125,7 @@ class MangaChaptersController : BaseController,
private var manga: Manga? = null private var manga: Manga? = null
private var source: Source? = null private var source: Source? = null
var colorAnimator:ValueAnimator? = null var colorAnimator:ValueAnimator? = null
lateinit var presenter:MangaPresenter lateinit var presenter:MangaDetailsPresenter
var coverColor:Int? = null var coverColor:Int? = null
var toolbarIsColored = false var toolbarIsColored = false
private var snack: Snackbar? = null private var snack: Snackbar? = null
@ -148,7 +148,7 @@ class MangaChaptersController : BaseController,
override fun onViewCreated(view: View) { override fun onViewCreated(view: View) {
super.onViewCreated(view) super.onViewCreated(view)
coverColor = null coverColor = null
if (!::presenter.isInitialized) presenter = MangaPresenter(this, manga!!, source!!) if (!::presenter.isInitialized) presenter = MangaDetailsPresenter(this, manga!!, source!!)
// Init RecyclerView and adapter // Init RecyclerView and adapter
adapter = ChaptersAdapter(this, view.context) adapter = ChaptersAdapter(this, view.context)
@ -221,7 +221,7 @@ class MangaChaptersController : BaseController,
} }
} }
fun setPaletteColor() { private fun setPaletteColor() {
val view = view ?: return val view = view ?: return
GlideApp.with(view.context).load(manga) GlideApp.with(view.context).load(manga)
.diskCacheStrategy(DiskCacheStrategy.AUTOMATIC) .diskCacheStrategy(DiskCacheStrategy.AUTOMATIC)
@ -636,7 +636,7 @@ class MangaChaptersController : BaseController,
} }
override fun inflateView(inflater: LayoutInflater, container: ViewGroup): View { override fun inflateView(inflater: LayoutInflater, container: ViewGroup): View {
return inflater.inflate(R.layout.big_manga_controller, container, false) return inflater.inflate(R.layout.manga_details_controller, container, false)
} }
override fun coverColor(): Int? = coverColor override fun coverColor(): Int? = coverColor
@ -771,7 +771,7 @@ class MangaChaptersController : BaseController,
(activity as? MainActivity)?.setUndoSnackBar(snack, fab_favorite) (activity as? MainActivity)?.setUndoSnackBar(snack, fab_favorite)
} }
override fun mangaPresenter(): MangaPresenter = presenter override fun mangaPresenter(): MangaDetailsPresenter = presenter
override fun updateCategoriesForMangas(mangas: List<Manga>, categories: List<Category>) { override fun updateCategoriesForMangas(mangas: List<Manga>, categories: List<Category>) {
val manga = mangas.firstOrNull() ?: return val manga = mangas.firstOrNull() ?: return

View File

@ -41,7 +41,7 @@ import java.io.OutputStream
import java.util.Date import java.util.Date
import kotlin.coroutines.CoroutineContext import kotlin.coroutines.CoroutineContext
class MangaPresenter(private val controller: MangaChaptersController, class MangaDetailsPresenter(private val controller: MangaDetailsController,
val manga: Manga, val manga: Manga,
val source: Source, val source: Source,
val preferences: PreferencesHelper = Injekt.get(), val preferences: PreferencesHelper = Injekt.get(),
@ -346,7 +346,7 @@ class MangaPresenter(private val controller: MangaChaptersController,
} }
isLoading = false isLoading = false
if (chapterError == null) if (chapterError == null)
withContext(Dispatchers.Main) { controller.updateChapters(this@MangaPresenter.chapters) } withContext(Dispatchers.Main) { controller.updateChapters(this@MangaDetailsPresenter.chapters) }
if (mangaError != null) if (mangaError != null)
withContext(Dispatchers.Main) { controller.showError(trimException(mangaError!!)) } withContext(Dispatchers.Main) { controller.showError(trimException(mangaError!!)) }
} }
@ -372,7 +372,7 @@ class MangaPresenter(private val controller: MangaChaptersController,
syncChaptersWithSource(db, chapters, manga, source) syncChaptersWithSource(db, chapters, manga, source)
updateChapters() updateChapters()
withContext(Dispatchers.Main) { controller.updateChapters(this@MangaPresenter.chapters) } withContext(Dispatchers.Main) { controller.updateChapters(this@MangaDetailsPresenter.chapters) }
} }
catch(e: java.lang.Exception) { catch(e: java.lang.Exception) {
controller.showError(trimException(e)) controller.showError(trimException(e))

View File

@ -8,7 +8,7 @@ import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.preference.PreferencesHelper import eu.kanade.tachiyomi.data.preference.PreferencesHelper
import eu.kanade.tachiyomi.data.preference.getOrDefault import eu.kanade.tachiyomi.data.preference.getOrDefault
import eu.kanade.tachiyomi.ui.base.controller.BaseController import eu.kanade.tachiyomi.ui.base.controller.BaseController
import eu.kanade.tachiyomi.ui.manga.MangaPresenter import eu.kanade.tachiyomi.ui.manga.MangaDetailsPresenter
import eu.kanade.tachiyomi.ui.security.SecureActivityDelegate import eu.kanade.tachiyomi.ui.security.SecureActivityDelegate
import eu.kanade.tachiyomi.util.system.getResourceColor import eu.kanade.tachiyomi.util.system.getResourceColor
import uy.kohesive.injekt.injectLazy import uy.kohesive.injekt.injectLazy
@ -59,7 +59,7 @@ class ChaptersAdapter(
interface MangaHeaderInterface { interface MangaHeaderInterface {
fun coverColor(): Int? fun coverColor(): Int?
fun mangaPresenter(): MangaPresenter fun mangaPresenter(): MangaDetailsPresenter
fun prepareToShareManga() fun prepareToShareManga()
fun readNextChapter() fun readNextChapter()
fun downloadChapter(position: Int) fun downloadChapter(position: Int)

View File

@ -17,7 +17,7 @@ import eu.kanade.tachiyomi.data.database.models.MangaImpl
import eu.kanade.tachiyomi.data.glide.GlideApp import eu.kanade.tachiyomi.data.glide.GlideApp
import eu.kanade.tachiyomi.source.LocalSource import eu.kanade.tachiyomi.source.LocalSource
import eu.kanade.tachiyomi.ui.base.controller.DialogController import eu.kanade.tachiyomi.ui.base.controller.DialogController
import eu.kanade.tachiyomi.ui.manga.MangaChaptersController import eu.kanade.tachiyomi.ui.manga.MangaDetailsController
import eu.kanade.tachiyomi.util.lang.chop import eu.kanade.tachiyomi.util.lang.chop
import eu.kanade.tachiyomi.util.system.toast import eu.kanade.tachiyomi.util.system.toast
import kotlinx.android.synthetic.main.edit_manga_dialog.view.* import kotlinx.android.synthetic.main.edit_manga_dialog.view.*
@ -35,9 +35,9 @@ class EditMangaDialog : DialogController {
private var customCoverUri:Uri? = null private var customCoverUri:Uri? = null
private val infoController private val infoController
get() = targetController as MangaChaptersController get() = targetController as MangaDetailsController
constructor(target: MangaChaptersController, manga: Manga) : super(Bundle() constructor(target: MangaDetailsController, manga: Manga) : super(Bundle()
.apply { .apply {
putLong(KEY_MANGA, manga.id!!) putLong(KEY_MANGA, manga.id!!)
}) { }) {

View File

@ -13,7 +13,7 @@ import eu.kanade.tachiyomi.source.Source
import eu.kanade.tachiyomi.source.SourceManager import eu.kanade.tachiyomi.source.SourceManager
import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction
import eu.kanade.tachiyomi.ui.base.holder.BaseFlexibleViewHolder import eu.kanade.tachiyomi.ui.base.holder.BaseFlexibleViewHolder
import eu.kanade.tachiyomi.ui.manga.MangaChaptersController import eu.kanade.tachiyomi.ui.manga.MangaDetailsController
import eu.kanade.tachiyomi.util.system.getResourceColor import eu.kanade.tachiyomi.util.system.getResourceColor
import eu.kanade.tachiyomi.util.system.launchUI import eu.kanade.tachiyomi.util.system.launchUI
import eu.kanade.tachiyomi.util.view.gone import eu.kanade.tachiyomi.util.view.gone
@ -69,7 +69,7 @@ class MigrationProcessHolder(
migration_manga_card_from.attachManga(manga, source, false) migration_manga_card_from.attachManga(manga, source, false)
migration_manga_card_from.setOnClickListener { migration_manga_card_from.setOnClickListener {
adapter.controller.router.pushController( adapter.controller.router.pushController(
MangaChaptersController( MangaDetailsController(
manga, true manga, true
).withFadeTransaction() ).withFadeTransaction()
) )
@ -101,7 +101,7 @@ class MigrationProcessHolder(
migration_manga_card_to.attachManga(searchResult, resultSource, true) migration_manga_card_to.attachManga(searchResult, resultSource, true)
migration_manga_card_to.setOnClickListener { migration_manga_card_to.setOnClickListener {
adapter.controller.router.pushController( adapter.controller.router.pushController(
MangaChaptersController( MangaDetailsController(
searchResult, true searchResult, true
).withFadeTransaction() ).withFadeTransaction()
) )

View File

@ -24,7 +24,7 @@ import eu.kanade.tachiyomi.ui.base.controller.NoToolbarElevationController
import eu.kanade.tachiyomi.ui.base.controller.NucleusController import eu.kanade.tachiyomi.ui.base.controller.NucleusController
import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction
import eu.kanade.tachiyomi.ui.main.MainActivity import eu.kanade.tachiyomi.ui.main.MainActivity
import eu.kanade.tachiyomi.ui.manga.MangaChaptersController import eu.kanade.tachiyomi.ui.manga.MangaDetailsController
import eu.kanade.tachiyomi.ui.reader.ReaderActivity import eu.kanade.tachiyomi.ui.reader.ReaderActivity
import eu.kanade.tachiyomi.ui.recently_read.RecentlyReadController import eu.kanade.tachiyomi.ui.recently_read.RecentlyReadController
import eu.kanade.tachiyomi.util.system.notificationManager import eu.kanade.tachiyomi.util.system.notificationManager
@ -274,7 +274,7 @@ class RecentChaptersController : NucleusController<RecentChaptersPresenter>(),
} }
fun openManga(chapter: RecentChapterItem) { fun openManga(chapter: RecentChapterItem) {
router.pushController(MangaChaptersController(chapter.manga).withFadeTransaction()) router.pushController(MangaDetailsController(chapter.manga).withFadeTransaction())
} }
/** /**

View File

@ -20,7 +20,7 @@ import eu.kanade.tachiyomi.ui.base.controller.BaseController
import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction
import eu.kanade.tachiyomi.ui.catalogue.browse.ProgressItem import eu.kanade.tachiyomi.ui.catalogue.browse.ProgressItem
import eu.kanade.tachiyomi.ui.main.MainActivity import eu.kanade.tachiyomi.ui.main.MainActivity
import eu.kanade.tachiyomi.ui.manga.MangaChaptersController import eu.kanade.tachiyomi.ui.manga.MangaDetailsController
import eu.kanade.tachiyomi.ui.reader.ReaderActivity import eu.kanade.tachiyomi.ui.reader.ReaderActivity
import eu.kanade.tachiyomi.ui.recent_updates.RecentChaptersController import eu.kanade.tachiyomi.ui.recent_updates.RecentChaptersController
import eu.kanade.tachiyomi.util.system.launchUI import eu.kanade.tachiyomi.util.system.launchUI
@ -179,7 +179,7 @@ class RecentlyReadController(bundle: Bundle? = null) : BaseController(bundle),
override fun onCoverClick(position: Int, lastTouchY: Float) { override fun onCoverClick(position: Int, lastTouchY: Float) {
val manga = (adapter?.getItem(position) as? RecentlyReadItem)?.mch?.manga ?: return val manga = (adapter?.getItem(position) as? RecentlyReadItem)?.mch?.manga ?: return
router.pushController(MangaChaptersController(manga).withFadeTransaction()) router.pushController(MangaDetailsController(manga).withFadeTransaction())
} }
override fun removeHistory(manga: Manga, history: History, all: Boolean) { override fun removeHistory(manga: Manga, history: History, all: Boolean) {