112 Commits

Author SHA1 Message Date
pekingme
7c66a2ef94 [ButtonGroup] Added the "wrap" overflow mode.
If the "wrap" overflow mode is in use, the button group will wrap the buttons that don't fit in one row to more rows below.

PiperOrigin-RevId: 800551513
2025-08-29 11:44:37 -07:00
rightnao
85e2fd04bd [MaterialButton] Update corner radius behavior to override StateListShapeAppearance if set
PiperOrigin-RevId: 784640767
2025-07-21 14:34:20 +00:00
rightnao
4db190003e [MaterialShapeDrawable] Introduce ShapeAppearance interface to reduce branching between ShapeAppearanceModel and StateListShapeAppearanceModel
PiperOrigin-RevId: 784395554
2025-07-21 14:32:30 +00:00
pekingme
6d8d750735 [Button] Fixed width morph in vertical button groups.
PiperOrigin-RevId: 770651707
2025-06-12 20:05:47 +00:00
pekingme
0c5b17a406 [Button] Fixed a bug that checked state in XML was not respected.
PiperOrigin-RevId: 755123809
2025-05-07 19:28:26 +00:00
pekingme
d791fad4cc [ButtonGroup] Fixed the bug of size morph not working with layout_weight.
PiperOrigin-RevId: 748859113
2025-04-18 00:17:04 +00:00
kendricku
2667e098db [Button] Added optical center feature.
ORIGINAL_AUTHOR=pekingme

PiperOrigin-RevId: 748415083
2025-04-18 00:14:04 +00:00
pekingme
99ff34c0f2 Automated g4 rollback of changelist 732281281
PiperOrigin-RevId: 733564962
2025-03-11 17:46:56 +00:00
pekingme
b6400780e4 [ButtonGroup] Fixed the bug of size morph not working with layout_weight.
PiperOrigin-RevId: 732281281
2025-03-03 19:57:37 +00:00
pubiqq
bc2fdeadaf [Internal] Prefer platform methods to compat ones
Resolves https://github.com/material-components/material-components-android/pull/4532

GIT_ORIGIN_REV_ID=180dec736f2521579e483317a4d537629d8f247b
PiperOrigin-RevId: 715494344
2025-01-15 18:06:07 +00:00
hunterstich
f4342f1eb8 [Motion] Added default style parameter for MotionUtil when resolving theme spring attributes
PiperOrigin-RevId: 714984914
2025-01-14 17:54:18 +00:00
hunterstich
59de693346 [Motion] Fixed typo for "spatial"
PiperOrigin-RevId: 708423524
2024-12-23 18:54:42 +00:00
hunterstich
98169d21c4 [Motion] Added spring motion subsystem
PiperOrigin-RevId: 705572242
2024-12-16 13:07:30 +00:00
kendricku
ec8be9ab57 Internal change
PiperOrigin-RevId: 704689311
2024-12-10 18:03:07 +00:00
hunterstich
e6472658a6 [Internal] Replaced MaterialThemeOverlay#wrap existing public wrap method.
PiperOrigin-RevId: 698796795
2024-11-21 17:36:09 +00:00
pekingme
7f8d63bb80 [Button] Added sizes and shape support.
PiperOrigin-RevId: 695840723
2024-11-21 17:14:16 +00:00
pekingme
dac7d5a0bd [Button] Made the "checked" state independent to the "enabled" state.
PiperOrigin-RevId: 683754074
2024-10-09 16:53:08 +00:00
pubiqq
23aca03255 [Internal] Remove pre-Lollipop checks
Resolves https://github.com/material-components/material-components-android/pull/4266

