Merge "omni: Disable skinnyNotifsInLandscape config with overlay" into android-13.0
diff --git a/themes/PreferenceTheme/Android.bp b/themes/PreferenceTheme/Android.bp
new file mode 100644
index 0000000..90fd482
--- /dev/null
+++ b/themes/PreferenceTheme/Android.bp
@@ -0,0 +1,13 @@
+android_library {
+    name: "OmniPreferenceTheme",
+
+    resource_dirs: ["res"],
+
+    libs: [
+        "androidx.preference_preference",
+        "com.google.android.material_material",
+    ],
+
+    sdk_version: "system_current",
+    min_sdk_version: "31",
+}
diff --git a/themes/PreferenceTheme/AndroidManifest.xml b/themes/PreferenceTheme/AndroidManifest.xml
new file mode 100644
index 0000000..f1b6b5b
--- /dev/null
+++ b/themes/PreferenceTheme/AndroidManifest.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  Copyright (C) 2019 The Android Open Source Project
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+          package="org.omnirom.theme.preference">
+
+    <uses-sdk android:minSdkVersion="31" />
+
+</manifest>
diff --git a/themes/PreferenceTheme/README b/themes/PreferenceTheme/README
new file mode 100644
index 0000000..28b8673
--- /dev/null
+++ b/themes/PreferenceTheme/README
@@ -0,0 +1,10 @@
+How to use:
+
+add OmniPreferenceTheme as static_lib in Android.bp
+
+add to style/theme:
+...
+        <item name="preferenceTheme">@style/Omni.PreferenceTheme</item>
+        <item name="android:switchStyle">@style/Omni.SwitchStyle</item>
+        <item name="android:textAppearanceListItem">@style/Omni.PreferenceTitle</item>
+...
\ No newline at end of file
diff --git a/themes/PreferenceTheme/res/color-v31/home_settings_switch_thumb_color.xml b/themes/PreferenceTheme/res/color-v31/home_settings_switch_thumb_color.xml
new file mode 100644
index 0000000..91d3d9b
--- /dev/null
+++ b/themes/PreferenceTheme/res/color-v31/home_settings_switch_thumb_color.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  Copyright (C) 2021 The Android Open Source Project
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+    <!-- Disabled status of thumb -->
+    <item android:state_enabled="false"
+        android:color="@color/home_settings_thumb_off_color" />
+    <!-- Toggle off status of thumb -->
+    <item android:state_checked="false"
+        android:color="@color/home_settings_thumb_off_color" />
+    <!-- Enabled or toggle on status of thumb -->
+    <item android:color="@color/home_settings_state_on_color" />
+</selector>
diff --git a/themes/PreferenceTheme/res/color-v31/home_settings_switch_track_color.xml b/themes/PreferenceTheme/res/color-v31/home_settings_switch_track_color.xml
new file mode 100644
index 0000000..50784f5
--- /dev/null
+++ b/themes/PreferenceTheme/res/color-v31/home_settings_switch_track_color.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  Copyright (C) 2021 The Android Open Source Project
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+    <!-- Disabled status of thumb -->
+    <item android:state_enabled="false"
+        android:color="@color/home_settings_track_off_color"
+        android:alpha="?android:attr/disabledAlpha" />
+    <!-- Toggle off status of thumb -->
+    <item android:state_checked="false"
+        android:color="@color/home_settings_track_off_color" />
+    <!-- Enabled or toggle on status of thumb -->
+    <item android:color="@color/home_settings_track_on_color" />
+</selector>
diff --git a/themes/PreferenceTheme/res/drawable-v31/home_settings_switch_thumb.xml b/themes/PreferenceTheme/res/drawable-v31/home_settings_switch_thumb.xml
new file mode 100644
index 0000000..260d5ea
--- /dev/null
+++ b/themes/PreferenceTheme/res/drawable-v31/home_settings_switch_thumb.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  Copyright (C) 2021 The Android Open Source Project
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
+    <item
+        android:top="4dp"
+        android:left="4dp"
+        android:right="4dp"
+        android:bottom="4dp">
+        <shape android:shape="oval" >
+            <size android:height="20dp" android:width="20dp" />
+            <solid android:color="@color/home_settings_switch_thumb_color" />
+        </shape>
+    </item>
+</layer-list>
\ No newline at end of file
diff --git a/themes/PreferenceTheme/res/drawable-v31/home_settings_switch_track.xml b/themes/PreferenceTheme/res/drawable-v31/home_settings_switch_track.xml
new file mode 100644
index 0000000..502a300
--- /dev/null
+++ b/themes/PreferenceTheme/res/drawable-v31/home_settings_switch_track.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  Copyright (C) 2021 The Android Open Source Project
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+
+<shape
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:shape="rectangle"
+    android:width="52dp"
+    android:height="28dp">
+
+    <solid android:color="@color/home_settings_switch_track_color" />
+    <corners android:radius="35dp" />
+</shape>
\ No newline at end of file
diff --git a/themes/PreferenceTheme/res/values-night-v31/colors.xml b/themes/PreferenceTheme/res/values-night-v31/colors.xml
new file mode 100644
index 0000000..dacc537
--- /dev/null
+++ b/themes/PreferenceTheme/res/values-night-v31/colors.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+    <color name="home_settings_thumb_off_color">@android:color/system_neutral2_300</color>
+    <color name="home_settings_track_on_color">@android:color/system_accent2_700</color>
+    <color name="home_settings_track_off_color">@android:color/system_neutral1_700</color>
+</resources>
\ No newline at end of file
diff --git a/themes/PreferenceTheme/res/values-v31/colors.xml b/themes/PreferenceTheme/res/values-v31/colors.xml
new file mode 100644
index 0000000..4d49ca1
--- /dev/null
+++ b/themes/PreferenceTheme/res/values-v31/colors.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+    <color name="home_settings_thumb_off_color">@android:color/system_neutral2_100</color>
+    <color name="home_settings_track_on_color">@android:color/system_accent1_600</color>
+    <color name="home_settings_track_off_color">@android:color/system_neutral2_600</color>
+    <color name="home_settings_state_on_color">@android:color/system_accent1_100</color>
+</resources>
\ No newline at end of file
diff --git a/themes/PreferenceTheme/res/values-v31/config.xml b/themes/PreferenceTheme/res/values-v31/config.xml
new file mode 100644
index 0000000..81a078e
--- /dev/null
+++ b/themes/PreferenceTheme/res/values-v31/config.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+    <bool name="home_settings_icon_space_reserved">false</bool>
+    <bool name="home_settings_config_allow_divider">false</bool>
+</resources>
\ No newline at end of file
diff --git a/themes/PreferenceTheme/res/values-v31/dimens.xml b/themes/PreferenceTheme/res/values-v31/dimens.xml
new file mode 100644
index 0000000..f7e777b
--- /dev/null
+++ b/themes/PreferenceTheme/res/values-v31/dimens.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+    <dimen name="pref_title_text_size">18sp</dimen>
+</resources>
diff --git a/themes/PreferenceTheme/res/values-v31/styles_preference.xml b/themes/PreferenceTheme/res/values-v31/styles_preference.xml
new file mode 100644
index 0000000..1c192ec
--- /dev/null
+++ b/themes/PreferenceTheme/res/values-v31/styles_preference.xml
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+    <style name="Omni.PreferenceTheme" parent="@style/PreferenceThemeOverlay">
+        <item name="preferenceCategoryStyle">@style/Omni.CategoryStyle</item>
+        <item name="preferenceCategoryTitleTextAppearance">@style/Omni.CategoryTitle</item>
+        <item name="preferenceScreenStyle">@style/Omni.PreferenceScreenStyle</item>
+        <item name="preferenceStyle">@style/Omni.PreferenceStyle</item>
+        <item name="switchPreferenceStyle">@style/Omni.SwitchPreferenceStyle</item>
+        <item name="dropdownPreferenceStyle">@style/Omni.DropDownPreferenceStyle</item>
+        <item name="dialogPreferenceStyle">@style/Omni.DialogPreferenceStyle</item>
+        <item name="editTextPreferenceStyle">@style/Omni.EditTextPreferenceStyle</item>
+    </style>
+
+    <style name="Omni.CategoryStyle" parent="@style/Preference.Category.Material">
+        <item name="iconSpaceReserved">@bool/home_settings_icon_space_reserved</item>
+        <item name="allowDividerAbove">@bool/home_settings_config_allow_divider</item>
+        <item name="allowDividerBelow">@bool/home_settings_config_allow_divider</item>
+    </style>
+
+    <style name="Omni.PreferenceStyle" parent="@style/Preference.Material">
+        <item name="iconSpaceReserved">@bool/home_settings_icon_space_reserved</item>
+    </style>
+
+    <style name="Omni.PreferenceScreenStyle"
+        parent="@style/Preference.PreferenceScreen.Material">
+        <item name="iconSpaceReserved">@bool/home_settings_icon_space_reserved</item>
+    </style>
+
+    <style name="Omni.SwitchPreferenceStyle"
+        parent="@style/Preference.SwitchPreference.Material">
+        <item name="iconSpaceReserved">@bool/home_settings_icon_space_reserved</item>
+    </style>
+
+    <style name="Omni.DropDownPreferenceStyle"
+        parent="@style/Preference.DropDown.Material">
+        <item name="iconSpaceReserved">@bool/home_settings_icon_space_reserved</item>
+    </style>
+
+    <style name="Omni.DialogPreferenceStyle"
+        parent="@style/Preference.DialogPreference.Material">
+        <item name="iconSpaceReserved">@bool/home_settings_icon_space_reserved</item>
+    </style>
+
+    <style name="Omni.EditTextPreferenceStyle"
+        parent="@style/Preference.DialogPreference.EditTextPreference">
+        <item name="iconSpaceReserved">@bool/home_settings_icon_space_reserved</item>
+        <item name="allowDividerAbove">@bool/home_settings_config_allow_divider</item>
+        <item name="allowDividerBelow">@bool/home_settings_config_allow_divider</item>
+    </style>
+
+    <style name="Omni.SwitchStyle"
+        parent="@android:style/Widget.Material.CompoundButton.Switch">
+        <item name="android:switchMinWidth">52dp</item>
+        <item name="android:thumb">@drawable/home_settings_switch_thumb</item>
+        <item name="android:track">@drawable/home_settings_switch_track</item>
+    </style>
+
+    <style name="Omni.PreferenceTitle"
+        parent="@style/TextAppearance.Material3.BodyMedium">
+        <item name="android:textSize">@dimen/pref_title_text_size</item>
+    </style>
+
+    <style name="Omni.CategoryTitle" parent="@android:style/TextAppearance.Material.Body2">
+    </style>
+</resources>