diff options
| author | 2024-11-06 15:43:57 +0000 | |
|---|---|---|
| committer | 2024-11-27 21:06:05 -0800 | |
| commit | ba15cd8b8c7b2d3accc79a4321b0af80e27b806c (patch) | |
| tree | d087c472cb99acf92723ad4386b4af4ff014f7de | |
| parent | fb51ac3ca0eac3694c6753306585a7dc25681351 (diff) | |
m3: impl baseline button styling Outline & Text
Add two of material3 button types to the wear device styling:
- Outlined
- Text
Flag: android.widget.flags.use_wear_material3_ui
Test: by PlatformMaterialUiTestApp
Bug: 371650355
Change-Id: I4d53dc6f6132344c320acb42ea506d3f7d4a3df2
4 files changed, 103 insertions, 4 deletions
diff --git a/core/res/res/color-watch-v36/btn_material_outlined_background_color.xml b/core/res/res/color-watch-v36/btn_material_outlined_background_color.xml new file mode 100644 index 000000000000..665f47faca0d --- /dev/null +++ b/core/res/res/color-watch-v36/btn_material_outlined_background_color.xml @@ -0,0 +1,22 @@ +<!-- + ~ Copyright (C) 2024 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="?attr/disabledAlpha" + android:color="?attr/materialColorOnSurface" /> + <item android:color="?attr/materialColorOutline" /> +</selector> diff --git a/core/res/res/drawable-watch-v36/btn_background_material_outlined.xml b/core/res/res/drawable-watch-v36/btn_background_material_outlined.xml new file mode 100644 index 000000000000..7bc40604dc25 --- /dev/null +++ b/core/res/res/drawable-watch-v36/btn_background_material_outlined.xml @@ -0,0 +1,39 @@ +<!-- + ~ Copyright (C) 2024 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. + --> + +<ripple xmlns:android="http://schemas.android.com/apk/res/android" + android:color="?attr/colorControlHighlight"> + <item android:id="@android:id/mask"> + <shape android:shape="rectangle"> + <corners android:radius="@dimen/config_wearMaterial3_buttonCornerRadius"/> + <solid android:color="#fff"/> + <size + android:width="@dimen/btn_material_width" + android:height="@dimen/btn_material_height" /> + </shape> + </item> + <item> + <shape android:shape="rectangle"> + <corners android:radius="@dimen/config_wearMaterial3_buttonCornerRadius"/> + <stroke + android:width="1dp" + android:color="@color/btn_material_outlined_background_color" /> + <size + android:width="@dimen/btn_material_width" + android:height="@dimen/btn_material_height" /> + </shape> + </item> +</ripple> diff --git a/core/res/res/drawable-watch-v36/btn_background_material_text.xml b/core/res/res/drawable-watch-v36/btn_background_material_text.xml new file mode 100644 index 000000000000..145685c8095c --- /dev/null +++ b/core/res/res/drawable-watch-v36/btn_background_material_text.xml @@ -0,0 +1,28 @@ +<!-- + ~ Copyright (C) 2024 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. + --> + +<ripple xmlns:android="http://schemas.android.com/apk/res/android" + android:color="?attr/colorControlHighlight"> + <item android:id="@android:id/mask"> + <shape android:shape="rectangle"> + <corners android:radius="@dimen/config_wearMaterial3_buttonCornerRadius"/> + <solid android:color="#fff"/> + <size + android:width="@dimen/btn_material_width" + android:height="@dimen/btn_material_height" /> + </shape> + </item> +</ripple> diff --git a/core/res/res/values-watch-v36/styles_material.xml b/core/res/res/values-watch-v36/styles_material.xml index fc9f669becc7..6e5ef68a70c3 100644 --- a/core/res/res/values-watch-v36/styles_material.xml +++ b/core/res/res/values-watch-v36/styles_material.xml @@ -1,4 +1,4 @@ -<?xml version="1.0" encoding="utf-8"?> +<?xml version="1.0" encoding="utf-8"?> <!-- ~ Copyright (C) 2024 The Android Open Source Project ~ @@ -17,13 +17,13 @@ <resources> <!-- Button Styles --> - <!-- Material Button - Filled --> + <!-- Material Button - Filled (primary colored) --> <style name="Widget.DeviceDefault.Button.Filled" parent="Widget.DeviceDefault.Button.WearMaterial3"> <item name="android:background">@drawable/btn_background_material_filled</item> <item name="textAppearance">@style/TextAppearance.Widget.Button.Material.Filled</item> </style> - <!-- Material Button - Filled Tonal(Override system default button styles) --> + <!-- Material Button - Filled Tonal (Override system default button styles) --> <style name="Widget.DeviceDefault.Button.WearMaterial3"> <item name="background">@drawable/btn_background_material_filled_tonal</item> <item name="textAppearance">@style/TextAppearance.Widget.Button.Material</item> @@ -41,9 +41,19 @@ <item name="gravity">center_vertical</item> </style> + <!-- Material Button - Outlined --> + <style name="Widget.DeviceDefault.Button.Outlined" parent="Widget.DeviceDefault.Button.WearMaterial3"> + <item name="android:background">@drawable/btn_background_material_outlined</item> + </style> + + <!-- Material Button - Text --> + <style name="Widget.DeviceDefault.Button.Text" parent="Widget.DeviceDefault.Button.WearMaterial3"> + <item name="android:background">@drawable/btn_background_material_text</item> + </style> + <!-- Text Styles --> <!-- TextAppearance for Material Button - Filled --> - <style name="TextAppearance.Widget.Button.Material.Filled" parent="TextAppearance.Widget.Button.Material"> + <style name="TextAppearance.Widget.Button.Material.Filled"> <item name="textColor">@color/btn_material_filled_content_color</item> </style> |