mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-11-05 11:45:10 +01:00
Hide Debug preferences from search on release builds and remove settings that don't support per-game configuration instead of hiding them
This commit is contained in:
parent
44cbf26b72
commit
ef5456f939
@ -73,8 +73,10 @@ class GameSettingsFragment : PreferenceFragmentCompat() {
|
||||
findPreference<GpuDriverPreference>("gpu_driver")?.item = item
|
||||
|
||||
// Hide settings that don't support per-game configuration
|
||||
findPreference<Preference>("profile_picture_value")?.isVisible = false
|
||||
findPreference<Preference>("log_level")?.isVisible = false
|
||||
var prefToRemove = findPreference<Preference>("profile_picture_value")
|
||||
prefToRemove?.parent?.removePreference(prefToRemove)
|
||||
prefToRemove = findPreference<Preference>("log_level")
|
||||
prefToRemove?.parent?.removePreference(prefToRemove)
|
||||
|
||||
// TODO: remove this once we have more settings under the debug category
|
||||
// Avoid showing the debug category if no settings under it are visible
|
||||
|
@ -24,6 +24,7 @@ import androidx.preference.PreferenceFragmentCompat
|
||||
import androidx.preference.forEach
|
||||
import com.google.android.material.appbar.AppBarLayout
|
||||
import com.google.android.material.internal.ToolbarUtils
|
||||
import emu.skyline.BuildConfig
|
||||
import emu.skyline.R
|
||||
import emu.skyline.data.AppItemTag
|
||||
import emu.skyline.databinding.SettingsActivityBinding
|
||||
@ -37,7 +38,11 @@ private const val PREFERENCE_DIALOG_FRAGMENT_TAG = "androidx.preference.Preferen
|
||||
|
||||
class SettingsActivity : AppCompatActivity(), PreferenceFragmentCompat.OnPreferenceDisplayDialogCallback {
|
||||
val binding by lazy { SettingsActivityBinding.inflate(layoutInflater) }
|
||||
val creditsCategories = arrayOf("category_credits", "category_licenses")
|
||||
val hiddenCategoriesFromSearch = if (BuildConfig.BUILD_TYPE == "release") {
|
||||
arrayOf("category_debug", "category_credits", "category_licenses")
|
||||
} else {
|
||||
arrayOf("category_credits", "category_licenses")
|
||||
}
|
||||
|
||||
/**
|
||||
* The instance of [PreferenceFragmentCompat] that is shown inside [R.id.settings]
|
||||
@ -141,7 +146,7 @@ class SettingsActivity : AppCompatActivity(), PreferenceFragmentCompat.OnPrefere
|
||||
val queries = newText.split(",")
|
||||
if (newText.isNotEmpty()) {
|
||||
preferenceFragment.preferenceScreen.forEach { preferenceCategory ->
|
||||
if (creditsCategories.contains(preferenceCategory.key)) {
|
||||
if (hiddenCategoriesFromSearch.contains(preferenceCategory.key)) {
|
||||
preferenceCategory.isVisible = false
|
||||
return@forEach
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user