From 0473c36c6f4b58f7c7cbb0373b738c890652abea Mon Sep 17 00:00:00 2001 From: arkon Date: Tue, 4 Feb 2020 22:15:41 -0500 Subject: [PATCH] Restore setting controller fade Removes help button in each section, which is jumpy. Fade is nicer though. --- .../ui/setting/BaseSettingsController.kt | 30 ------------------- .../ui/setting/SettingsAboutController.kt | 2 +- .../ui/setting/SettingsAdvancedController.kt | 2 +- .../ui/setting/SettingsBackupController.kt | 2 +- .../ui/setting/SettingsDownloadController.kt | 2 +- .../ui/setting/SettingsGeneralController.kt | 2 +- .../ui/setting/SettingsLibraryController.kt | 2 +- .../ui/setting/SettingsMainController.kt | 30 +++++++++++++++++-- .../ui/setting/SettingsReaderController.kt | 2 +- .../ui/setting/SettingsTrackingController.kt | 2 +- 10 files changed, 35 insertions(+), 41 deletions(-) delete mode 100644 app/src/main/java/eu/kanade/tachiyomi/ui/setting/BaseSettingsController.kt diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/BaseSettingsController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/BaseSettingsController.kt deleted file mode 100644 index 902952f86..000000000 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/BaseSettingsController.kt +++ /dev/null @@ -1,30 +0,0 @@ -package eu.kanade.tachiyomi.ui.setting - -import android.view.Menu -import android.view.MenuInflater -import android.view.MenuItem -import eu.kanade.tachiyomi.R -import eu.kanade.tachiyomi.util.system.openInBrowser - -abstract class BaseSettingsController : SettingsController() { - - init { - setHasOptionsMenu(true) - } - - override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) { - inflater.inflate(R.menu.settings, menu) - } - - override fun onOptionsItemSelected(item: MenuItem): Boolean { - when (item.itemId) { - R.id.action_help -> activity?.openInBrowser(URL_HELP) - } - - return super.onOptionsItemSelected(item) - } - - companion object { - private const val URL_HELP = "https://tachiyomi.org/help/" - } -} diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsAboutController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsAboutController.kt index c14a48b39..0200adf39 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsAboutController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsAboutController.kt @@ -31,7 +31,7 @@ import java.util.Locale import java.util.TimeZone import eu.kanade.tachiyomi.data.preference.PreferenceKeys as Keys -class SettingsAboutController : BaseSettingsController() { +class SettingsAboutController : SettingsController() { /** * Checks for new releases 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 16d5a76e9..c4a23f582 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 rx.android.schedulers.AndroidSchedulers import rx.schedulers.Schedulers import uy.kohesive.injekt.injectLazy -class SettingsAdvancedController : BaseSettingsController() { +class SettingsAdvancedController : SettingsController() { private val network: NetworkHelper by injectLazy() diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsBackupController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsBackupController.kt index 477b4018e..9ebf3339c 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsBackupController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsBackupController.kt @@ -29,7 +29,7 @@ import java.io.File import java.util.concurrent.TimeUnit import eu.kanade.tachiyomi.data.preference.PreferenceKeys as Keys -class SettingsBackupController : BaseSettingsController() { +class SettingsBackupController : SettingsController() { /** * Flags containing information of what to backup. diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsDownloadController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsDownloadController.kt index 6cc1451c3..4c7e87926 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsDownloadController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsDownloadController.kt @@ -23,7 +23,7 @@ import uy.kohesive.injekt.injectLazy import java.io.File import eu.kanade.tachiyomi.data.preference.PreferenceKeys as Keys -class SettingsDownloadController : BaseSettingsController() { +class SettingsDownloadController : SettingsController() { private val db: DatabaseHelper by injectLazy() diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsGeneralController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsGeneralController.kt index 30ffe58e7..2d589cd4e 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsGeneralController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsGeneralController.kt @@ -5,7 +5,7 @@ import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.util.system.LocaleHelper import eu.kanade.tachiyomi.data.preference.PreferenceKeys as Keys -class SettingsGeneralController : BaseSettingsController() { +class SettingsGeneralController : SettingsController() { override fun setupPreferenceScreen(screen: PreferenceScreen) = with(screen) { titleRes = R.string.pref_category_general 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 d27605748..9efc5b6b0 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 @@ -22,7 +22,7 @@ import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get import eu.kanade.tachiyomi.data.preference.PreferenceKeys as Keys -class SettingsLibraryController : BaseSettingsController() { +class SettingsLibraryController : SettingsController() { private val db: DatabaseHelper = Injekt.get() 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 1770dcfb1..f659e1cc4 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 @@ -1,11 +1,31 @@ package eu.kanade.tachiyomi.ui.setting +import android.view.Menu +import android.view.MenuInflater +import android.view.MenuItem import androidx.preference.PreferenceScreen -import com.bluelinelabs.conductor.RouterTransaction import eu.kanade.tachiyomi.R +import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction import eu.kanade.tachiyomi.util.system.getResourceColor +import eu.kanade.tachiyomi.util.system.openInBrowser -class SettingsMainController : BaseSettingsController() { +class SettingsMainController : SettingsController() { + + init { + setHasOptionsMenu(true) + } + + override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) { + inflater.inflate(R.menu.settings, menu) + } + + override fun onOptionsItemSelected(item: MenuItem): Boolean { + when (item.itemId) { + R.id.action_help -> activity?.openInBrowser(URL_HELP) + } + + return super.onOptionsItemSelected(item) + } override fun setupPreferenceScreen(screen: PreferenceScreen) = with(screen) { titleRes = R.string.label_settings @@ -63,6 +83,10 @@ class SettingsMainController : BaseSettingsController() { } private fun navigateTo(controller: SettingsController) { - router.pushController(RouterTransaction.with(controller)) + router.pushController(controller.withFadeTransaction()) + } + + companion object { + private const val URL_HELP = "https://tachiyomi.org/help/" } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsReaderController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsReaderController.kt index f6b82d258..f6371c4af 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsReaderController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsReaderController.kt @@ -5,7 +5,7 @@ import androidx.preference.PreferenceScreen import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.data.preference.PreferenceKeys as Keys -class SettingsReaderController : BaseSettingsController() { +class SettingsReaderController : SettingsController() { override fun setupPreferenceScreen(screen: PreferenceScreen) = with(screen) { titleRes = R.string.pref_category_reader diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsTrackingController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsTrackingController.kt index b2c38c0b6..08a1bd79b 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsTrackingController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsTrackingController.kt @@ -17,7 +17,7 @@ import eu.kanade.tachiyomi.widget.preference.TrackLogoutDialog import uy.kohesive.injekt.injectLazy import eu.kanade.tachiyomi.data.preference.PreferenceKeys as Keys -class SettingsTrackingController : BaseSettingsController(), +class SettingsTrackingController : SettingsController(), TrackLoginDialog.Listener, TrackLogoutDialog.Listener {