In the original logic we compares interpolated text size to decide if the available width should be the collapsed one or the expanded one. This logic wouldn't work if the collapsed text size and the expanded text size are the same. Refactors the logic to make the decision by interpolating fraction directly.
Resolves https://github.com/material-components/material-components-android/issues/2459
PiperOrigin-RevId: 410901171
After letter spacing is correctly set in CollapsingTextHelper.calculateUsingTextSize(), we no longer need to set letter spacing separately for collapsed and expanded titles. Also this enhances the logic by using textPaint consistently in CollapsingTextHelper.calculateBaseOffsets(), which was not the case before the change. (We got text height from textPaint and text width from tmpPaint.)
PiperOrigin-RevId: 410888232
Now clicking on dropdown menu via switch access triggers the dropdown list. Plus, the arrow icon is set to be not important for a11y only for screen readers.
PiperOrigin-RevId: 410858001
When we try to draw cutout on text field borders, we draw the stroke on a bitmap first. However if the text field is too large, the bitmap size will be too large and cannot be drawn back to the real canvas, which causes crashes.
Adds a workaround/fallback solution to avoid the crash.
PiperOrigin-RevId: 410523013
We recreated title text layout when expanding from the collapsed state but didn't correctly set the letter spacing to the expanded one. The letter spacing being used will be a interpolated value between collapsed and expanded letter spacing (close to the collapsed one due to the implementation). This will cause the text layout incorrectly calculate the line count from the wrong letter spacing and result in a broken layout.
Correctly sets the letter spacing to fix the issue.
Resolves https://github.com/material-components/material-components-android/issues/2463
PiperOrigin-RevId: 408910555
We changes letter spacing during expanding/collapsing animations, which causes us use letter spacing during animation while calculating final expanded/collapsed offset instead of final letter spacing. This in turn causes hints be drawn at the wrong positions. Uses final letter spacing during calculating offset instead to fix the problem.
Resolves https://github.com/material-components/material-components-android/issues/2277
PiperOrigin-RevId: 408904991
In single line mode, we implement the expanded title alignment by calculating the expected x-coordinate of expanded title and translate the canvas so the title will be aligned. However, when maxLines > 1, the static layout will always occupy the full available width, therefore the text alignment need to be done by the static layout instead.
Provides text alignment other than NORMAL when it's in multi-line mode to solve the issue.
Resolves https://github.com/material-components/material-components-android/issues/1276
PiperOrigin-RevId: 408895140
If somehow scroll position is set to -1 with and position offset greater than 0.5, we will decide it's a valid scroll position which causes NPE for selected child not found.
Fixes this by checking if position is valid regardless the offset and falling back to 0 if a negative position is given.
Resolves https://github.com/material-components/material-components-android/issues/2464
PiperOrigin-RevId: 408894188
Re-measures the card when checked icon gravity changes in order to move the icon position. Also corrects the padding adjustment logic for pre-lolipop or when compat paddings are being used.
PiperOrigin-RevId: 408876717
For the editable type it remains as was: clicking on the edit text triggers the keyboard and clicking on the arrow icon shows the dropdown list.
PiperOrigin-RevId: 408655618
The setLabelFor calls were made in the call to populate the accessibility node but they were made after calling super (one of them was actually nested inside of a getter!), this is too late, the accessibility node is populated with the label for by the super class
PiperOrigin-RevId: 407178334
Before, when swiping with TalkBack on, the placeholder text would be mistakenly announced. This change makes it so it's only announced when it appears, for API >= 16. It's still announced as part of the description announcement when the text field is selected, as before, so it's still accessible for APIs < 16.
PiperOrigin-RevId: 405668594
Before, when swiping with TalkBack on, the placeholder text would be mistakenly announced. This change makes it so it's only announced when it appears, for API >= 16. It's still announced as part of the description announcement when the text field is selected, as before, so it's still accessible for APIs < 16.
PiperOrigin-RevId: 404871534