Merge "OmniControl: Update Battery led settings for the new battery_low_behavior" into android-14.0
diff --git a/app/src/main/java/org/omnirom/control/BarsSettingsFragment.kt b/app/src/main/java/org/omnirom/control/BarsSettingsFragment.kt
index 8fd18ac..6333c59 100644
--- a/app/src/main/java/org/omnirom/control/BarsSettingsFragment.kt
+++ b/app/src/main/java/org/omnirom/control/BarsSettingsFragment.kt
@@ -19,17 +19,17 @@
import android.graphics.Rect
import android.os.Bundle
+import android.provider.Settings
import android.util.DisplayMetrics
-import android.util.Log
import android.view.WindowManager
import androidx.annotation.DrawableRes
import androidx.annotation.XmlRes
import androidx.preference.Preference
import androidx.preference.PreferenceCategory
-import org.omnirom.control.search.PreferenceXmlParserUtils
-import org.omnirom.control.search.PreferenceXmlParserUtils.METADATA_KEY
+import androidx.preference.SwitchPreference
import kotlin.math.min
+import org.omnirom.omnilib.utils.OmniSettings
class BarsSettingsFragment : AbstractSettingsFragment() {
private val TABLET_MIN_DPS = 600
@@ -55,6 +55,17 @@
val taskbarCategory:PreferenceCategory? = findPreference("category_taskbar")
if (taskbarCategory != null){
+ val pref = taskbarCategory.findPreference<SwitchPreference>("enable_taskbar")
+ pref?.isChecked = Settings.System.getInt(requireContext().contentResolver,
+ OmniSettings.OMNI_ENABLE_TASKBAR, if (isTablet()) 1 else 0) == 1
+ pref?.onPreferenceChangeListener =
+ Preference.OnPreferenceChangeListener { _, newValue ->
+ Settings.System.putInt(
+ requireContext().contentResolver, OmniSettings.OMNI_ENABLE_TASKBAR,
+ if (newValue as Boolean) 1 else 0
+ )
+ true
+ }
if (!isTablet()) {
preferenceScreen.removePreference(taskbarCategory)
}
diff --git a/app/src/main/res/xml/bars_settings_preferences.xml b/app/src/main/res/xml/bars_settings_preferences.xml
index b0afeea..0c428a6 100644
--- a/app/src/main/res/xml/bars_settings_preferences.xml
+++ b/app/src/main/res/xml/bars_settings_preferences.xml
@@ -59,11 +59,11 @@
android:key="category_taskbar"
android:title="@string/taskbar_title">
- <omnirom.preference.SystemSettingSwitchPreference
+ <SwitchPreference
android:key="enable_taskbar"
android:title="@string/enable_taskbar_title"
android:summary="@string/enable_taskbar_summary"
- android:defaultValue="true"/>
+ android:persistent="false"/>
</PreferenceCategory>
</PreferenceScreen>