*** Reason for rollback ***
fontVariationSettings fix landed in AndroidX
*** Original change description ***
[Typography] Added workaround for fontVariationSettings being set through a TextAppearance
A bug in AppCompatTextView causes fontVariationSettings set through a TextAppearance in xml to not take effect. This is a temporary woraround that cycles the settings to force them to be re-set until the fix is made in appcompat.
Resolves https://github.com/material-components/material-components-android/pull/4235
PiperOrigin-RevId: 659534202
A bug in AppCompatTextView causes fontVariationSettings set through a TextAppearance in xml to not take effect. This is a temporary woraround that cycles the settings to force them to be re-set until the fix is made in appcompat.
PiperOrigin-RevId: 651033811
Also avoids creating the Typeface twice because previously shouldLoadFontSynchronously() and getFont() would both create a Typeface in some cases
PiperOrigin-RevId: 625813788
Created TextAppearanceFontCallback (a fork of FontCallback) in order to pass parameter indicating whether font was resolved synchronously.
PiperOrigin-RevId: 216566240
This removes duplication between the 2 implementations and automatically fixes font loading bug in CollapsingToolbarLayout & TextInputLayout. It has a side effect of changing font loading from sync to async but it shouldn't affect anyone since font loading wasn't really working in the first place. It may affect the UIs that were affected by the original bug though.
To alleviate possible "font flickering" due to async loading, CollapsingTextHelper defers the TextPaint changes until the font is actually loaded.
Another scenario the async loading would have an impact on is when the font is manually overwritten with CollapsingTextHelper.setTypeface() while async op is still ongoing. The result of async load would then overwrite the font back to the originally requested. This happens in TextInputLayout which overwrites its own font setting to this of its child whenever its added. This may happen before async op completes. To guard against that, any direct font setting automatically cancels the async load (cancels == ignores the result when it comes).
PiperOrigin-RevId: 212328671
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