Skip to content

Commit 106aaeb

Browse files
kendrickumstattdpaulfthomas
authored andcommitted
[SplitButton] Update split button styles to match spec.
PiperOrigin-RevId: 700697360
1 parent 8eab776 commit 106aaeb

File tree

8 files changed

+76
-14
lines changed

8 files changed

+76
-14
lines changed

catalog/java/io/material/catalog/button/res/layout/cat_split_button_fragment.xml

Lines changed: 39 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,20 @@
4141
<Button
4242
android:layout_width="wrap_content"
4343
android:layout_height="wrap_content"
44+
android:paddingStart="@dimen/m3_comp_split_button_small_leading_button_leading_space"
45+
android:paddingEnd="@dimen/m3_comp_split_button_small_leading_button_trailing_space"
4446
android:minWidth="@dimen/mtrl_min_touch_target_size"
4547
app:icon="@drawable/ic_edit_vd_theme_24dp"
48+
app:iconSize="20dp"
4649
app:iconPadding="0dp"/>
4750
<Button
4851
style="?attr/materialSplitButtonIconFilledStyle"
4952
android:id="@+id/expand_more_or_less_filled_icon"
5053
android:layout_width="wrap_content"
5154
android:layout_height="wrap_content"
55+
android:paddingStart="@dimen/m3_comp_split_button_small_trailing_button_leading_space"
56+
android:paddingEnd="@dimen/m3_comp_split_button_small_trailing_button_trailing_space"
57+
android:minWidth="@dimen/mtrl_min_touch_target_size"
5258
android:contentDescription="@string/cat_split_button_label_chevron"
5359
app:icon="@drawable/m3_split_button_chevron_avd"/>
5460
</com.google.android.material.button.MaterialSplitButton>
@@ -59,13 +65,18 @@
5965
<Button
6066
android:layout_width="wrap_content"
6167
android:layout_height="wrap_content"
68+
android:paddingStart="@dimen/m3_comp_split_button_small_leading_button_leading_space"
69+
android:paddingEnd="@dimen/m3_comp_split_button_small_leading_button_trailing_space"
6270
android:minWidth="@dimen/mtrl_min_touch_target_size"
6371
android:text="@string/cat_split_button_short_label"/>
6472
<Button
6573
style="?attr/materialSplitButtonIconFilledStyle"
6674
android:id="@+id/expand_more_or_less_filled_label"
6775
android:layout_width="wrap_content"
6876
android:layout_height="wrap_content"
77+
android:paddingStart="@dimen/m3_comp_split_button_small_trailing_button_leading_space"
78+
android:paddingEnd="@dimen/m3_comp_split_button_small_trailing_button_trailing_space"
79+
android:minWidth="@dimen/mtrl_min_touch_target_size"
6980
android:contentDescription="@string/cat_split_button_label_chevron"
7081
app:icon="@drawable/m3_split_button_chevron_avd"/>
7182
</com.google.android.material.button.MaterialSplitButton>
@@ -76,13 +87,20 @@
7687
<Button
7788
android:layout_width="wrap_content"
7889
android:layout_height="wrap_content"
90+
android:paddingStart="@dimen/m3_comp_split_button_small_leading_button_leading_space"
91+
android:paddingEnd="@dimen/m3_comp_split_button_small_leading_button_trailing_space"
92+
android:minWidth="@dimen/mtrl_min_touch_target_size"
7993
android:text="@string/cat_split_button_label"
80-
app:icon="@drawable/ic_edit_vd_theme_24dp"/>
94+
app:icon="@drawable/ic_edit_vd_theme_24dp"
95+
app:iconSize="20dp"/>
8196
<Button
8297
style="?attr/materialSplitButtonIconFilledStyle"
8398
android:id="@+id/expand_more_or_less_filled"
8499
android:layout_width="wrap_content"
85100
android:layout_height="wrap_content"
101+
android:paddingStart="@dimen/m3_comp_split_button_small_trailing_button_leading_space"
102+
android:paddingEnd="@dimen/m3_comp_split_button_small_trailing_button_trailing_space"
103+
android:minWidth="@dimen/mtrl_min_touch_target_size"
86104
android:contentDescription="@string/cat_split_button_label_chevron"
87105
app:icon="@drawable/m3_split_button_chevron_avd"/>
88106
</com.google.android.material.button.MaterialSplitButton>
@@ -102,16 +120,21 @@
102120
style="?attr/materialButtonTonalStyle"
103121
android:layout_width="wrap_content"
104122
android:layout_height="wrap_content"
123+
android:paddingStart="@dimen/m3_comp_split_button_small_leading_button_leading_space"
124+
android:paddingEnd="@dimen/m3_comp_split_button_small_leading_button_trailing_space"
105125
android:minWidth="@dimen/mtrl_min_touch_target_size"
106126
app:icon="@drawable/ic_edit_vd_theme_24dp"
107-
app:iconPadding="0dp"/>
127+
app:iconSize="20dp"/>
108128
<Button
109129
style="?attr/materialSplitButtonIconFilledTonalStyle"
110130
android:id="@+id/expand_more_or_less_tonal_icon"
111131
android:layout_width="wrap_content"
112132
android:layout_height="wrap_content"
113133
android:contentDescription="@string/cat_split_button_label_chevron"
114-
app:icon="@drawable/m3_split_button_chevron_avd"/>
134+
app:icon="@drawable/m3_split_button_chevron_avd"
135+
android:paddingStart="@dimen/m3_comp_split_button_small_trailing_button_leading_space"
136+
android:paddingEnd="@dimen/m3_comp_split_button_small_trailing_button_trailing_space"
137+
android:minWidth="@dimen/mtrl_min_touch_target_size"/>
115138
</com.google.android.material.button.MaterialSplitButton>
116139

