Restore setting controller fade

Removes help button in each section, which is jumpy. Fade is nicer though.
This commit is contained in:
arkon 2020-02-04 22:15:41 -05:00
parent c9cb75aee1
commit 0473c36c6f
10 changed files with 35 additions and 41 deletions

View File

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

View File

@ -31,7 +31,7 @@ import java.util.Locale
import java.util.TimeZone import java.util.TimeZone
import eu.kanade.tachiyomi.data.preference.PreferenceKeys as Keys import eu.kanade.tachiyomi.data.preference.PreferenceKeys as Keys
class SettingsAboutController : BaseSettingsController() { class SettingsAboutController : SettingsController() {
/** /**
* Checks for new releases * Checks for new releases

View File

@ -21,7 +21,7 @@ import rx.android.schedulers.AndroidSchedulers
import rx.schedulers.Schedulers import rx.schedulers.Schedulers
import uy.kohesive.injekt.injectLazy import uy.kohesive.injekt.injectLazy
class SettingsAdvancedController : BaseSettingsController() { class SettingsAdvancedController : SettingsController() {
private val network: NetworkHelper by injectLazy() private val network: NetworkHelper by injectLazy()

View File

@ -29,7 +29,7 @@ import java.io.File
import java.util.concurrent.TimeUnit import java.util.concurrent.TimeUnit
import eu.kanade.tachiyomi.data.preference.PreferenceKeys as Keys import eu.kanade.tachiyomi.data.preference.PreferenceKeys as Keys
class SettingsBackupController : BaseSettingsController() { class SettingsBackupController : SettingsController() {
/** /**
* Flags containing information of what to backup. * Flags containing information of what to backup.

View File

@ -23,7 +23,7 @@ import uy.kohesive.injekt.injectLazy
import java.io.File import java.io.File
import eu.kanade.tachiyomi.data.preference.PreferenceKeys as Keys import eu.kanade.tachiyomi.data.preference.PreferenceKeys as Keys
class SettingsDownloadController : BaseSettingsController() { class SettingsDownloadController : SettingsController() {
private val db: DatabaseHelper by injectLazy() private val db: DatabaseHelper by injectLazy()

View File

@ -5,7 +5,7 @@ import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.util.system.LocaleHelper import eu.kanade.tachiyomi.util.system.LocaleHelper
import eu.kanade.tachiyomi.data.preference.PreferenceKeys as Keys import eu.kanade.tachiyomi.data.preference.PreferenceKeys as Keys
class SettingsGeneralController : BaseSettingsController() { class SettingsGeneralController : SettingsController() {
override fun setupPreferenceScreen(screen: PreferenceScreen) = with(screen) { override fun setupPreferenceScreen(screen: PreferenceScreen) = with(screen) {
titleRes = R.string.pref_category_general titleRes = R.string.pref_category_general

View File

@ -22,7 +22,7 @@ import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get import uy.kohesive.injekt.api.get
import eu.kanade.tachiyomi.data.preference.PreferenceKeys as Keys import eu.kanade.tachiyomi.data.preference.PreferenceKeys as Keys
class SettingsLibraryController : BaseSettingsController() { class SettingsLibraryController : SettingsController() {
private val db: DatabaseHelper = Injekt.get() private val db: DatabaseHelper = Injekt.get()

View File

@ -1,11 +1,31 @@
package eu.kanade.tachiyomi.ui.setting package eu.kanade.tachiyomi.ui.setting
import android.view.Menu
import android.view.MenuInflater
import android.view.MenuItem
import androidx.preference.PreferenceScreen import androidx.preference.PreferenceScreen
import com.bluelinelabs.conductor.RouterTransaction
import eu.kanade.tachiyomi.R 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.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) { override fun setupPreferenceScreen(screen: PreferenceScreen) = with(screen) {
titleRes = R.string.label_settings titleRes = R.string.label_settings
@ -63,6 +83,10 @@ class SettingsMainController : BaseSettingsController() {
} }
private fun navigateTo(controller: SettingsController) { 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/"
} }
} }

View File

@ -5,7 +5,7 @@ import androidx.preference.PreferenceScreen
import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.preference.PreferenceKeys as Keys import eu.kanade.tachiyomi.data.preference.PreferenceKeys as Keys
class SettingsReaderController : BaseSettingsController() { class SettingsReaderController : SettingsController() {
override fun setupPreferenceScreen(screen: PreferenceScreen) = with(screen) { override fun setupPreferenceScreen(screen: PreferenceScreen) = with(screen) {
titleRes = R.string.pref_category_reader titleRes = R.string.pref_category_reader

View File

@ -17,7 +17,7 @@ import eu.kanade.tachiyomi.widget.preference.TrackLogoutDialog
import uy.kohesive.injekt.injectLazy import uy.kohesive.injekt.injectLazy
import eu.kanade.tachiyomi.data.preference.PreferenceKeys as Keys import eu.kanade.tachiyomi.data.preference.PreferenceKeys as Keys
class SettingsTrackingController : BaseSettingsController(), class SettingsTrackingController : SettingsController(),
TrackLoginDialog.Listener, TrackLoginDialog.Listener,
TrackLogoutDialog.Listener { TrackLogoutDialog.Listener {