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
List of text related attributes/methods supported with this approach:
android:autoLink
android:hint
android:text
android:textAllCaps
android:textAppearance
android:textColor
android:textColorHint
android:textColorLink
android:textIsSelectable
android:textScaleX
android:textSize
android:textStyle
android:typeface
android:fontFamily
Not supported:
android:textColorHighlight
android:textColorLink
PiperOrigin-RevId: 200578044
This is preventing completions of attribute names for Chip and the attribute panels shows up empty for Chip.
Rename R.styleable.ChipDrawable to R.styleable.Chip and update ChipDrawable to use it.
AS 3.2 canary > 14 (currently 16) is required to see the attributes in the attribute panel.
PiperOrigin-RevId: 198909123
Override Chip#setText(CharSequence, BufferType) to set the value on the internal chip text and prevent text from being set on Chip's super class because ChipDrawable will handle text rendering.
- This method is called by all overridden versions of TextView#setText except android.widget.TextView#setText(char[], int, int)}, which cannot be overridden. This is not ideal but an incremental change towards supporting all flavors of android.widget.TextView#setText methods.
Deprecate Chip#setChipTextResource(int) and Chip#setText(CharSequence)
PiperOrigin-RevId: 197960701
Rename ChipDrawable#setChipTextResource to ChipDrawable#setTextResource
Rename ChipDrawable#setChipText to ChipDrawable#setText.
PiperOrigin-RevId: 197948000
This is one in a series of planned changes that aim to delegate rendering a Chip's text to TextView instead of ChipDrawable.
PiperOrigin-RevId: 197780081