From 7e2f1d729f3876515342d6e7d25cf4df1005d711 Mon Sep 17 00:00:00 2001 From: arkon Date: Sat, 23 Apr 2022 12:10:32 -0400 Subject: [PATCH] Clean up repetitive controller transactions --- .../ui/base/controller/ConductorExtensions.kt | 4 +++ .../browse/extension/ExtensionController.kt | 8 ++---- .../details/ExtensionDetailsController.kt | 6 ++-- .../manga/MigrationMangaController.kt | 6 ++-- .../migration/search/SearchController.kt | 4 +-- .../sources/MigrationSourcesController.kt | 4 +-- .../ui/browse/source/SourceController.kt | 13 +++------ .../source/browse/BrowseSourceController.kt | 4 +-- .../globalsearch/GlobalSearchController.kt | 6 ++-- .../ui/library/ChangeMangaCategoriesDialog.kt | 4 +-- .../tachiyomi/ui/library/LibraryController.kt | 8 ++---- .../kanade/tachiyomi/ui/main/MainActivity.kt | 14 +++++----- .../tachiyomi/ui/manga/MangaController.kt | 8 +++--- .../tachiyomi/ui/more/AboutController.kt | 4 +-- .../tachiyomi/ui/more/MoreController.kt | 12 ++++---- .../ui/recent/history/HistoryController.kt | 4 +-- .../ui/recent/updates/UpdatesController.kt | 4 +-- .../ui/setting/SettingsAdvancedController.kt | 4 +-- .../ui/setting/SettingsLibraryController.kt | 4 +-- .../ui/setting/SettingsMainController.kt | 28 ++++++++----------- .../search/SettingsSearchController.kt | 4 +-- 21 files changed, 71 insertions(+), 82 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/base/controller/ConductorExtensions.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/base/controller/ConductorExtensions.kt index bc7ef0b6f8..b2afdb5d3e 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/base/controller/ConductorExtensions.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/base/controller/ConductorExtensions.kt @@ -22,6 +22,10 @@ fun Router.popControllerWithTag(tag: String): Boolean { return false } +fun Router.pushController(controller: Controller) { + pushController(controller.withFadeTransaction()) +} + fun Controller.requestPermissionsSafe(permissions: Array, requestCode: Int) { val activity = activity ?: return permissions.forEach { permission -> diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/extension/ExtensionController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/extension/ExtensionController.kt index 48a15ba992..7b1aa7b3d1 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/extension/ExtensionController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/extension/ExtensionController.kt @@ -17,7 +17,7 @@ import eu.kanade.tachiyomi.databinding.ExtensionControllerBinding import eu.kanade.tachiyomi.extension.model.Extension import eu.kanade.tachiyomi.source.online.HttpSource import eu.kanade.tachiyomi.ui.base.controller.NucleusController -import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction +import eu.kanade.tachiyomi.ui.base.controller.pushController import eu.kanade.tachiyomi.ui.browse.BrowseController import eu.kanade.tachiyomi.ui.browse.extension.details.ExtensionDetailsController import kotlinx.coroutines.flow.drop @@ -92,9 +92,7 @@ open class ExtensionController : when (item.itemId) { R.id.action_search -> expandActionViewFromInteraction = true R.id.action_settings -> { - parentController!!.router.pushController( - ExtensionFilterController().withFadeTransaction(), - ) + parentController!!.router.pushController(ExtensionFilterController()) } } return super.onOptionsItemSelected(item) @@ -172,7 +170,7 @@ open class ExtensionController : private fun openDetails(extension: Extension.Installed) { val controller = ExtensionDetailsController(extension.pkgName) - parentController!!.router.pushController(controller.withFadeTransaction()) + parentController!!.router.pushController(controller) } private fun openTrustDialog(extension: Extension.Untrusted) { diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/extension/details/ExtensionDetailsController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/extension/details/ExtensionDetailsController.kt index 7d76967e1a..4afa9122db 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/extension/details/ExtensionDetailsController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/extension/details/ExtensionDetailsController.kt @@ -31,7 +31,7 @@ import eu.kanade.tachiyomi.source.getPreferenceKey import eu.kanade.tachiyomi.source.online.HttpSource import eu.kanade.tachiyomi.ui.base.controller.NucleusController import eu.kanade.tachiyomi.ui.base.controller.openInBrowser -import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction +import eu.kanade.tachiyomi.ui.base.controller.pushController import eu.kanade.tachiyomi.util.preference.DSL import eu.kanade.tachiyomi.util.preference.minusAssign import eu.kanade.tachiyomi.util.preference.onChange @@ -165,9 +165,7 @@ class ExtensionDetailsController(bundle: Bundle? = null) : switchSettingsPreference { block() onSettingsClick = View.OnClickListener { - router.pushController( - SourcePreferencesController(source.id).withFadeTransaction(), - ) + router.pushController(SourcePreferencesController(source.id)) } } } else { diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/manga/MigrationMangaController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/manga/MigrationMangaController.kt index 6762057245..da427905b1 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/manga/MigrationMangaController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/manga/MigrationMangaController.kt @@ -9,7 +9,7 @@ import dev.chrisbanes.insetter.applyInsetter import eu.davidea.flexibleadapter.FlexibleAdapter import eu.kanade.tachiyomi.databinding.MigrationMangaControllerBinding import eu.kanade.tachiyomi.ui.base.controller.NucleusController -import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction +import eu.kanade.tachiyomi.ui.base.controller.pushController import eu.kanade.tachiyomi.ui.browse.migration.search.SearchController import eu.kanade.tachiyomi.ui.manga.MangaController @@ -73,13 +73,13 @@ class MigrationMangaController : override fun onItemClick(view: View, position: Int): Boolean { val item = adapter?.getItem(position) as? MigrationMangaItem ?: return false val controller = SearchController(item.manga) - router.pushController(controller.withFadeTransaction()) + router.pushController(controller) return false } override fun onCoverClick(position: Int) { val mangaItem = adapter?.getItem(position) as? MigrationMangaItem ?: return - router.pushController(MangaController(mangaItem.manga).withFadeTransaction()) + router.pushController(MangaController(mangaItem.manga)) } companion object { diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/search/SearchController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/search/SearchController.kt index 0c103d7feb..38d1fb5a3b 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/search/SearchController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/search/SearchController.kt @@ -11,7 +11,7 @@ import eu.kanade.tachiyomi.data.database.models.Manga import eu.kanade.tachiyomi.data.preference.PreferencesHelper import eu.kanade.tachiyomi.source.CatalogueSource import eu.kanade.tachiyomi.ui.base.controller.DialogController -import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction +import eu.kanade.tachiyomi.ui.base.controller.pushController import eu.kanade.tachiyomi.ui.browse.migration.MigrationFlags import eu.kanade.tachiyomi.ui.browse.source.globalsearch.GlobalSearchController import eu.kanade.tachiyomi.ui.browse.source.globalsearch.GlobalSearchPresenter @@ -137,6 +137,6 @@ class SearchController( override fun onTitleClick(source: CatalogueSource) { presenter.preferences.lastUsedSource().set(source.id) - router.pushController(SourceSearchController(manga, source, presenter.query).withFadeTransaction()) + router.pushController(SourceSearchController(manga, source, presenter.query)) } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/sources/MigrationSourcesController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/sources/MigrationSourcesController.kt index 81adb4aec7..1844836b62 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/sources/MigrationSourcesController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/sources/MigrationSourcesController.kt @@ -12,7 +12,7 @@ import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.data.preference.PreferencesHelper import eu.kanade.tachiyomi.databinding.MigrationSourcesControllerBinding import eu.kanade.tachiyomi.ui.base.controller.NucleusController -import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction +import eu.kanade.tachiyomi.ui.base.controller.pushController import eu.kanade.tachiyomi.ui.browse.migration.manga.MigrationMangaController import eu.kanade.tachiyomi.util.system.copyToClipboard import eu.kanade.tachiyomi.util.system.openInBrowser @@ -101,7 +101,7 @@ class MigrationSourcesController : override fun onItemClick(view: View, position: Int): Boolean { val item = adapter?.getItem(position) as? SourceItem ?: return false val controller = MigrationMangaController(item.source.id, item.source.name) - parentController!!.router.pushController(controller.withFadeTransaction()) + parentController!!.router.pushController(controller) return false } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/SourceController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/SourceController.kt index 0b1590d39b..2afcda1e8c 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/SourceController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/SourceController.kt @@ -23,8 +23,8 @@ import eu.kanade.tachiyomi.source.LocalSource import eu.kanade.tachiyomi.source.Source import eu.kanade.tachiyomi.ui.base.controller.DialogController import eu.kanade.tachiyomi.ui.base.controller.SearchableNucleusController +import eu.kanade.tachiyomi.ui.base.controller.pushController import eu.kanade.tachiyomi.ui.base.controller.requestPermissionsSafe -import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction import eu.kanade.tachiyomi.ui.browse.BrowseController import eu.kanade.tachiyomi.ui.browse.source.browse.BrowseSourceController import eu.kanade.tachiyomi.ui.browse.source.globalsearch.GlobalSearchController @@ -180,7 +180,7 @@ class SourceController : if (!preferences.incognitoMode().get()) { preferences.lastUsedSource().set(source.id) } - parentController!!.router.pushController(controller.withFadeTransaction()) + parentController!!.router.pushController(controller) } /** @@ -193,10 +193,7 @@ class SourceController : when (item.itemId) { // Initialize option to open catalogue settings. R.id.action_settings -> { - parentController!!.router.pushController( - SourceFilterController() - .withFadeTransaction(), - ) + parentController!!.router.pushController(SourceFilterController()) } } return super.onOptionsItemSelected(item) @@ -253,8 +250,6 @@ class SourceController : } override fun onSearchViewQueryTextSubmit(query: String?) { - parentController!!.router.pushController( - GlobalSearchController(query).withFadeTransaction(), - ) + parentController!!.router.pushController(GlobalSearchController(query)) } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/browse/BrowseSourceController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/browse/BrowseSourceController.kt index 5aa9d84fe2..78c1456731 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/browse/BrowseSourceController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/browse/BrowseSourceController.kt @@ -32,7 +32,7 @@ import eu.kanade.tachiyomi.source.model.FilterList import eu.kanade.tachiyomi.source.online.HttpSource import eu.kanade.tachiyomi.ui.base.controller.FabController import eu.kanade.tachiyomi.ui.base.controller.SearchableNucleusController -import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction +import eu.kanade.tachiyomi.ui.base.controller.pushController import eu.kanade.tachiyomi.ui.browse.source.globalsearch.GlobalSearchController import eu.kanade.tachiyomi.ui.library.ChangeMangaCategoriesDialog import eu.kanade.tachiyomi.ui.library.setting.DisplayModeSetting @@ -569,7 +569,7 @@ open class BrowseSourceController(bundle: Bundle) : */ override fun onItemClick(view: View, position: Int): Boolean { val item = adapter?.getItem(position) as? SourceItem ?: return false - router.pushController(MangaController(item.manga, true).withFadeTransaction()) + router.pushController(MangaController(item.manga, true)) return false } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/globalsearch/GlobalSearchController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/globalsearch/GlobalSearchController.kt index 94aeb7751d..7103ea7e80 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/globalsearch/GlobalSearchController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/globalsearch/GlobalSearchController.kt @@ -16,7 +16,7 @@ import eu.kanade.tachiyomi.data.preference.PreferencesHelper import eu.kanade.tachiyomi.databinding.GlobalSearchControllerBinding import eu.kanade.tachiyomi.source.CatalogueSource import eu.kanade.tachiyomi.ui.base.controller.SearchableNucleusController -import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction +import eu.kanade.tachiyomi.ui.base.controller.pushController import eu.kanade.tachiyomi.ui.browse.source.browse.BrowseSourceController import eu.kanade.tachiyomi.ui.manga.MangaController import uy.kohesive.injekt.injectLazy @@ -65,7 +65,7 @@ open class GlobalSearchController( * @param manga clicked item containing manga information. */ override fun onMangaClick(manga: Manga) { - router.pushController(MangaController(manga, true).withFadeTransaction()) + router.pushController(MangaController(manga, true)) } /** @@ -207,6 +207,6 @@ open class GlobalSearchController( if (!preferences.incognitoMode().get()) { preferences.lastUsedSource().set(source.id) } - router.pushController(BrowseSourceController(source, presenter.query).withFadeTransaction()) + router.pushController(BrowseSourceController(source, presenter.query)) } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/ChangeMangaCategoriesDialog.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/ChangeMangaCategoriesDialog.kt index 224a7555b8..1aaa06a277 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/ChangeMangaCategoriesDialog.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/ChangeMangaCategoriesDialog.kt @@ -8,7 +8,7 @@ import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.data.database.models.Category import eu.kanade.tachiyomi.data.database.models.Manga import eu.kanade.tachiyomi.ui.base.controller.DialogController -import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction +import eu.kanade.tachiyomi.ui.base.controller.pushController import eu.kanade.tachiyomi.ui.category.CategoryController import eu.kanade.tachiyomi.widget.materialdialogs.QuadStateTextView import eu.kanade.tachiyomi.widget.materialdialogs.setQuadStateMultiChoiceItems @@ -71,7 +71,7 @@ class ChangeMangaCategoriesDialog(bundle: Bundle? = null) : libController.clearSelection() } router.popCurrentController() - router.pushController(CategoryController().withFadeTransaction()) + router.pushController(CategoryController()) } interface Listener { diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryController.kt index 291892bc10..cd70881dce 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryController.kt @@ -26,7 +26,7 @@ import eu.kanade.tachiyomi.source.LocalSource import eu.kanade.tachiyomi.ui.base.controller.RootController import eu.kanade.tachiyomi.ui.base.controller.SearchableNucleusController import eu.kanade.tachiyomi.ui.base.controller.TabbedController -import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction +import eu.kanade.tachiyomi.ui.base.controller.pushController import eu.kanade.tachiyomi.ui.browse.source.globalsearch.GlobalSearchController import eu.kanade.tachiyomi.ui.main.MainActivity import eu.kanade.tachiyomi.ui.manga.MangaController @@ -210,9 +210,7 @@ class LibraryController( binding.btnGlobalSearch.clicks() .onEach { - router.pushController( - GlobalSearchController(presenter.query).withFadeTransaction(), - ) + router.pushController(GlobalSearchController(presenter.query)) } .launchIn(viewScope) } @@ -494,7 +492,7 @@ class LibraryController( // Notify the presenter a manga is being opened. presenter.onOpenManga() - router.pushController(MangaController(manga).withFadeTransaction()) + router.pushController(MangaController(manga)) } /** diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt index 04dc530363..eceffc24ee 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt @@ -46,8 +46,8 @@ import eu.kanade.tachiyomi.ui.base.controller.FabController import eu.kanade.tachiyomi.ui.base.controller.NoAppBarElevationController import eu.kanade.tachiyomi.ui.base.controller.RootController import eu.kanade.tachiyomi.ui.base.controller.TabbedController +import eu.kanade.tachiyomi.ui.base.controller.pushController import eu.kanade.tachiyomi.ui.base.controller.setRoot -import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction import eu.kanade.tachiyomi.ui.browse.BrowseController import eu.kanade.tachiyomi.ui.browse.source.browse.BrowseSourceController import eu.kanade.tachiyomi.ui.browse.source.globalsearch.GlobalSearchController @@ -182,12 +182,12 @@ class MainActivity : BaseActivity() { } R.id.nav_updates -> { if (router.backstackSize == 1) { - router.pushController(DownloadController().withFadeTransaction()) + router.pushController(DownloadController()) } } R.id.nav_more -> { if (router.backstackSize == 1) { - router.pushController(SettingsMainController().withFadeTransaction()) + router.pushController(SettingsMainController()) } } } @@ -408,7 +408,7 @@ class MainActivity : BaseActivity() { router.popToRoot() } setSelectedNavItem(R.id.nav_browse) - router.pushController(BrowseController(toExtensions = true).withFadeTransaction()) + router.pushController(BrowseController(toExtensions = true)) } SHORTCUT_MANGA -> { val extras = intent.extras ?: return false @@ -424,7 +424,7 @@ class MainActivity : BaseActivity() { router.popToRoot() } setSelectedNavItem(R.id.nav_more) - router.pushController(DownloadController().withFadeTransaction()) + router.pushController(DownloadController()) } Intent.ACTION_SEARCH, Intent.ACTION_SEND, "com.google.android.gms.actions.SEARCH_ACTION" -> { // If the intent match the "standard" Android search intent @@ -436,7 +436,7 @@ class MainActivity : BaseActivity() { if (router.backstackSize > 1) { router.popToRoot() } - router.pushController(GlobalSearchController(query).withFadeTransaction()) + router.pushController(GlobalSearchController(query)) } } INTENT_SEARCH -> { @@ -446,7 +446,7 @@ class MainActivity : BaseActivity() { if (router.backstackSize > 1) { router.popToRoot() } - router.pushController(GlobalSearchController(query, filter).withFadeTransaction()) + router.pushController(GlobalSearchController(query, filter)) } } else -> { diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaController.kt index 89f8c7295a..e5e94552e2 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaController.kt @@ -60,7 +60,7 @@ import eu.kanade.tachiyomi.ui.base.controller.DialogController import eu.kanade.tachiyomi.ui.base.controller.FabController import eu.kanade.tachiyomi.ui.base.controller.NucleusController import eu.kanade.tachiyomi.ui.base.controller.getMainAppBarHeight -import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction +import eu.kanade.tachiyomi.ui.base.controller.pushController import eu.kanade.tachiyomi.ui.browse.migration.search.SearchController import eu.kanade.tachiyomi.ui.browse.source.browse.BrowseSourceController import eu.kanade.tachiyomi.ui.browse.source.globalsearch.GlobalSearchController @@ -553,7 +553,7 @@ class MangaController : } setNegativeButton(activity?.getString(R.string.action_cancel)) { _, _ -> } setNeutralButton(activity?.getString(R.string.action_show_manga)) { _, _ -> - router.pushController(MangaController(libraryManga).withFadeTransaction()) + router.pushController(MangaController(libraryManga)) } setCancelable(true) }.create().show() @@ -687,7 +687,7 @@ class MangaController : * @param query the search query to pass to the search controller */ fun performGlobalSearch(query: String) { - router.pushController(GlobalSearchController(query).withFadeTransaction()) + router.pushController(GlobalSearchController(query)) } /** @@ -886,7 +886,7 @@ class MangaController : private fun migrateManga() { val controller = SearchController(presenter.manga) controller.targetController = this - router.pushController(controller.withFadeTransaction()) + router.pushController(controller) } // Manga info - end diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/more/AboutController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/more/AboutController.kt index 3fb5762738..3f2384d4fa 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/more/AboutController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/more/AboutController.kt @@ -10,7 +10,7 @@ import eu.kanade.tachiyomi.data.updater.AppUpdateChecker import eu.kanade.tachiyomi.data.updater.AppUpdateResult import eu.kanade.tachiyomi.ui.base.controller.BasicComposeController import eu.kanade.tachiyomi.ui.base.controller.NoAppBarElevationController -import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction +import eu.kanade.tachiyomi.ui.base.controller.pushController import eu.kanade.tachiyomi.util.lang.launchNow import eu.kanade.tachiyomi.util.lang.toDateTimestampString import eu.kanade.tachiyomi.util.system.logcat @@ -36,7 +36,7 @@ class AboutController : BasicComposeController(), NoAppBarElevationController { checkVersion = this::checkVersion, getFormattedBuildTime = this::getFormattedBuildTime, onClickLicenses = { - router.pushController(LicensesController().withFadeTransaction()) + router.pushController(LicensesController()) }, ) } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/more/MoreController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/more/MoreController.kt index 2b99508f84..9cc77dcd42 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/more/MoreController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/more/MoreController.kt @@ -11,7 +11,7 @@ import eu.kanade.tachiyomi.data.download.DownloadManager import eu.kanade.tachiyomi.data.download.DownloadService import eu.kanade.tachiyomi.ui.base.controller.NoAppBarElevationController import eu.kanade.tachiyomi.ui.base.controller.RootController -import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction +import eu.kanade.tachiyomi.ui.base.controller.pushController import eu.kanade.tachiyomi.ui.category.CategoryController import eu.kanade.tachiyomi.ui.download.DownloadController import eu.kanade.tachiyomi.ui.setting.SettingsBackupController @@ -87,7 +87,7 @@ class MoreController : iconRes = R.drawable.ic_get_app_24dp iconTint = tintColor onClick { - router.pushController(DownloadController().withFadeTransaction()) + router.pushController(DownloadController()) } } preference { @@ -95,7 +95,7 @@ class MoreController : iconRes = R.drawable.ic_label_24dp iconTint = tintColor onClick { - router.pushController(CategoryController().withFadeTransaction()) + router.pushController(CategoryController()) } } preference { @@ -103,7 +103,7 @@ class MoreController : iconRes = R.drawable.ic_settings_backup_restore_24dp iconTint = tintColor onClick { - router.pushController(SettingsBackupController().withFadeTransaction()) + router.pushController(SettingsBackupController()) } } } @@ -114,7 +114,7 @@ class MoreController : iconRes = R.drawable.ic_settings_24dp iconTint = tintColor onClick { - router.pushController(SettingsMainController().withFadeTransaction()) + router.pushController(SettingsMainController()) } } preference { @@ -122,7 +122,7 @@ class MoreController : iconTint = tintColor titleRes = R.string.pref_category_about onClick { - router.pushController(AboutController().withFadeTransaction()) + router.pushController(AboutController()) } } preference { diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/recent/history/HistoryController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/recent/history/HistoryController.kt index bf6cdd61ef..c60964d2eb 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/recent/history/HistoryController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/recent/history/HistoryController.kt @@ -11,7 +11,7 @@ import eu.kanade.presentation.history.HistoryScreen import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.ui.base.controller.ComposeController import eu.kanade.tachiyomi.ui.base.controller.RootController -import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction +import eu.kanade.tachiyomi.ui.base.controller.pushController import eu.kanade.tachiyomi.ui.manga.MangaController import eu.kanade.tachiyomi.ui.reader.ReaderActivity import eu.kanade.tachiyomi.util.system.toast @@ -34,7 +34,7 @@ class HistoryController : ComposeController(), RootController nestedScrollInterop = nestedScrollInterop, presenter = presenter, onClickCover = { history -> - router.pushController(MangaController(history).withFadeTransaction()) + router.pushController(MangaController(history)) }, onClickResume = { history -> presenter.getNextChapterForManga(history.mangaId, history.chapterId) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/recent/updates/UpdatesController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/recent/updates/UpdatesController.kt index c2aedebe6e..a024023fe1 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/recent/updates/UpdatesController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/recent/updates/UpdatesController.kt @@ -20,7 +20,7 @@ import eu.kanade.tachiyomi.data.notification.Notifications import eu.kanade.tachiyomi.databinding.UpdatesControllerBinding import eu.kanade.tachiyomi.ui.base.controller.NucleusController import eu.kanade.tachiyomi.ui.base.controller.RootController -import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction +import eu.kanade.tachiyomi.ui.base.controller.pushController import eu.kanade.tachiyomi.ui.main.MainActivity import eu.kanade.tachiyomi.ui.manga.MangaController import eu.kanade.tachiyomi.ui.manga.chapter.base.BaseChaptersAdapter @@ -282,7 +282,7 @@ class UpdatesController : } private fun openManga(chapter: UpdatesItem) { - router.pushController(MangaController(chapter.manga).withFadeTransaction()) + router.pushController(MangaController(chapter.manga)) } /** diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsAdvancedController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsAdvancedController.kt index e94d6be088..6ee343e7f2 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsAdvancedController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsAdvancedController.kt @@ -21,7 +21,7 @@ import eu.kanade.tachiyomi.network.PREF_DOH_CLOUDFLARE import eu.kanade.tachiyomi.network.PREF_DOH_GOOGLE import eu.kanade.tachiyomi.network.PREF_DOH_QUAD9 import eu.kanade.tachiyomi.ui.base.controller.openInBrowser -import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction +import eu.kanade.tachiyomi.ui.base.controller.pushController import eu.kanade.tachiyomi.ui.setting.database.ClearDatabaseController import eu.kanade.tachiyomi.util.CrashLogUtil import eu.kanade.tachiyomi.util.lang.launchIO @@ -149,7 +149,7 @@ class SettingsAdvancedController : SettingsController() { summaryRes = R.string.pref_clear_database_summary onClick { - router.pushController(ClearDatabaseController().withFadeTransaction()) + router.pushController(ClearDatabaseController()) } } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsLibraryController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsLibraryController.kt index 98b9f3fa06..b1e82abf02 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsLibraryController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsLibraryController.kt @@ -20,7 +20,7 @@ import eu.kanade.tachiyomi.data.preference.PreferencesHelper import eu.kanade.tachiyomi.data.track.TrackManager import eu.kanade.tachiyomi.databinding.PrefLibraryColumnsBinding import eu.kanade.tachiyomi.ui.base.controller.DialogController -import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction +import eu.kanade.tachiyomi.ui.base.controller.pushController import eu.kanade.tachiyomi.ui.category.CategoryController import eu.kanade.tachiyomi.util.preference.bindTo import eu.kanade.tachiyomi.util.preference.defaultValue @@ -103,7 +103,7 @@ class SettingsLibraryController : SettingsController() { summary = context.resources.getQuantityString(R.plurals.num_categories, catCount, catCount) onClick { - router.pushController(CategoryController().withFadeTransaction()) + router.pushController(CategoryController()) } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsMainController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsMainController.kt index 3c1de2a572..5fb7f232d5 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsMainController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsMainController.kt @@ -6,7 +6,7 @@ import android.view.MenuItem import androidx.appcompat.widget.SearchView import androidx.preference.PreferenceScreen import eu.kanade.tachiyomi.R -import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction +import eu.kanade.tachiyomi.ui.base.controller.pushController import eu.kanade.tachiyomi.ui.setting.search.SettingsSearchController import eu.kanade.tachiyomi.util.preference.iconRes import eu.kanade.tachiyomi.util.preference.iconTint @@ -26,68 +26,64 @@ class SettingsMainController : SettingsController() { iconRes = R.drawable.ic_tune_24dp iconTint = tintColor titleRes = R.string.pref_category_general - onClick { navigateTo(SettingsGeneralController()) } + onClick { router.pushController(SettingsGeneralController()) } } preference { iconRes = R.drawable.ic_palette_24dp iconTint = tintColor titleRes = R.string.pref_category_appearance - onClick { navigateTo(SettingsAppearanceController()) } + onClick { router.pushController(SettingsAppearanceController()) } } preference { iconRes = R.drawable.ic_library_outline_24dp iconTint = tintColor titleRes = R.string.pref_category_library - onClick { navigateTo(SettingsLibraryController()) } + onClick { router.pushController(SettingsLibraryController()) } } preference { iconRes = R.drawable.ic_chrome_reader_mode_24dp iconTint = tintColor titleRes = R.string.pref_category_reader - onClick { navigateTo(SettingsReaderController()) } + onClick { router.pushController(SettingsReaderController()) } } preference { iconRes = R.drawable.ic_get_app_24dp iconTint = tintColor titleRes = R.string.pref_category_downloads - onClick { navigateTo(SettingsDownloadController()) } + onClick { router.pushController(SettingsDownloadController()) } } preference { iconRes = R.drawable.ic_sync_24dp iconTint = tintColor titleRes = R.string.pref_category_tracking - onClick { navigateTo(SettingsTrackingController()) } + onClick { router.pushController(SettingsTrackingController()) } } preference { iconRes = R.drawable.ic_browse_outline_24dp iconTint = tintColor titleRes = R.string.browse - onClick { navigateTo(SettingsBrowseController()) } + onClick { router.pushController(SettingsBrowseController()) } } preference { iconRes = R.drawable.ic_settings_backup_restore_24dp iconTint = tintColor titleRes = R.string.label_backup - onClick { navigateTo(SettingsBackupController()) } + onClick { router.pushController(SettingsBackupController()) } } preference { iconRes = R.drawable.ic_security_24dp iconTint = tintColor titleRes = R.string.pref_category_security - onClick { navigateTo(SettingsSecurityController()) } + onClick { router.pushController(SettingsSecurityController()) } } preference { iconRes = R.drawable.ic_code_24dp iconTint = tintColor titleRes = R.string.pref_category_advanced - onClick { navigateTo(SettingsAdvancedController()) } + onClick { router.pushController(SettingsAdvancedController()) } } } - private fun navigateTo(controller: SettingsController) { - router.pushController(controller.withFadeTransaction()) - } - override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) { // Inflate menu inflater.inflate(R.menu.settings_main, menu) @@ -104,7 +100,7 @@ class SettingsMainController : SettingsController() { object : MenuItem.OnActionExpandListener { override fun onMenuItemActionExpand(item: MenuItem?): Boolean { preferences.lastSearchQuerySearchSettings().set("") // reset saved search query - router.pushController(SettingsSearchController().withFadeTransaction()) + router.pushController(SettingsSearchController()) return true } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/search/SettingsSearchController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/search/SettingsSearchController.kt index 462042abc3..94826ef5ad 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/search/SettingsSearchController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/search/SettingsSearchController.kt @@ -12,7 +12,7 @@ import dev.chrisbanes.insetter.applyInsetter import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.databinding.SettingsSearchControllerBinding import eu.kanade.tachiyomi.ui.base.controller.NucleusController -import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction +import eu.kanade.tachiyomi.ui.base.controller.pushController import eu.kanade.tachiyomi.ui.setting.SettingsController /** @@ -158,6 +158,6 @@ class SettingsSearchController : presenter.preferences.lastSearchQuerySearchSettings().set(it.toString()) } - router.pushController(ctrl.withFadeTransaction()) + router.pushController(ctrl) } }