117140
<com.google.android.material.button.MaterialSplitButton
@@ -121,13 +144,18 @@
121144
style="?attr/materialButtonTonalStyle"
122145
android:layout_width="wrap_content"
123146
android:layout_height="wrap_content"
147+
android:paddingStart="@dimen/m3_comp_split_button_small_leading_button_leading_space"
148+
android:paddingEnd="@dimen/m3_comp_split_button_small_leading_button_trailing_space"
124149
android:minWidth="@dimen/mtrl_min_touch_target_size"
125150
android:text="@string/cat_split_button_short_label"/>
126151
<Button
127152
style="?attr/materialSplitButtonIconFilledTonalStyle"
128153
android:id="@+id/expand_more_or_less_tonal_label"
129154
android:layout_width="wrap_content"
130155
android:layout_height="wrap_content"
156+
android:paddingStart="@dimen/m3_comp_split_button_small_trailing_button_leading_space"
157+
android:paddingEnd="@dimen/m3_comp_split_button_small_trailing_button_trailing_space"
158+
android:minWidth="@dimen/mtrl_min_touch_target_size"
131159
android:contentDescription="@string/cat_split_button_label_chevron"
132160
app:icon="@drawable/m3_split_button_chevron_avd"/>
133161
</com.google.android.material.button.MaterialSplitButton>
@@ -139,13 +167,20 @@
139167
style="?attr/materialButtonTonalStyle"
140168
android:layout_width="wrap_content"
141169
android:layout_height="wrap_content"
170+
android:paddingStart="@dimen/m3_comp_split_button_small_leading_button_leading_space"
171+
android:paddingEnd="@dimen/m3_comp_split_button_small_leading_button_trailing_space"
172+
android:minWidth="@dimen/mtrl_min_touch_target_size"
142173
android:text="@string/cat_split_button_label"
143-
app:icon="@drawable/ic_edit_vd_theme_24dp"/>
174+
app:icon="@drawable/ic_edit_vd_theme_24dp"
175+
app:iconSize="20dp"/>
144176
<Button
145177
style="?attr/materialSplitButtonIconFilledTonalStyle"
146178
android:id="@+id/expand_more_or_less_tonal"
147179
android:layout_width="wrap_content"
148180
android:layout_height="wrap_content"
181+
android:paddingStart="@dimen/m3_comp_split_button_small_trailing_button_leading_space"
182+
android:paddingEnd="@dimen/m3_comp_split_button_small_trailing_button_trailing_space"
183+
android:minWidth="@dimen/mtrl_min_touch_target_size"
149184
android:contentDescription="@string/cat_split_button_label_chevron"
150185
app:icon="@drawable/m3_split_button_chevron_avd"/>
151186
</com.google.android.material.button.MaterialSplitButton>

lib/java/com/google/android/material/button/res/animator/chevron_checked_unchecked.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
limitations under the License.
1616
-->
1717
<animated-vector xmlns:android="http://schemas.android.com/apk/res/android"
18-
android:drawable="@drawable/ic_expand_less_24px">
18+
android:drawable="@drawable/ic_expand_less_22px">
1919
<target
2020
android:name="rotationGroup"
2121
android:animation="@animator/m3_split_button_chevron_reverse_rotation"/>

