Aperture: Import switch style from SettingsLib
Change-Id: Icb830017a8b4a084296d85702fe4e261402a1865
diff --git a/app/src/main/res/color/settingslib_switch_thumb_color.xml b/app/src/main/res/color/settingslib_switch_thumb_color.xml
new file mode 100644
index 0000000..43b4438
--- /dev/null
+++ b/app/src/main/res/color/settingslib_switch_thumb_color.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ SPDX-FileCopyrightText: 2021 The Android Open Source Project
+ SPDX-License-Identifier: Apache-2.0
+-->
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <!-- Disabled status of thumb -->
+ <item android:color="@android:color/system_neutral1_700" android:state_enabled="false" />
+ <!-- Toggle off status of thumb -->
+ <item android:color="@android:color/system_neutral1_400" android:state_checked="false" />
+ <!-- Enabled or toggle on status of thumb -->
+ <item android:color="@android:color/system_accent1_100" />
+</selector>
diff --git a/app/src/main/res/color/settingslib_switch_track_color.xml b/app/src/main/res/color/settingslib_switch_track_color.xml
new file mode 100644
index 0000000..69e6dd8
--- /dev/null
+++ b/app/src/main/res/color/settingslib_switch_track_color.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ SPDX-FileCopyrightText: 2021 The Android Open Source Project
+ SPDX-License-Identifier: Apache-2.0
+-->
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <!-- Disabled status of thumb -->
+ <item android:alpha="?android:attr/disabledAlpha" android:color="@android:color/system_neutral1_700" android:state_enabled="false" />
+ <!-- Toggle off status of thumb -->
+ <item android:color="@android:color/system_neutral1_700" android:state_checked="false" />
+ <!-- Enabled or toggle on status of thumb -->
+ <item android:color="@android:color/system_accent2_500" />
+</selector>
diff --git a/app/src/main/res/drawable/settingslib_switch_thumb.xml b/app/src/main/res/drawable/settingslib_switch_thumb.xml
new file mode 100644
index 0000000..35ca08d
--- /dev/null
+++ b/app/src/main/res/drawable/settingslib_switch_thumb.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ SPDX-FileCopyrightText: 2021 The Android Open Source Project
+ SPDX-License-Identifier: Apache-2.0
+-->
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
+ <item
+ android:bottom="4dp"
+ android:left="4dp"
+ android:right="4dp"
+ android:top="4dp">
+ <shape android:shape="oval">
+ <size
+ android:width="20dp"
+ android:height="20dp" />
+ <solid android:color="@color/settingslib_switch_thumb_color" />
+ </shape>
+ </item>
+</layer-list>
diff --git a/app/src/main/res/drawable/settingslib_switch_track.xml b/app/src/main/res/drawable/settingslib_switch_track.xml
new file mode 100644
index 0000000..52675f5
--- /dev/null
+++ b/app/src/main/res/drawable/settingslib_switch_track.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ SPDX-FileCopyrightText: 2021 The Android Open Source Project
+ SPDX-License-Identifier: Apache-2.0
+-->
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="52dp"
+ android:height="28dp"
+ android:shape="rectangle">
+
+ <solid android:color="@color/settingslib_switch_track_color" />
+ <corners android:radius="35dp" />
+</shape>
diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml
index 258bf5d..58ca9f0 100644
--- a/app/src/main/res/values/themes.xml
+++ b/app/src/main/res/values/themes.xml
@@ -26,7 +26,17 @@
</style>
<!-- Settings activity theme. -->
- <style name="Theme.Aperture.Settings" parent="Theme.Aperture" />
+ <style name="Theme.Aperture.Settings" parent="Theme.Aperture">
+ <item name="android:switchStyle">@style/Theme.Aperture.Settings.Switch</item>
+ </style>
+
+ <!-- Settings switch theme. -->
+ <style name="Theme.Aperture.Settings.Switch" parent="@android:style/Widget.Material.CompoundButton.Switch">
+ <item name="android:switchMinWidth">52dp</item>
+ <item name="android:minHeight">48dp</item>
+ <item name="android:track">@drawable/settingslib_switch_track</item>
+ <item name="android:thumb">@drawable/settingslib_switch_thumb</item>
+ </style>
<!-- Top bar icons theme -->
<style name="ApertureTopBarButton">