Adjust Checkbox component to align with UX specs
When checkbox is disabled and checked, color should be blue, not grey.
Also, size has been increased from 32dp to 44dp.
Fixes: 205196613
Test: Manual
Change-Id: I929cf91671e088917da118462188efed5f35bf5e
diff --git a/car_product/car_ui_portrait/rro/android/res/drawable/car_checkbox.xml b/car_product/car_ui_portrait/rro/android/res/drawable/car_checkbox.xml
new file mode 100644
index 0000000..0f78ff6
--- /dev/null
+++ b/car_product/car_ui_portrait/rro/android/res/drawable/car_checkbox.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright 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.
+-->
+
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
+ <item
+ android:width="@*android:dimen/car_primary_icon_size"
+ android:height="@*android:dimen/car_primary_icon_size"
+ android:drawable="@*android:drawable/btn_check_material_anim"/>
+ <item
+ android:width="@*android:dimen/car_primary_icon_size"
+ android:height="@*android:dimen/car_primary_icon_size"
+ android:drawable="@drawable/car_checkbox_background"/>
+</layer-list>
\ No newline at end of file
diff --git a/car_product/car_ui_portrait/rro/android/res/drawable/car_checkbox_background.xml b/car_product/car_ui_portrait/rro/android/res/drawable/car_checkbox_background.xml
new file mode 100644
index 0000000..69dcdbb
--- /dev/null
+++ b/car_product/car_ui_portrait/rro/android/res/drawable/car_checkbox_background.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright 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">
+ <item android:state_focused="true" android:state_pressed="true">
+ <shape android:shape="rectangle">
+ <solid android:color="#8A0041BE" />
+ <stroke android:width="4dp" android:color="#0041BE" />
+ </shape>
+ </item>
+ <item android:state_focused="true">
+ <shape android:shape="rectangle">
+ <solid android:color="#3D0059B3" />
+ <stroke android:width="8dp" android:color="#0059B3" />
+ </shape>
+ </item>
+</selector>
diff --git a/car_product/car_ui_portrait/rro/android/res/values/styles_device_default.xml b/car_product/car_ui_portrait/rro/android/res/values/styles_device_default.xml
index fadcfd5..9fb59cc 100644
--- a/car_product/car_ui_portrait/rro/android/res/values/styles_device_default.xml
+++ b/car_product/car_ui_portrait/rro/android/res/values/styles_device_default.xml
@@ -113,7 +113,7 @@
</style>
<style name="Widget.DeviceDefault.CompoundButton.CheckBox" parent="android:Widget.Material.CompoundButton.CheckBox">
- <item name="android:button">@*android:drawable/car_checkbox</item>
+ <item name="android:button">@drawable/car_checkbox</item>
</style>
<style name="Widget.DeviceDefault.CompoundButton.Switch" parent="android:Widget.Material.CompoundButton.Switch">
diff --git a/car_product/overlay-visual/frameworks/base/core/res/res/color/car_checkbox_color.xml b/car_product/overlay-visual/frameworks/base/core/res/res/color/car_checkbox_color.xml
deleted file mode 100644
index 970f8ea..0000000
--- a/car_product/overlay-visual/frameworks/base/core/res/res/color/car_checkbox_color.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-<?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">
- <item android:state_enabled="true"
- android:state_checked="true"
- android:color="@color/car_checkbox_fill_color"
- />
- <item android:state_enabled="true"
- android:state_checked="false"
- android:color="@color/car_checkbox_border_color"
- />
- <item android:state_enabled="false"
- android:state_checked="true"
- android:alpha="?android:attr/disabledAlpha"
- android:color="@color/car_checkbox_fill_color"
- />
- <item android:state_enabled="false"
- android:state_checked="false"
- android:alpha="?android:attr/disabledAlpha"
- android:color="@color/car_checkbox_border_color"
- />
-</selector>
diff --git a/car_product/overlay-visual/frameworks/base/core/res/res/color/car_radio_button_checked_color.xml b/car_product/overlay-visual/frameworks/base/core/res/res/color/car_radio_button_checked_color.xml
deleted file mode 100644
index e29e5b6..0000000
--- a/car_product/overlay-visual/frameworks/base/core/res/res/color/car_radio_button_checked_color.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?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">
- <item android:state_enabled="false"
- android:alpha="?android:attr/disabledAlpha"
- android:color="?android:attr/colorControlActivated"/>
- <item android:color="?android:attr/colorControlActivated"/>
-</selector>
-
diff --git a/car_product/overlay-visual/frameworks/base/core/res/res/color/car_selection_controls_checked_color.xml b/car_product/overlay-visual/frameworks/base/core/res/res/color/car_selection_controls_checked_color.xml
new file mode 100644
index 0000000..2eb26f4
--- /dev/null
+++ b/car_product/overlay-visual/frameworks/base/core/res/res/color/car_selection_controls_checked_color.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2022 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">
+ <item android:state_enabled="false"
+ android:alpha="?android:attr/disabledAlpha"
+ android:color="?android:attr/colorControlActivated"/>
+ <item android:color="?android:attr/colorControlActivated"/>
+</selector>
\ No newline at end of file
diff --git a/car_product/overlay-visual/frameworks/base/core/res/res/drawable/car_checkbox.xml b/car_product/overlay-visual/frameworks/base/core/res/res/drawable/car_checkbox.xml
new file mode 100644
index 0000000..42e03b5
--- /dev/null
+++ b/car_product/overlay-visual/frameworks/base/core/res/res/drawable/car_checkbox.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright 2022 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:width="@dimen/car_checkbox_size"
+ android:height="@dimen/car_checkbox_size"
+ android:drawable="@drawable/car_checkbox_material_anim"/>
+ <item
+ android:width="@dimen/car_checkbox_focus_ring_size"
+ android:height="@dimen/car_checkbox_focus_ring_size"
+ android:drawable="@drawable/car_checkbox_focus_highlight"
+ android:left="6dp"
+ android:top="6dp" />
+</layer-list>
diff --git a/car_product/overlay-visual/frameworks/base/core/res/res/drawable/car_checkbox_checked.xml b/car_product/overlay-visual/frameworks/base/core/res/res/drawable/car_checkbox_checked.xml
new file mode 100644
index 0000000..d96794b
--- /dev/null
+++ b/car_product/overlay-visual/frameworks/base/core/res/res/drawable/car_checkbox_checked.xml
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2015 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.
+-->
+
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:name="btn_checkbox_checked"
+ android:width="32dp"
+ android:viewportWidth="48"
+ android:height="32dp"
+ android:viewportHeight="48"
+ android:tint="@color/car_selection_controls_checked_color">
+ <group
+ android:name="icon_null"
+ android:translateX="24"
+ android:translateY="24"
+ android:scaleX="0.2"
+ android:scaleY="0.2">
+ <group
+ android:name="check"
+ android:scaleX="7.5"
+ android:scaleY="7.5">
+ <path
+ android:name="check_path_merged"
+ android:pathData="M 7.0,-9.0 c 0.0,0.0 -14.0,0.0 -14.0,0.0 c -1.1044921875,0.0 -2.0,0.8955078125 -2.0,2.0 c 0.0,0.0 0.0,14.0 0.0,14.0 c 0.0,1.1044921875 0.8955078125,2.0 2.0,2.0 c 0.0,0.0 14.0,0.0 14.0,0.0 c 1.1044921875,0.0 2.0,-0.8955078125 2.0,-2.0 c 0.0,0.0 0.0,-14.0 0.0,-14.0 c 0.0,-1.1044921875 -0.8955078125,-2.0 -2.0,-2.0 c 0.0,0.0 0.0,0.0 0.0,0.0 Z M -2.0,5.00001525879 c 0.0,0.0 -5.0,-5.00001525879 -5.0,-5.00001525879 c 0.0,0.0 1.41409301758,-1.41409301758 1.41409301758,-1.41409301758 c 0.0,0.0 3.58590698242,3.58601379395 3.58590698242,3.58601379395 c 0.0,0.0 7.58590698242,-7.58601379395 7.58590698242,-7.58601379395 c 0.0,0.0 1.41409301758,1.41409301758 1.41409301758,1.41409301758 c 0.0,0.0 -9.0,9.00001525879 -9.0,9.00001525879 Z"
+ android:fillColor="#FF000000" />
+ </group>
+ <group
+ android:name="box_dilate"
+ android:scaleX="7.5"
+ android:scaleY="7.5">
+ <path
+ android:name="box_inner_merged"
+ android:pathData="M 0.0,-1.0 l 0.0,0.0 c 0.5522847498,0.0 1.0,0.4477152502 1.0,1.0 l 0.0,0.0 c 0.0,0.5522847498 -0.4477152502,1.0 -1.0,1.0 l 0.0,0.0 c -0.5522847498,0.0 -1.0,-0.4477152502 -1.0,-1.0 l 0.0,0.0 c 0.0,-0.5522847498 0.4477152502,-1.0 1.0,-1.0 Z M 7.0,-9.0 c 0.0,0.0 -14.0,0.0 -14.0,0.0 c -1.1044921875,0.0 -2.0,0.8955078125 -2.0,2.0 c 0.0,0.0 0.0,14.0 0.0,14.0 c 0.0,1.1044921875 0.8955078125,2.0 2.0,2.0 c 0.0,0.0 14.0,0.0 14.0,0.0 c 1.1044921875,0.0 2.0,-0.8955078125 2.0,-2.0 c 0.0,0.0 0.0,-14.0 0.0,-14.0 c 0.0,-1.1044921875 -0.8955078125,-2.0 -2.0,-2.0 c 0.0,0.0 0.0,0.0 0.0,0.0 Z"
+ android:fillColor="#FF000000"
+ android:fillAlpha="0" />
+ </group>
+ </group>
+</vector>
\ No newline at end of file
diff --git a/car_product/overlay-visual/frameworks/base/core/res/res/drawable/car_checkbox_focus_highlight.xml b/car_product/overlay-visual/frameworks/base/core/res/res/drawable/car_checkbox_focus_highlight.xml
new file mode 100644
index 0000000..cff97f0
--- /dev/null
+++ b/car_product/overlay-visual/frameworks/base/core/res/res/drawable/car_checkbox_focus_highlight.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright 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">
+ <item android:state_focused="true" android:state_pressed="true">
+ <shape android:shape="rectangle">
+ <solid android:color="@color/focus_pressed_fill_color" />
+ <stroke android:width="4dp" android:color="@color/focus_stroke_color" />
+ <corners android:radius="10dp"/>
+ </shape>
+ </item>
+ <item android:state_focused="true">
+ <shape android:shape="rectangle">
+ <solid android:alpha="@color/focus_fill_color" />
+ <stroke android:width="8dp" android:color="@color/focus_stroke_color" />
+ <corners android:radius="10dp"/>
+ </shape>
+ </item>
+</selector>
\ No newline at end of file
diff --git a/car_product/overlay-visual/frameworks/base/core/res/res/drawable/car_checkbox_material_anim.xml b/car_product/overlay-visual/frameworks/base/core/res/res/drawable/car_checkbox_material_anim.xml
new file mode 100644
index 0000000..0a3f676
--- /dev/null
+++ b/car_product/overlay-visual/frameworks/base/core/res/res/drawable/car_checkbox_material_anim.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2022 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.
+-->
+
+<animated-selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item
+ android:id="@+id/checked"
+ android:state_checked="true"
+ android:drawable="@drawable/car_checkbox_checked" />
+ <item
+ android:id="@+id/unchecked"
+ android:drawable="@*android:drawable/btn_checkbox_unchecked_mtrl" />
+ <transition
+ android:fromId="@+id/unchecked"
+ android:toId="@+id/checked"
+ android:drawable="@*android:drawable/btn_checkbox_unchecked_to_checked_mtrl_animation" />
+ <transition
+ android:fromId="@+id/checked"
+ android:toId="@+id/unchecked"
+ android:drawable="@*android:drawable/btn_checkbox_checked_to_unchecked_mtrl_animation" />
+</animated-selector>
\ No newline at end of file
diff --git a/car_product/overlay-visual/frameworks/base/core/res/res/drawable/car_radio_button_checked.xml b/car_product/overlay-visual/frameworks/base/core/res/res/drawable/car_radio_button_checked.xml
index 760f00b..91522ed 100644
--- a/car_product/overlay-visual/frameworks/base/core/res/res/drawable/car_radio_button_checked.xml
+++ b/car_product/overlay-visual/frameworks/base/core/res/res/drawable/car_radio_button_checked.xml
@@ -27,7 +27,7 @@
android:height="@dimen/car_radio_button_outer_ring_size" />
<stroke
android:width="@dimen/car_radio_button_outer_ring_stroke_width"
- android:color="@color/car_radio_button_checked_color"/>
+ android:color="@color/car_selection_controls_checked_color"/>
</shape>
</item>
<item android:gravity="center">
@@ -36,7 +36,7 @@
<size
android:width="@dimen/car_radio_button_inner_circle_size"
android:height="@dimen/car_radio_button_inner_circle_size" />
- <solid android:color="@color/car_radio_button_checked_color"/>
+ <solid android:color="@color/car_selection_controls_checked_color"/>
</shape>
</item>
<item
diff --git a/car_product/overlay-visual/frameworks/base/core/res/res/values/colors.xml b/car_product/overlay-visual/frameworks/base/core/res/res/values/colors.xml
index 9ecae82..9df2389 100644
--- a/car_product/overlay-visual/frameworks/base/core/res/res/values/colors.xml
+++ b/car_product/overlay-visual/frameworks/base/core/res/res/values/colors.xml
@@ -71,8 +71,4 @@
<color name="car_seekbar_thumb">#FFFFFF</color>
<!-- The SeekBar thumb color when disabled. Use for the dark theme. -->
<color name="car_seekbar_thumb_disabled_on_dark">#757575</color>
- <!-- The checkbox fill color. -->
- <color name="car_checkbox_fill_color">#66B5FF</color>
- <!-- The checkbox border color. -->
- <color name="car_checkbox_border_color">#FFFFFF</color>
</resources>
diff --git a/car_product/overlay-visual/frameworks/base/core/res/res/values/dimens.xml b/car_product/overlay-visual/frameworks/base/core/res/res/values/dimens.xml
index 1bd7edd..f6a907b 100644
--- a/car_product/overlay-visual/frameworks/base/core/res/res/values/dimens.xml
+++ b/car_product/overlay-visual/frameworks/base/core/res/res/values/dimens.xml
@@ -166,6 +166,12 @@
<dimen name="car_radio_button_focus_ring_size">69dp</dimen>
<dimen name="car_radio_button_focus_ring_padding">12dp</dimen>
+ <!-- Checkbox dimensions. -->
+ <!-- 77dp scales the material checkbox to provide a 44dp x 44dp checkbox rectangle. -->
+ <dimen name="car_checkbox_size">77dp</dimen>
+ <!-- The checkbox focus ring size -->
+ <dimen name="car_checkbox_focus_ring_size">66dp</dimen>
+
<!-- SeekBar dimensions. -->
<!-- Allows thumb to extend out of the range of the track. -->
<!-- For more information see android.widget.SeekBar#attr_android:thumbOffset. -->
diff --git a/car_product/overlay-visual/frameworks/base/core/res/res/values/styles_device_default.xml b/car_product/overlay-visual/frameworks/base/core/res/res/values/styles_device_default.xml
index d3cd8d7..8c4ce1c 100644
--- a/car_product/overlay-visual/frameworks/base/core/res/res/values/styles_device_default.xml
+++ b/car_product/overlay-visual/frameworks/base/core/res/res/values/styles_device_default.xml
@@ -103,8 +103,7 @@
</style>
<style name="Widget.DeviceDefault.CompoundButton.CheckBox" parent="android:Widget.Material.CompoundButton.CheckBox">
- <item name="android:button">@*android:drawable/car_checkbox</item>
- <item name="android:buttonTint">@color/car_checkbox_color</item>
+ <item name="android:button">@drawable/car_checkbox</item>
</style>
<style name="Widget.DeviceDefault.CompoundButton.RadioButton"