lib/java/com/google/android/material/button/res/animator/chevron_unchecked_checked.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
limitations under the License.
1616
-->
1717
<animated-vector xmlns:android="http://schemas.android.com/apk/res/android"
18-
android:drawable="@drawable/ic_expand_more_24px">
18+
android:drawable="@drawable/ic_expand_more_22px">
1919
<target
2020
android:name="rotationGroup"
2121
android:animation="@animator/m3_split_button_chevron_rotation"/>

lib/java/com/google/android/material/button/res/drawable/ic_expand_less_24px.xml renamed to lib/java/com/google/android/material/button/res/drawable/ic_expand_less_22px.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
limitations under the License.
1616
-->
1717
<vector xmlns:android="http://schemas.android.com/apk/res/android"
18-
android:width="24dp"
19-
android:height="24dp"
18+
android:width="22dp"
19+
android:height="22dp"
2020
android:viewportWidth="960"
2121
android:viewportHeight="960"
2222
android:tint="?attr/colorControlNormal">

lib/java/com/google/android/material/button/res/drawable/ic_expand_more_24px.xml renamed to lib/java/com/google/android/material/button/res/drawable/ic_expand_more_22px.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
limitations under the License.
1616
-->
1717
<vector xmlns:android="http://schemas.android.com/apk/res/android"
18-
android:width="24dp"
19-
android:height="24dp"
18+
android:width="22dp"
19+
android:height="22dp"
2020
android:viewportWidth="960"
2121
android:viewportHeight="960"
2222
android:tint="?attr/colorControlNormal">

lib/java/com/google/android/material/button/res/drawable/m3_split_button_chevron_avd.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,18 @@
1717
<animated-selector xmlns:android="http://schemas.android.com/apk/res/android"
1818
xmlns:app="http://schemas.android.com/apk/res-auto"
1919
xmlns:tools="http://schemas.android.com/tools"
20-
android:width="24dp"
21-
android:height="24dp"
20+
android:width="22dp"
21+
android:height="22dp"
2222
tools:ignore="NewApi">
2323

2424
<item
2525
android:id="@+id/checked"
26-
android:drawable="@drawable/ic_expand_less_24px"
26+
android:drawable="@drawable/ic_expand_less_22px"
2727
android:state_checked="true" />
2828

2929
<item
3030
android:id="@+id/unchecked"
31-
android:drawable="@drawable/ic_expand_more_24px"
31+
android:drawable="@drawable/ic_expand_more_22px"
3232
android:state_checked="false" />
3333

3434
<transition

lib/java/com/google/android/material/button/res/values/styles.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,11 @@
135135

136136
<style name="Widget.Material3.MaterialSplitButton" parent="Widget.Material3.MaterialButtonGroup.Connected">
137137
<item name="android:spacing">0dp</item>
138+
<item name="android:paddingTop">10dp</item>
139+
<item name="android:paddingBottom">10dp</item>
140+
<item name="innerCornerSize">@xml/m3_split_button_inner_corner_size_state_list</item>
138141
<item name="buttonSizeChange">@null</item>
142+
<item name="shapeAppearance">@style/ShapeAppearance.M3.Sys.Shape.Corner.Full</item>
139143
</style>
140144

141145
<style name="Widget.Material3.SplitButton.IconButton.Filled" parent="Widget.Material3.Button.IconButton.Filled">
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
Copyright 2024 The Android Open Source Project
4+
5+
Licensed under the Apache License, Version 2.0 (the "License");
6+
you may not use this file except in compliance with the License.
7+
You may obtain a copy of the License at
8+
9+
http://www.apache.org/licenses/LICENSE-2.0
10+
11+
Unless required by applicable law or agreed to in writing, software
12+
distributed under the License is distributed on an "AS IS" BASIS,
13+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
See the License for the specific language governing permissions and
15+
limitations under the License.
16+
-->
17+
<selector xmlns:android="http://schemas.android.com/apk/res/android"
18+
xmlns:app="http://schemas.android.com/apk/res-auto">
19+
<item android:state_checkable="true" android:state_pressed="true"
20+
app:cornerSize="12dp"/>
21+
<item android:state_checked="true" app:cornerSize="50%"/>
22+
<item app:cornerSize="4dp"/>
23+
</selector>

0 commit comments

Comments
 (0)