mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-20 19:09:17 +01:00
- moved call to SettingsSearchHelper.initPreferenceSearchResultCollection() into SettingsSearchController
This commit is contained in:
parent
d53719b79e
commit
29ab99aa1f
@ -10,8 +10,6 @@ import eu.kanade.tachiyomi.R
|
|||||||
import eu.kanade.tachiyomi.data.preference.PreferenceValues as Values
|
import eu.kanade.tachiyomi.data.preference.PreferenceValues as Values
|
||||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||||
import eu.kanade.tachiyomi.ui.security.SecureActivityDelegate
|
import eu.kanade.tachiyomi.ui.security.SecureActivityDelegate
|
||||||
import eu.kanade.tachiyomi.ui.setting.settingssearch.SettingsSearchHelper
|
|
||||||
import eu.kanade.tachiyomi.util.lang.launchNow
|
|
||||||
import eu.kanade.tachiyomi.util.system.LocaleHelper
|
import eu.kanade.tachiyomi.util.system.LocaleHelper
|
||||||
import uy.kohesive.injekt.injectLazy
|
import uy.kohesive.injekt.injectLazy
|
||||||
|
|
||||||
@ -78,8 +76,6 @@ abstract class BaseActivity<VB : ViewBinding> : AppCompatActivity() {
|
|||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
|
|
||||||
secureActivityDelegate.onCreate()
|
secureActivityDelegate.onCreate()
|
||||||
|
|
||||||
launchNow { SettingsSearchHelper.initPreferenceSearchResultCollection(this@BaseActivity) }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
|
@ -113,6 +113,9 @@ class SettingsSearchController :
|
|||||||
// Create recycler and set adapter.
|
// Create recycler and set adapter.
|
||||||
binding.recycler.layoutManager = LinearLayoutManager(view.context)
|
binding.recycler.layoutManager = LinearLayoutManager(view.context)
|
||||||
binding.recycler.adapter = adapter
|
binding.recycler.adapter = adapter
|
||||||
|
|
||||||
|
// load all search results
|
||||||
|
SettingsSearchHelper.initPreferenceSearchResultCollection(presenter.preferences.context)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onDestroyView(view: View) {
|
override fun onDestroyView(view: View) {
|
||||||
|
@ -18,6 +18,7 @@ import eu.kanade.tachiyomi.ui.setting.SettingsParentalControlsController
|
|||||||
import eu.kanade.tachiyomi.ui.setting.SettingsReaderController
|
import eu.kanade.tachiyomi.ui.setting.SettingsReaderController
|
||||||
import eu.kanade.tachiyomi.ui.setting.SettingsSecurityController
|
import eu.kanade.tachiyomi.ui.setting.SettingsSecurityController
|
||||||
import eu.kanade.tachiyomi.ui.setting.SettingsTrackingController
|
import eu.kanade.tachiyomi.ui.setting.SettingsTrackingController
|
||||||
|
import eu.kanade.tachiyomi.util.lang.launchNow
|
||||||
import eu.kanade.tachiyomi.util.system.isLTR
|
import eu.kanade.tachiyomi.util.system.isLTR
|
||||||
import kotlin.reflect.KClass
|
import kotlin.reflect.KClass
|
||||||
import kotlin.reflect.full.createInstance
|
import kotlin.reflect.full.createInstance
|
||||||
@ -48,17 +49,18 @@ object SettingsSearchHelper {
|
|||||||
@SuppressLint("RestrictedApi")
|
@SuppressLint("RestrictedApi")
|
||||||
fun initPreferenceSearchResultCollection(context: Context) {
|
fun initPreferenceSearchResultCollection(context: Context) {
|
||||||
val preferenceManager = PreferenceManager(context)
|
val preferenceManager = PreferenceManager(context)
|
||||||
|
|
||||||
prefSearchResultList.clear()
|
prefSearchResultList.clear()
|
||||||
|
|
||||||
settingControllersList.forEach { kClass ->
|
launchNow {
|
||||||
val ctrl = kClass.createInstance()
|
settingControllersList.forEach { kClass ->
|
||||||
val settingsPrefScreen = ctrl.setupPreferenceScreen(preferenceManager.createPreferenceScreen(context))
|
val ctrl = kClass.createInstance()
|
||||||
val prefCount = settingsPrefScreen.preferenceCount
|
val settingsPrefScreen = ctrl.setupPreferenceScreen(preferenceManager.createPreferenceScreen(context))
|
||||||
for (i in 0 until prefCount) {
|
val prefCount = settingsPrefScreen.preferenceCount
|
||||||
val rootPref = settingsPrefScreen.getPreference(i)
|
for (i in 0 until prefCount) {
|
||||||
if (rootPref.title == null) continue // no title, not a preference. (note: only info notes appear to not have titles)
|
val rootPref = settingsPrefScreen.getPreference(i)
|
||||||
getSettingSearchResult(ctrl, rootPref, "${settingsPrefScreen.title}")
|
if (rootPref.title == null) continue // no title, not a preference. (note: only info notes appear to not have titles)
|
||||||
|
getSettingSearchResult(ctrl, rootPref, "${settingsPrefScreen.title}")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user