GIT_ORIGIN_REV_ID=1de7808e66dd6666c893217c76c7499afe2df6a3
PiperOrigin-RevId: 669688797
2024-09-03 13:31:29 +00:00
pekingme
29ce8d32c3 [ButtonGroup] Added a new component ButtonGroup.
PiperOrigin-RevId: 666359073
2024-08-22 19:05:09 +00:00
pekingme
cfef899cda [Button] Updated spring damping and stiffness for MaterialButton.
PiperOrigin-RevId: 661324416
2024-08-12 12:18:54 -07:00
pekingme
5bcae74813 [Button] Updated spring specs for responsive touch.
PiperOrigin-RevId: 660117556
2024-08-07 13:57:49 +00:00
pekingme
ef1e1cdbfc [Button] Added corner morph.
PiperOrigin-RevId: 657325202
2024-07-30 09:14:03 -07:00
pubiqq
204811089d [Internal] Replace deprecated androidx.core.view.* methods
Resolves https://github.com/material-components/material-components-android/pull/4180

GIT_ORIGIN_REV_ID=8e4ec29abacc33cde748b8f07f0ba5c251cef395
PiperOrigin-RevId: 656004130
2024-07-25 19:09:36 +00:00
Material Design Team
e4f00fda11 Automated g4 rollback of changelist 637051547
PiperOrigin-RevId: 637099379
2024-05-28 16:59:17 +00:00
pekingme
384d58fb98 [Button] Added responsive touch (corner morph).
PiperOrigin-RevId: 637051547
2024-05-25 02:19:11 +00:00
pubiqq
510881a469 [Internal] Stop using deprecated androidx.core.view.* methods
Resolves https://github.com/material-components/material-components-android/pull/4117

GIT_ORIGIN_REV_ID=dd157e8360c2511810496693cec1616fce578655
PiperOrigin-RevId: 632284856
2024-05-13 17:37:38 +00:00
Ga\u00ebtan Muller
b3fe6a7f61 [Cleanup] Remove redundant version checks for api <= 19.
Resolves https://github.com/material-components/material-components-android/pull/3849

GIT_ORIGIN_REV_ID=47bb2fcc8031740e5a7d4f741f1ada2af025e126
PiperOrigin-RevId: 632154861
2024-05-09 18:46:02 +00:00
dsn5ft
22de817c30 [Docs] Internal change
PiperOrigin-RevId: 613673995
2024-03-07 20:52:14 +00:00
Material Design Team
5471b8d37a Internal change
PiperOrigin-RevId: 607976596
2024-02-26 13:44:54 -08:00
rightnao
e3b255b3a0 [Docs] Crosslink github docs in javadocs
PiperOrigin-RevId: 546393704
2023-07-11 19:37:37 +00:00
dsn5ft
2b5c75f966 [Resource Inspection] Set up Android Studio resource inspection annotation and annotation processor, and add @Attribute annotation to MaterialButton#getIconPadding
PiperOrigin-RevId: 536411748
2023-05-30 15:46:52 +00:00
pfthomas
8656683639 [MaterialButtonToggleGroup][a11y] Update accessibility class name
PiperOrigin-RevId: 504557810
2023-01-26 17:09:27 +00:00
Material Design Team
3b333ee834 [Buttons] Use Layout to measure text width.
This corrects icon placement when used with Spanned text.

PiperOrigin-RevId: 483047554
2022-10-25 05:42:10 -07:00
rightnao
a601107868 [MaterialButton] Add methods to not toggle checked state on buttons on click
Resolves https://github.com/material-components/material-components-android/issues/2291

PiperOrigin-RevId: 453569861
2022-06-07 18:53:01 -07:00
conradchen
b6b895a1e4 [Button] Fix icon textStart/End alignment with multiline text
When calculating text width to decide the icon position with textStart/End alignment, we missed accounting for multiline text. Fixes this by calculating each line's width separately and take the widest one to decide the icon position.

Resolves https://github.com/material-components/material-components-android/issues/2007

PiperOrigin-RevId: 440982189
2022-04-11 17:13:57 -04:00
conradchen
19d05000bc [Button] Fix icon position with multiline text
When the icon gravity is textTop, we are using the smaller one of the calculated height from text paint and the text layout height to decide the icon position. This is wrong when there are multiple lines of text since the text paint is always single line and always shorter than the actual height.

Fixes this by returning the actual layout height whenever there are multiple lines of text to fix the issue.

Resolves https://github.com/material-components/material-components-android/issues/2619

