In certain situations drawable states won't be correctly propagated to the background drawable wrapped in a LayerDrawable during setting view background. Always explicitly updates the drawable state to fix the issue.
Resolves https://github.com/material-components/material-components-android/issues/2670
PiperOrigin-RevId: 446786432
On Lollipop, when first assigned as View's background, RippleDrawable won't/can't propagate states to its content drawable. This causes the issue that the state relevant features like stroke colors are not correctly updated when the background is recreated. Explicitly assigns states to the content drawable to fix the issue.
Resolves https://github.com/material-components/material-components-android/issues/1422
PiperOrigin-RevId: 442676637
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
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
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
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
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.
Resolves https://github.com/material-components/material-components-android/issues/2263
PiperOrigin-RevId: 418054400
We missed to include top/bottom insets of button styles into dialog action margin calculation. Also the paddings between titles and messages were not correct.
PiperOrigin-RevId: 417626927
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