33 Commits

Author SHA1 Message Date
hunterstich
fb7ae01348 [Chip] Added support for variable font axes
PiperOrigin-RevId: 807265798
2025-09-18 16:48:13 +00:00
dsn5ft
0697f6fe89 [Gradle] Enable non transitive R classes (resource namespacing) and fix errors
PiperOrigin-RevId: 738871402
2025-03-20 18:34:33 +00:00
pubiqq
23aca03255 [Internal] Remove pre-Lollipop checks
Resolves https://github.com/material-components/material-components-android/pull/4266

GIT_ORIGIN_REV_ID=1de7808e66dd6666c893217c76c7499afe2df6a3
PiperOrigin-RevId: 669688797
2024-09-03 13:31:29 +00:00
hunterstich
a7c3e0b111 [Typography] Automated g4 rollback of changelist 651033811.
*** 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
2024-08-07 05:10:40 +00:00
hunterstich
fa5224ef05 [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.

PiperOrigin-RevId: 651033811
2024-07-10 19:22:57 +00:00
hunterstich
a9debc7a26 [Typography] Add variable font support to TextAppearance
PiperOrigin-RevId: 650200668
2024-07-08 20:33:22 +00:00
dsn5ft
25d189bb8d [TextAppearance] Update font loading to load synchronously for system font families
Also avoids creating the Typeface twice because previously shouldLoadFontSynchronously() and getFont() would both create a Typeface in some cases

PiperOrigin-RevId: 625813788
2024-04-18 18:48:09 +00:00
jeremymuhia
2d90a7a508 [CollapsingTextHelper][TextAppearance] refactor how bold typefaces are created
PiperOrigin-RevId: 425988666
2022-02-02 18:17:01 -08:00
Material Design Team
dff1e4edf1 [TextAppearance] Clamp typeface weight when adjusting it
PiperOrigin-RevId: 425440606
2022-01-31 18:15:11 -08:00
jeremymuhia
90787bf0e0 [TextAppearance] fix drawables not applying system level bold
PiperOrigin-RevId: 421066050
2022-01-12 11:21:15 -05:00
Material Design Team
cfc00aa5a3 Update android core class definitions across material
PiperOrigin-RevId: 414839941
2021-12-08 14:56:25 +00:00
conradchen
7adfd93d80 [TooltipDrawable] Adding android:textColor support
PiperOrigin-RevId: 374887222
2021-05-20 14:03:30 -07:00
dniz
9b92fd8f46 [TextAppearance] Added a TextAppearanceConfig.shouldLoadFontSynchronously() check to allow forcing synchronous font loading for edge cases
PiperOrigin-RevId: 374702022
2021-05-19 13:19:40 -07:00
dniz
0ad429db2a [TextAppearance] Updated TextAppearance to load font synchronously if its cached. Also updates lib to depend on 1.5.0-rc01 for the ResourcesCompat#getCachedFont method.
Used by CollapsingToolbarLayout, TextInputLayout, Chip, Badge, and Tooltip

PiperOrigin-RevId: 370071817
2021-04-23 14:40:21 -04:00
connieshi
bc1bd23375 [chip] Avoid flickering when using downlodable fonts.
PiperOrigin-RevId: 338258136
2020-10-21 15:49:00 -07:00
cketcham
ccc629f064 Only read letter spacing for TextAppearance on API levels where it exists
PiperOrigin-RevId: 330771283
2020-09-10 11:12:47 -04:00
cketcham
d4a019359c Update TextAppearance and CollapsingTextHelper to respect letterSpacing set with TextAppearance styles
PiperOrigin-RevId: 328985766
2020-08-28 18:06:30 -04:00
marianomartin
e5f7951b01 [Chip] Support setting text size without changing TextAppearance
PiperOrigin-RevId: 320083914
2020-07-08 15:00:37 -04:00
marianomartin
555356b03f Internal cleanup
PiperOrigin-RevId: 318134343
2020-06-26 14:06:52 -04:00
Material Design Team
342ea9ad25 Internal cleanup
PiperOrigin-RevId: 317147378
2020-06-19 13:42:35 -04:00
marianomartin
0d4515cb46 Internal cleanup
PiperOrigin-RevId: 265971745
2019-08-29 14:59:20 -04:00
marianomartin
c99f9522c7 Update peekHeight's getter and setter to be not final.
PiperOrigin-RevId: 265891346
2019-08-29 14:51:33 -04:00
cketcham
1d2cb7aa35 Add @NonNull and @Nullable annotations
PiperOrigin-RevId: 265133488
2019-08-29 11:21:03 -04:00
dniz
cc73c2a630 Update TODOs
PiperOrigin-RevId: 259535844
2019-07-23 11:21:39 -04:00
cketcham
dc72aaeed4 Migrate Gradle build and sources to androidx
PiperOrigin-RevId: 225551505
2018-12-21 11:07:45 -05:00
connieshi
f3a95d09fe Avoid constantly invalidating ChipDrawable when used in standalone mode.
Created TextAppearanceFontCallback (a fork of FontCallback) in order to pass parameter indicating whether font was resolved synchronously.

PiperOrigin-RevId: 216566240
2018-10-11 18:21:33 -04:00
Material Design Team
850795da31 Delegates CollapsingTextHelper text attributes processing to TextAppearance.
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
2018-09-14 10:53:39 -04:00
connieshi
1f98c64b66 Remove redundant call to onSizeChange() in ChipDrawable#setTextAppearance(). Always evoke callback in TextAppearance#getFontAsync
Switch to using TextUtils.equals for more robust string comparison.

PiperOrigin-RevId: 209764943
2018-08-28 16:36:00 -04:00
Material Design Team
b65d0e3e57 TextAppearance typeface bug fix & refactoring of getFontAsync().
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
2018-08-17 17:20:54 -04:00
dniz
24867f367c Fix error in Gradle build due to TextAppearance variable scope
PiperOrigin-RevId: 202488746
2018-07-02 09:46:29 -04:00
connieshi
d584f91ccc Resolve fonts asynchronously to avoid ANR.
Added flag to specify that fonts should be resolved synchronously for instrumentation tests.

PiperOrigin-RevId: 202033678
2018-07-02 09:37:14 -04:00
dniz
b97023751b Restrict TextAppearance class to library usage
PiperOrigin-RevId: 193249985
2018-04-30 11:27:44 -04:00
dniz
9ca33544ac Update package name to com.google.android.material
PiperOrigin-RevId: 193236235
2018-04-30 11:24:23 -04:00