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 an AppBarLayout is loaded, it will load the attribute and set up a non-forcing pending action. However when it's measured, the current scroll state will be saved and restored, which will override the non-forcing pending action. This behavior is incorrect - if there's a pending action, we shouldn't restore the scrolling state because it's meant to be changed.
Resolves https://github.com/material-components/material-components-android/issues/2629
PiperOrigin-RevId: 440960254
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
When the date picker goes back from background to foreground, the onStart() method will be called and make enableEdgeToEdge() be called again. This will make it incorrectly use the header height and top padding already adjusted with system inset as the original height and padding, and thus add the inset multiple times.
Creates a flag to only enable edge-to-edge once to fix the issue.
Resolves https://github.com/material-components/material-components-android/issues/2628
PiperOrigin-RevId: 440110562
Before, its value was being overwritten in code where we set the default popup background, so we should null it in the Material styles.
PiperOrigin-RevId: 437813304
Fixed by checking for the input type instead of the key listener (which remains as non null when updating the input type).
PiperOrigin-RevId: 436308197
Before, in requestRectangleOnScreen we were setting the text input layout’s rectangle to a specific and constant position, which caused the zoomed in screen to be fixed to the left instead of following the input text as it was typed. We should use the edit text’s rectangle’s position first, then adjust for the text field’s height (which includes the helper/error text), then use that updated rectangle on the super call of the method.
PiperOrigin-RevId: 435402032
Removed the Context/Application/Activity in the Builders class.
Updated docs accordingly and added examples explaining how harmonizing color attributes with theme overlay works.
PiperOrigin-RevId: 433769484
Reduces and restructures the calling chain when a state is set to improve readability and robustness.
This CL also introduces the following fixes:
1. Limit the possible input values of setState() and throws IllegalArgumentException if invalid values are provided.
2. Block the state to be set as HIDDEN when hideable is false.
3. Fix the bug that SettleRunnable could be posted multiple times due to isPosted flag being incorrectly set to false when the settling is still going on.
4. Fix the bug that dragging the bottom sheet when settling would result the bottom sheet in an incorrect state (the target state of settling instead of DRAGGING).
PiperOrigin-RevId: 432963533