mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-11-22 08:39:16 +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
|
findPreference<GpuDriverPreference>("gpu_driver")?.item = item
|
||||||
|
|
||||||
// Hide settings that don't support per-game configuration
|
// Hide settings that don't support per-game configuration
|
||||||
findPreference<Preference>("profile_picture_value")?.isVisible = false
|
var prefToRemove = findPreference<Preference>("profile_picture_value")
|
||||||
findPreference<Preference>("log_level")?.isVisible = false
|
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
|
// TODO: remove this once we have more settings under the debug category
|
||||||
// Avoid showing the debug category if no settings under it are visible
|
// 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 androidx.preference.forEach
|
||||||
import com.google.android.material.appbar.AppBarLayout
|
import com.google.android.material.appbar.AppBarLayout
|
||||||
import com.google.android.material.internal.ToolbarUtils
|
import com.google.android.material.internal.ToolbarUtils
|
||||||
|
import emu.skyline.BuildConfig
|
||||||
import emu.skyline.R
|
import emu.skyline.R
|
||||||
import emu.skyline.data.AppItemTag
|
import emu.skyline.data.AppItemTag
|
||||||
import emu.skyline.databinding.SettingsActivityBinding
|
import emu.skyline.databinding.SettingsActivityBinding
|
||||||
@ -37,7 +38,11 @@ private const val PREFERENCE_DIALOG_FRAGMENT_TAG = "androidx.preference.Preferen
|
|||||||
|
|
||||||
class SettingsActivity : AppCompatActivity(), PreferenceFragmentCompat.OnPreferenceDisplayDialogCallback {
|
class SettingsActivity : AppCompatActivity(), PreferenceFragmentCompat.OnPreferenceDisplayDialogCallback {
|
||||||
val binding by lazy { SettingsActivityBinding.inflate(layoutInflater) }
|
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]
|
* The instance of [PreferenceFragmentCompat] that is shown inside [R.id.settings]
|
||||||
@ -141,7 +146,7 @@ class SettingsActivity : AppCompatActivity(), PreferenceFragmentCompat.OnPrefere
|
|||||||
val queries = newText.split(",")
|
val queries = newText.split(",")
|
||||||
if (newText.isNotEmpty()) {
|
if (newText.isNotEmpty()) {
|
||||||
preferenceFragment.preferenceScreen.forEach { preferenceCategory ->
|
preferenceFragment.preferenceScreen.forEach { preferenceCategory ->
|
||||||
if (creditsCategories.contains(preferenceCategory.key)) {
|
if (hiddenCategoriesFromSearch.contains(preferenceCategory.key)) {
|
||||||
preferenceCategory.isVisible = false
|
preferenceCategory.isVisible = false
|
||||||
return@forEach
|
return@forEach
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user