RippleDrawable on different API levels will modulate the alphas differently
for the pressed / focused / hovered states. Therefore, in order to get the
desired alphas for pressed / focused / hovered states, we are using the
mtrl_low_ripple_(pressed|focused|hovered|default)_alpha values which have
been defined to account for the different implementations of RippleDrawable.
PiperOrigin-RevId: 254737730
The OnChangedListener provides a callback that MaterialShapeDrawables can use to invalidate themselves when the associated ShapeAppearanceModel changes. This allows for modifying the ShapeAppearanceModel through the get/setShapeAppearance methods that the Shapeable interface exposes without having to update the client to redraw itself.
PiperOrigin-RevId: 238703600
Prior to this change, when setLayoutDirection is called on a parent/ancestor View of a Chip, the updated layout direction could be propagated to the Chip without updating its text padding. This change forces a padding update whenever layout direction changes.
PiperOrigin-RevId: 230933347
Created TextAppearanceFontCallback (a fork of FontCallback) in order to pass parameter indicating whether font was resolved synchronously.
PiperOrigin-RevId: 216566240
Avoid setting custom ExploreByTouchHelper as delegate in pre-N unless there's a close/trailing icon. This is necessary to workaround a Talkback bug.
PiperOrigin-RevId: 211490101
The previous code was setting total padding (both start & end) as just end padding of the parent TextView and relying on the invalidation phase drawing the text in the correct place by shifting canvas with computed offset of start padding. This is risky as Chip may be just re-laid without actually invalidating it and render wrong paddings. Also RTL layout direction is incorrectly identified as LTR during layout sometimes, which makes the text being rendered with incorrect offset.
This change sets the paddings correctly removing the need of manual offsetting during onDraw() and relies purely on TextView for its text rendering.
PiperOrigin-RevId: 210042249
This is in preparation of larger change of moving CollapsingTextHelper onto TextAppearance to fix related bugs & avoid code duplication.
1. Introduces a version of getFontAsync() in TextAppearance that doesn't require TextPaint as an argument.
2. Refactors the existing getFontAsync to wrap the new implementation.
3. Fixes a bug - TextAppearance would not apply the correct typeface from a style when fontFamily was not present in the style def.
PiperOrigin-RevId: 209147825
Remove overridden getText method, and rely on the TextView's implementation.
This also fixes accessibility issues when Talkback granularity is set to "word" or "characters".
PiperOrigin-RevId: 207296625
1) It's no longer necessary because Chip extends AppCompatCheckbox and TextView sets this if it's not explicitly set by the user
2) This prevents developers from indicating that a chip should not be exposed to accessibility.
PiperOrigin-RevId: 204189419