PiperOrigin-RevId: 440923733
2022-04-11 15:12:33 -04:00
conradchen
b0f37007aa [Button] Fix icon position not being updated when size is not changed
If a button has a WRAP_CONTENT width and after its text is updated but its size does not change, the icon position won't be updated because at the moment when onTextChanged() is called, getLayout() will return null and a new layout to display text will only be recreated in the next onMeasure() call.

To fix this issue, the change moves updateIconPosition() from onSizeChanged() to onLayout(), which will always be called after onMeasure() or onSizeChanged() is called, and thus covers both of the cases after the text is updated (the button changes its size or not.)

Note: we still need to keep the updateIconPosition() call in onTextChanged(), to cover the case that the button has a fixed width, in which updating text won't trigger remeasuring of the button.

Resolves https://github.com/material-components/material-components-android/issues/2553

PiperOrigin-RevId: 427215840
2022-02-09 15:56:11 +00:00
conradchen
6c41f070e8 [Button] Support icon gravity with text alignments other than centered
Resolves https://github.com/material-components/material-components-android/issues/1371

PiperOrigin-RevId: 421605261
2022-01-18 12:02:02 -05:00
conradchen
3db25be3b6 [ButtonGroup] Simplify MaterialButtonToggleGroup's checking logic
1. Consolidates single selected ID and multiple selected IDs to a single selected
   ID set.
2. Separates View states and internal checked states so we can focus and enforce
   policies much easier on only internal states.

PiperOrigin-RevId: 420087718
2022-01-06 15:44:19 -05:00
Material Design Team
cfc00aa5a3 Update android core class definitions across material
PiperOrigin-RevId: 414839941
2021-12-08 14:56:25 +00:00
Material Design Team
a487c89185 Internal change
PiperOrigin-RevId: 412135443
2021-11-29 17:35:39 +00:00
dsn5ft
9ae56ceedd [Javadocs] Remove all broken attr links from Javadocs
PiperOrigin-RevId: 404246710
2021-10-20 19:06:18 +00:00
serniebanders
5844d3c134 [Button] Update icon state on Drawable state change.
Resolves: https://github.com/material-components/material-components-android/issues/2322

Follows pattern in View.drawableStateChanged() where drawable properties have states manually set.

PiperOrigin-RevId: 400754477
2021-10-05 09:04:56 -04:00
conradchen
456f135627 [Button] Fix progress indicator is not shown when set as the icon
MaterialButton is using TextViewCompat.setCompoundDrawablesRelative() under the hood to implement setIcon() operation. TextViewCompat won't call its compound drawables' setVisible() method, on which we rely to start progress indicator drawables automatically.

Calls setVisible() explicitly to start progressing.

Also adds a demo to catalog.

Resolves https://github.com/material-components/material-components-android/issues/2095

PiperOrigin-RevId: 383483364
2021-07-08 15:58:13 +00:00
dniz
25bf03ea2a [Docs] Remove broken @link from MaterialButton Javadoc
PiperOrigin-RevId: 356506184
2021-02-17 06:40:30 -08:00
hunterstich
fe58a4c81e [Button] Updated custom background warning message to be more informative.
Resolves https://github.com/material-components/material-components-android/issues/1803

PiperOrigin-RevId: 337894750
2020-10-19 11:47:05 -07:00
marianomartin
f837cb76ab [MaterialButton] Support setting vertical insets programatically
Resolves https://github.com/material-components/material-components-android/issues/526

PiperOrigin-RevId: 323450357
2020-07-28 10:28:38 -04:00
marianomartin
555356b03f Internal cleanup
PiperOrigin-RevId: 318134343
2020-06-26 14:06:52 -04:00
Rafael Wolf de Goes
b39845a452 Automated g4 rollback of changelist 314782767
PiperOrigin-RevId: 316867631
2020-06-17 18:40:38 -07:00
Rafael Wolf de Goes
1171418c2b Automated g4 rollback of changelist 314715132
PiperOrigin-RevId: 314782767
2020-06-05 14:49:43 -04:00