OmniControl: add res config_has_flashlight
Change-Id: I34b67ee2952be36eb8c3958acbf6875783429710
diff --git a/app/src/main/java/org/omnirom/control/ButtonSettingsFragment.kt b/app/src/main/java/org/omnirom/control/ButtonSettingsFragment.kt
index da0f713..adc42b7 100644
--- a/app/src/main/java/org/omnirom/control/ButtonSettingsFragment.kt
+++ b/app/src/main/java/org/omnirom/control/ButtonSettingsFragment.kt
@@ -37,6 +37,7 @@
companion object {
@DrawableRes
val ICON_RES = R.drawable.ic_settings_buttons
+
@XmlRes
val XML_RES = R.xml.button_settings_preferences
}
@@ -58,7 +59,8 @@
val powerCategory: PreferenceCategory? = findPreference(CATEGORY_POWER)
if (powerCategory != null) {
- val id = Resources.getSystem().getIdentifier("config_rebootActionsList", "array", "android")
+ val id =
+ Resources.getSystem().getIdentifier("config_rebootActionsList", "array", "android")
if (id != 0) {
val rebootList = Resources.getSystem().getStringArray(id)
if (rebootList.isEmpty()) {
@@ -72,10 +74,12 @@
}
}
val hasPowerMenu: Preference? = findPreference(KEY_POWER_TORCH)
- if (hasPowerMenu != null) {
- hasPowerMenu.isVisible =
+ hasPowerMenu?.isVisible =
resources.getBoolean(R.bool.config_has_power_button)
- }
+
+ val flashlight: Preference? = findPreference(KEY_POWER_TORCH)
+ flashlight?.isVisible =
+ resources.getBoolean(R.bool.config_has_flashlight)
}
}
diff --git a/app/src/main/res/values/config.xml b/app/src/main/res/values/config.xml
index 9d32956..5d674aa 100644
--- a/app/src/main/res/values/config.xml
+++ b/app/src/main/res/values/config.xml
@@ -15,4 +15,6 @@
<!-- udfps support. -->
<bool name="config_has_udfps">false</bool>
+
+ <bool name="config_has_flashlight">true</bool>
</resources>
\ No newline at end of file