Adding more UI polish, add comments for future enhancements.

This commit is contained in:
mpm11011 2020-09-06 11:32:03 -04:00
parent d37341d7d0
commit 381c061ebc
4 changed files with 7 additions and 4 deletions

View file

@ -96,8 +96,6 @@ class AboutController : SettingsController() {
} }
preferenceCategory { preferenceCategory {
titleRes = R.string.about_resources
preference { preference {
key = "pref_about_website" key = "pref_about_website"
titleRes = R.string.website titleRes = R.string.website

View file

@ -19,6 +19,7 @@ import com.bluelinelabs.conductor.ControllerChangeType
import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.preference.PreferencesHelper import eu.kanade.tachiyomi.data.preference.PreferencesHelper
import eu.kanade.tachiyomi.ui.base.controller.BaseController import eu.kanade.tachiyomi.ui.base.controller.BaseController
import eu.kanade.tachiyomi.util.system.getResourceColor
import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.Job import kotlinx.coroutines.Job
@ -83,7 +84,7 @@ abstract class SettingsController : PreferenceController() {
private fun animatePreferenceHighlight(view: View) { private fun animatePreferenceHighlight(view: View) {
ValueAnimator ValueAnimator
.ofObject(ArgbEvaluator(), Color.TRANSPARENT, R.attr.rippleColor) .ofObject(ArgbEvaluator(), Color.TRANSPARENT, view.context.getResourceColor(R.attr.rippleColor))
.apply { .apply {
duration = 500L duration = 500L
repeatCount = 2 repeatCount = 2

View file

@ -86,6 +86,8 @@ class SettingsSearchController :
} }
override fun onMenuItemActionCollapse(item: MenuItem?): Boolean { override fun onMenuItemActionCollapse(item: MenuItem?): Boolean {
searchView.onActionViewCollapsed() // Required to show the query in the view
router.popCurrentController()
return true return true
} }
}) })
@ -135,9 +137,10 @@ class SettingsSearchController :
/** /**
* returns a list of `SettingsSearchItem` to be shown as search results * returns a list of `SettingsSearchItem` to be shown as search results
* Future update: should we add a minimum length to the query before displaying results? Consider other languages.
*/ */
fun getResultSet(query: String? = null): List<SettingsSearchItem> { fun getResultSet(query: String? = null): List<SettingsSearchItem> {
if (!query.isNullOrBlank() && query.length >= 3) { if (!query.isNullOrBlank()) {
return SettingsSearchHelper.getFilteredResults(query) return SettingsSearchHelper.getFilteredResults(query)
.map { SettingsSearchItem(it, null) } .map { SettingsSearchItem(it, null) }
} }

View file

@ -77,6 +77,7 @@ object SettingsSearchHelper {
/** /**
* Extracts the data needed from a `Preference` to create a `SettingsSearchResult`, and then adds it to `prefSearchResultList` * Extracts the data needed from a `Preference` to create a `SettingsSearchResult`, and then adds it to `prefSearchResultList`
* Future enhancement: make bold the text matched by the search query.
*/ */
private fun getSettingSearchResult(ctrl: SettingsController, pref: Preference, breadcrumbs: String = "") { private fun getSettingSearchResult(ctrl: SettingsController, pref: Preference, breadcrumbs: String = "") {
when (pref) { when (pref) {