Clean up repetitive controller transactions

This commit is contained in:
arkon 2022-04-23 12:10:32 -04:00
parent d6c87ec10e
commit 7e2f1d729f
21 changed files with 71 additions and 82 deletions

View File

@ -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<String>, requestCode: Int) {
val activity = activity ?: return
permissions.forEach { permission ->

View File

@ -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) {

View File

@ -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 {

View File

@ -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 {

View File

@ -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))
}
}

View File

@ -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
}

View File

@ -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))
}
}

View File

@ -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
}

View File

@ -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))
}
}

View File

@ -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<T>(bundle: Bundle? = null) :
libController.clearSelection()
}
router.popCurrentController()
router.pushController(CategoryController().withFadeTransaction())
router.pushController(CategoryController())
}
interface Listener {

View File

@ -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))
}
/**

View File

@ -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 -> {

View File

@ -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

View File

@ -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())
},
)
}

View File

@ -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 {

View File

@ -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<HistoryPresenter>(), RootController
nestedScrollInterop = nestedScrollInterop,
presenter = presenter,
onClickCover = { history ->
router.pushController(MangaController(history).withFadeTransaction())
router.pushController(MangaController(history))
},
onClickResume = { history ->
presenter.getNextChapterForManga(history.mangaId, history.chapterId)

View File

@ -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))
}
/**

View File

@ -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())
}
}
}

View File

@ -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())
}
}

View File

@ -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
}

View File

@ -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)
}
}