summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/SettingsLib/AppPreference/res/layout/preference_app.xml2
-rw-r--r--packages/SettingsLib/MainSwitchPreference/Android.bp1
-rw-r--r--packages/SettingsLib/MainSwitchPreference/res/values-night/colors.xml9
-rw-r--r--packages/SettingsLib/MainSwitchPreference/res/values/colors.xml15
-rw-r--r--packages/SettingsLib/RadioButtonPreference/res/layout/preference_radio.xml12
-rw-r--r--packages/SettingsLib/SettingsTheme/res/color-v31/settingslib_switch_thumb_color.xml26
-rw-r--r--packages/SettingsLib/SettingsTheme/res/color-v31/settingslib_switch_track_color.xml27
-rw-r--r--packages/SettingsLib/SettingsTheme/res/drawable-v31/settingslib_switch_thumb.xml29
-rw-r--r--packages/SettingsLib/SettingsTheme/res/drawable-v31/settingslib_switch_track.xml26
-rw-r--r--packages/SettingsLib/SettingsTheme/res/values-night-v31/colors.xml27
-rw-r--r--packages/SettingsLib/SettingsTheme/res/values-v31/colors.xml33
-rw-r--r--packages/SettingsLib/SettingsTheme/res/values-v31/styles.xml6
-rw-r--r--packages/SettingsLib/SettingsTheme/res/values-v31/themes.xml1
-rw-r--r--packages/SettingsLib/SettingsTheme/res/values/dimens.xml1
-rw-r--r--packages/SettingsLib/TwoTargetPreference/res/layout/preference_two_target.xml2
-rw-r--r--packages/SettingsLib/res/layout/preference_access_point.xml10
-rw-r--r--packages/SettingsLib/res/layout/preference_checkable_two_target.xml8
17 files changed, 195 insertions, 40 deletions
diff --git a/packages/SettingsLib/AppPreference/res/layout/preference_app.xml b/packages/SettingsLib/AppPreference/res/layout/preference_app.xml
index 657a12cd13de..e65f7de2466a 100644
--- a/packages/SettingsLib/AppPreference/res/layout/preference_app.xml
+++ b/packages/SettingsLib/AppPreference/res/layout/preference_app.xml
@@ -90,7 +90,7 @@
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center_vertical|end"
- android:minWidth="64dp"
+ android:minWidth="@dimen/two_target_min_width"
android:orientation="vertical"/>
</LinearLayout>
diff --git a/packages/SettingsLib/MainSwitchPreference/Android.bp b/packages/SettingsLib/MainSwitchPreference/Android.bp
index 4ce854ada849..23ee49e70595 100644
--- a/packages/SettingsLib/MainSwitchPreference/Android.bp
+++ b/packages/SettingsLib/MainSwitchPreference/Android.bp
@@ -15,6 +15,7 @@ android_library {
static_libs: [
"androidx.preference_preference",
+ "SettingsLibSettingsTheme",
],
sdk_version: "system_current",
diff --git a/packages/SettingsLib/MainSwitchPreference/res/values-night/colors.xml b/packages/SettingsLib/MainSwitchPreference/res/values-night/colors.xml
index 9ca3683dfd31..58ab9921f9f7 100644
--- a/packages/SettingsLib/MainSwitchPreference/res/values-night/colors.xml
+++ b/packages/SettingsLib/MainSwitchPreference/res/values-night/colors.xml
@@ -18,13 +18,4 @@
<resources>
<color name="settingslib_switchbar_switch_track_tint">#82000000</color>
<color name="settingslib_switchbar_switch_thumb_tint">@android:color/black</color>
-
- <!-- Material next thumb off color-->
- <color name="settingslib_thumb_off_color">@android:color/system_neutral2_300</color>
-
- <!-- Material next track on color-->
- <color name="settingslib_track_on_color">@android:color/system_accent2_700</color>
-
- <!-- Material next track off color-->
- <color name="settingslib_track_off_color">@android:color/system_neutral1_700</color>
</resources>
diff --git a/packages/SettingsLib/MainSwitchPreference/res/values/colors.xml b/packages/SettingsLib/MainSwitchPreference/res/values/colors.xml
index 2c73238da254..0c95a9ec65e1 100644
--- a/packages/SettingsLib/MainSwitchPreference/res/values/colors.xml
+++ b/packages/SettingsLib/MainSwitchPreference/res/values/colors.xml
@@ -19,19 +19,4 @@
<color name="settingslib_switchbar_background_color">@*android:color/material_grey_600</color>
<color name="settingslib_switchbar_switch_track_tint">#BFFFFFFF</color>
<color name="settingslib_switchbar_switch_thumb_tint">@android:color/white</color>
-
- <!-- Material next state on color-->
- <color name="settingslib_state_on_color">?androidprv:attr/colorAccentPrimary</color>
-
- <!-- Material next state off color-->
- <color name="settingslib_state_off_color">?androidprv:attr/colorAccentSecondary</color>
-
- <!-- Material next thumb off color-->
- <color name="settingslib_thumb_off_color">@android:color/system_neutral2_100</color>
-
- <!-- Material next track on color-->
- <color name="settingslib_track_on_color">?androidprv:attr/colorAccentPrimaryVariant</color>
-
- <!-- Material next track off color-->
- <color name="settingslib_track_off_color">@android:color/system_neutral2_600</color>
</resources>
diff --git a/packages/SettingsLib/RadioButtonPreference/res/layout/preference_radio.xml b/packages/SettingsLib/RadioButtonPreference/res/layout/preference_radio.xml
index e92b6716976e..b299061ce591 100644
--- a/packages/SettingsLib/RadioButtonPreference/res/layout/preference_radio.xml
+++ b/packages/SettingsLib/RadioButtonPreference/res/layout/preference_radio.xml
@@ -58,13 +58,14 @@
android:layout_weight="1"
android:orientation="vertical"
android:paddingTop="16dp"
- android:paddingBottom="16dp">
+ android:paddingBottom="16dp"
+ android:paddingEnd="?android:attr/listPreferredItemPaddingEnd">
<TextView
android:id="@android:id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:singleLine="true"
+ android:maxLines="2"
android:textAppearance="?android:attr/textAppearanceListItem"/>
<LinearLayout
@@ -109,12 +110,13 @@
android:background="?android:attr/dividerVertical" />
<ImageView
android:id="@+id/radio_extra_widget"
- android:layout_width="wrap_content"
+ android:layout_width="match_parent"
+ android:minWidth="@dimen/two_target_min_width"
android:layout_height="fill_parent"
android:src="@drawable/ic_settings_accent"
android:contentDescription="@string/settings_label"
- android:paddingStart="16dp"
- android:paddingEnd="16dp"
+ android:paddingStart="24dp"
+ android:paddingEnd="24dp"
android:layout_gravity="center"
android:background="?android:attr/selectableItemBackground" />
</LinearLayout>
diff --git a/packages/SettingsLib/SettingsTheme/res/color-v31/settingslib_switch_thumb_color.xml b/packages/SettingsLib/SettingsTheme/res/color-v31/settingslib_switch_thumb_color.xml
new file mode 100644
index 000000000000..df3bad4ee377
--- /dev/null
+++ b/packages/SettingsLib/SettingsTheme/res/color-v31/settingslib_switch_thumb_color.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.
+-->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <!-- Disabled status of thumb -->
+ <item android:state_enabled="false"
+ android:color="@color/settingslib_thumb_off_color" />
+ <!-- Toggle off status of thumb -->
+ <item android:state_checked="false"
+ android:color="@color/settingslib_thumb_off_color" />
+ <!-- Enabled or toggle on status of thumb -->
+ <item android:color="@color/settingslib_state_on_color" />
+</selector> \ No newline at end of file
diff --git a/packages/SettingsLib/SettingsTheme/res/color-v31/settingslib_switch_track_color.xml b/packages/SettingsLib/SettingsTheme/res/color-v31/settingslib_switch_track_color.xml
new file mode 100644
index 000000000000..9568f52dcd01
--- /dev/null
+++ b/packages/SettingsLib/SettingsTheme/res/color-v31/settingslib_switch_track_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/settingslib_track_off_color"
+ android:alpha="?android:attr/disabledAlpha" />
+ <!-- Toggle off status of thumb -->
+ <item android:state_checked="false"
+ android:color="@color/settingslib_track_off_color" />
+ <!-- Enabled or toggle on status of thumb -->
+ <item android:color="@color/settingslib_track_on_color" />
+</selector> \ No newline at end of file
diff --git a/packages/SettingsLib/SettingsTheme/res/drawable-v31/settingslib_switch_thumb.xml b/packages/SettingsLib/SettingsTheme/res/drawable-v31/settingslib_switch_thumb.xml
new file mode 100644
index 000000000000..87c6dea49e2b
--- /dev/null
+++ b/packages/SettingsLib/SettingsTheme/res/drawable-v31/settingslib_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/settingslib_switch_thumb_color" />
+ </shape>
+ </item>
+</layer-list> \ No newline at end of file
diff --git a/packages/SettingsLib/SettingsTheme/res/drawable-v31/settingslib_switch_track.xml b/packages/SettingsLib/SettingsTheme/res/drawable-v31/settingslib_switch_track.xml
new file mode 100644
index 000000000000..cb8f3f09201c
--- /dev/null
+++ b/packages/SettingsLib/SettingsTheme/res/drawable-v31/settingslib_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/settingslib_switch_track_color" />
+ <corners android:radius="35dp" />
+</shape> \ No newline at end of file
diff --git a/packages/SettingsLib/SettingsTheme/res/values-night-v31/colors.xml b/packages/SettingsLib/SettingsTheme/res/values-night-v31/colors.xml
new file mode 100644
index 000000000000..df0e3e1d9641
--- /dev/null
+++ b/packages/SettingsLib/SettingsTheme/res/values-night-v31/colors.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2020 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.
+ -->
+
+<resources xmlns:androidprv="http://schemas.android.com/apk/prv/res/android">
+ <!-- Material next thumb off color-->
+ <color name="settingslib_thumb_off_color">@android:color/system_neutral2_300</color>
+
+ <!-- Material next track on color-->
+ <color name="settingslib_track_on_color">@android:color/system_accent2_700</color>
+
+ <!-- Material next track off color-->
+ <color name="settingslib_track_off_color">@android:color/system_neutral1_700</color>
+</resources> \ No newline at end of file
diff --git a/packages/SettingsLib/SettingsTheme/res/values-v31/colors.xml b/packages/SettingsLib/SettingsTheme/res/values-v31/colors.xml
new file mode 100644
index 000000000000..c9bc583b209f
--- /dev/null
+++ b/packages/SettingsLib/SettingsTheme/res/values-v31/colors.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2020 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.
+ -->
+
+<resources xmlns:androidprv="http://schemas.android.com/apk/prv/res/android">
+ <!-- Material next state on color-->
+ <color name="settingslib_state_on_color">?androidprv:attr/colorAccentPrimary</color>
+
+ <!-- Material next state off color-->
+ <color name="settingslib_state_off_color">?androidprv:attr/colorAccentSecondary</color>
+
+ <!-- Material next thumb off color-->
+ <color name="settingslib_thumb_off_color">@android:color/system_neutral2_100</color>
+
+ <!-- Material next track on color-->
+ <color name="settingslib_track_on_color">?androidprv:attr/colorAccentPrimaryVariant</color>
+
+ <!-- Material next track off color-->
+ <color name="settingslib_track_off_color">@android:color/system_neutral2_600</color>
+</resources>
diff --git a/packages/SettingsLib/SettingsTheme/res/values-v31/styles.xml b/packages/SettingsLib/SettingsTheme/res/values-v31/styles.xml
index 83a259e624bd..e3a023995e76 100644
--- a/packages/SettingsLib/SettingsTheme/res/values-v31/styles.xml
+++ b/packages/SettingsLib/SettingsTheme/res/values-v31/styles.xml
@@ -22,4 +22,10 @@
<style name="TextAppearance.CategoryTitle.SettingsLib"
parent="@*android:style/TextAppearance.DeviceDefault.Body2" />
+
+ <style name="Switch.SettingsLib" parent="@android:style/Widget.Material.CompoundButton.Switch">
+ <item name="android:switchMinWidth">52dp</item>
+ <item name="android:track">@drawable/settingslib_switch_track</item>
+ <item name="android:thumb">@drawable/settingslib_switch_thumb</item>
+ </style>
</resources>
diff --git a/packages/SettingsLib/SettingsTheme/res/values-v31/themes.xml b/packages/SettingsLib/SettingsTheme/res/values-v31/themes.xml
index 69649e042ac4..adf506dc47cb 100644
--- a/packages/SettingsLib/SettingsTheme/res/values-v31/themes.xml
+++ b/packages/SettingsLib/SettingsTheme/res/values-v31/themes.xml
@@ -22,6 +22,7 @@
<item name="android:listPreferredItemPaddingStart">24dp</item>
<item name="android:listPreferredItemPaddingEnd">16dp</item>
<item name="preferenceTheme">@style/PreferenceTheme.SettingsLib</item>
+ <item name="android:switchStyle">@style/Switch.SettingsLib</item>
</style>
<!-- Using in SubSettings page including injected settings page -->
diff --git a/packages/SettingsLib/SettingsTheme/res/values/dimens.xml b/packages/SettingsLib/SettingsTheme/res/values/dimens.xml
index 3f473a3e0e85..25f9514c29b7 100644
--- a/packages/SettingsLib/SettingsTheme/res/values/dimens.xml
+++ b/packages/SettingsLib/SettingsTheme/res/values/dimens.xml
@@ -19,4 +19,5 @@
<dimen name="secondary_app_icon_size">32dp</dimen>
<dimen name="app_preference_padding_start">?android:attr/listPreferredItemPaddingStart</dimen>
<dimen name="app_icon_min_width">56dp</dimen>
+ <dimen name="two_target_min_width">72dp</dimen>
</resources>
diff --git a/packages/SettingsLib/TwoTargetPreference/res/layout/preference_two_target.xml b/packages/SettingsLib/TwoTargetPreference/res/layout/preference_two_target.xml
index 7978e73b9b37..2c2756b36533 100644
--- a/packages/SettingsLib/TwoTargetPreference/res/layout/preference_two_target.xml
+++ b/packages/SettingsLib/TwoTargetPreference/res/layout/preference_two_target.xml
@@ -63,7 +63,7 @@
android:id="@android:id/widget_frame"
android:layout_width="wrap_content"
android:layout_height="match_parent"
- android:minWidth="64dp"
+ android:minWidth="@dimen/two_target_min_width"
android:gravity="center"
android:orientation="vertical" />
diff --git a/packages/SettingsLib/res/layout/preference_access_point.xml b/packages/SettingsLib/res/layout/preference_access_point.xml
index 9dc87de38ec2..f3f43accca3c 100644
--- a/packages/SettingsLib/res/layout/preference_access_point.xml
+++ b/packages/SettingsLib/res/layout/preference_access_point.xml
@@ -24,6 +24,8 @@
android:minHeight="?android:attr/listPreferredItemHeightSmall"
android:gravity="center_vertical"
android:background="?android:attr/selectableItemBackground"
+ android:paddingStart="?android:attr/listPreferredItemPaddingStart"
+ android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
android:clipToPadding="false">
<LinearLayout
@@ -31,9 +33,7 @@
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="start|center_vertical"
- android:clipToPadding="false"
- android:paddingStart="?android:attr/listPreferredItemPaddingStart"
- android:paddingEnd="?android:attr/listPreferredItemPaddingEnd">
+ android:clipToPadding="false">
<LinearLayout
android:id="@+id/icon_frame"
@@ -89,7 +89,7 @@
android:id="@android:id/widget_frame"
android:layout_width="wrap_content"
android:layout_height="match_parent"
- android:minWidth="64dp"
+ android:minWidth="@dimen/two_target_min_width"
android:gravity="center"
android:orientation="vertical" />
@@ -97,7 +97,7 @@
android:id="@+id/icon_button"
android:layout_width="wrap_content"
android:layout_height="match_parent"
- android:minWidth="64dp"
+ android:minWidth="@dimen/two_target_min_width"
android:minHeight="@dimen/min_tap_target_size"
android:layout_gravity="center"
android:background="?android:attr/selectableItemBackground"
diff --git a/packages/SettingsLib/res/layout/preference_checkable_two_target.xml b/packages/SettingsLib/res/layout/preference_checkable_two_target.xml
index 1ae1c8967679..e4f72422e408 100644
--- a/packages/SettingsLib/res/layout/preference_checkable_two_target.xml
+++ b/packages/SettingsLib/res/layout/preference_checkable_two_target.xml
@@ -24,6 +24,8 @@
android:minHeight="?android:attr/listPreferredItemHeightSmall"
android:gravity="center_vertical"
android:background="@android:color/transparent"
+ android:paddingStart="?android:attr/listPreferredItemPaddingStart"
+ android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
android:clipToPadding="false">
<LinearLayout
@@ -32,9 +34,7 @@
android:layout_weight="1"
android:background="?android:attr/selectableItemBackground"
android:gravity="start|center_vertical"
- android:clipToPadding="false"
- android:paddingStart="?android:attr/listPreferredItemPaddingStart"
- android:paddingEnd="?android:attr/listPreferredItemPaddingEnd">
+ android:clipToPadding="false">
<LinearLayout
android:id="@+id/checkbox_container"
@@ -86,7 +86,7 @@
android:id="@android:id/widget_frame"
android:layout_width="wrap_content"
android:layout_height="match_parent"
- android:minWidth="64dp"
+ android:minWidth="@dimen/two_target_min_width"
android:gravity="center"
android:orientation="vertical" />