37 Commits

Author SHA1 Message Date
hunterstich
0ef2e910ce [TopAppBar] Fix title fade mode collapsing title position errors.
Flinging the AppBarLayout can cause a negative number to be passed to CollapsingTextHelper#calculateOffsets, causing the collapsed title in fade mode to be positioned incorrectly.

PiperOrigin-RevId: 374704850
2021-05-19 13:21:52 -07:00
dniz
841f229592 [CollapsingToolbarLayout] Fixed RTL text only laying out as RTL when actual text is RTL
PiperOrigin-RevId: 374663684
2021-05-19 11:00:25 -07:00
hunterstich
c7541833b7 [CollapsingToolbarLayout] Updated fade mode to allow expanded title to translate 1:1 with scrolling content.
PiperOrigin-RevId: 372565826
2021-05-07 12:27:54 -04:00
dniz
f0ce498108 [CollapsingToolbarLayout] Added title line spacing and hyphenation frequency setters
PiperOrigin-RevId: 371920600
2021-05-05 09:40:38 -04:00
dniz
be85a92a73 [CollapsingToolbarLayout] Added getLineCount() method
PiperOrigin-RevId: 368630070
2021-04-16 17:48:59 -04:00
Material Design Team
7fc9df5399 Automated g4 rollback of changelist 368429312
PiperOrigin-RevId: 368474895
2021-04-16 12:44:38 -04:00
dniz
2b2c69f773 [CollapsingToolbarLayout] Added getLineCount() method
PiperOrigin-RevId: 368429312
2021-04-16 12:43:47 -04:00
dniz
f0ac362968 [CollapsingToolbarLayout] Added support for multiline RTL when using fade title mode
PiperOrigin-RevId: 368237684
2021-04-13 14:24:14 -04:00
dniz
5a35bf7d38 [CollapsingToolbarLayout] Fixed multiline animation for fade title collapse mode
PiperOrigin-RevId: 367285477
2021-04-08 20:41:37 -04:00
dniz
9c75ad07f7 [CollapsingToolbarLayout] Added support for fade out/in title collapse mode
PiperOrigin-RevId: 365629647
2021-03-30 14:48:19 -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
Frantisek Nagy
8210b3ac01 [CollapsingToolbarLayout] Fix CollapsingToolbar multiline position
GIT_ORIGIN_REV_ID=7dbd8905bf58eb5811c4661ee77512d4d9c59c19

Co-authored-by: ymarian <38727469+ymarian@users.noreply.github.com>
PiperOrigin-RevId: 321294325
2020-07-15 09:49:15 -07:00
Robert Williams
77a0a87fb1 [CollapsingToolbarLayout] Use correct layout to calculate expanded bounds
Resolves https://github.com/material-components/material-components-android/pull/1432

GIT_ORIGIN_REV_ID=6041d791702d16e7501289f939fa01874b16b32c
PiperOrigin-RevId: 318639226
2020-06-29 09:28:40 -04:00
marianomartin
555356b03f Internal cleanup
PiperOrigin-RevId: 318134343
2020-06-26 14:06:52 -04:00
Sven Obser
74508c89c8 [CollapsingToolbarLayout] Fixed slight misalignment during transition in multiline mode
Resolves https://github.com/material-components/material-components-android/pull/1408

GIT_ORIGIN_REV_ID=9b29f85a8f9e9c52b256fbb4ce3148e19ee503fc
PiperOrigin-RevId: 317322732
2020-06-19 14:09:34 -04:00
Material Design Team
342ea9ad25 Internal cleanup
PiperOrigin-RevId: 317147378
2020-06-19 13:42:35 -04:00
marianomartin
83e4e47d22 Initial support for Multiline CollapsingToolbarLayout
This cl adds the capabilities to set multiline on CollapsingToolbarLayout while keeping single line toolbars unchanged.

Co-Authored-By: johan12345 <johan.forstner@gmail.com>
PiperOrigin-RevId: 294256516
2020-02-10 14:32:15 -05:00
marianomartin
50b020aec7 Resubmit Modify CollapsingTextHelper to use a StaticLayout instead of canvas.drawText.
PiperOrigin-RevId: 293443677
2020-02-05 17:30:20 -05:00
marianomartin
1673924a23 Automated g4 rollback of changelist 293151496
PiperOrigin-RevId: 293184366
2020-02-04 17:33:05 -05:00
marianomartin
7822b6d05e Modify CollapsingTextHelper to use a StaticLayout instead of canvas.drawText.
This will allow to support multiple lines.

PiperOrigin-RevId: 293151496
2020-02-04 17:32:07 -05:00
johan12345
8dd8acecd9 Mutate gravity horizontal value on setExpandedTextGravity and setCollapsedTextGravity, so the code can assume they are set.
PiperOrigin-RevId: 286392235
2019-12-19 15:41:45 -05:00
leticiars
9dcb12169f [TextInputLayout] Fixing cutout not working with CENTER_HORIZONTAL.
Resolves https://github.com/material-components/material-components-android/issues/822

PiperOrigin-RevId: 285781713
2019-12-16 16:01:50 -05:00
leticiars
20f113212d [TextInputLayout] Adding support for the collapsed label position to be determined via the edit text gravity, such as center_horizontal.
Resolves https://github.com/material-components/material-components-android/pull/311
Resolves https://github.com/material-components/material-components-android/issues/609

PiperOrigin-RevId: 279998938
2019-11-12 16:23:41 -05:00
marianomartin
0d4515cb46 Internal cleanup
PiperOrigin-RevId: 265971745
2019-08-29 14:59:20 -04:00
cketcham
81e708e1bb Add @NonNull and @Nullable annotations
PiperOrigin-RevId: 264745164
2019-08-26 11:19:28 -04:00
isabellekim
a628bf516b Revert the library to compile with Java 7: revert lambdas, add necessary casts, and make some variables final.
Continue compile shrine demo, catalog, and tests with Java 8.

PiperOrigin-RevId: 257874888
2019-07-15 19:19:23 -04:00
marianomartin
367b295624 Internal cleanup
PiperOrigin-RevId: 254414602
2019-06-24 17:12:42 -04:00
cketcham
bff75f2d3e Update to lamdas
PiperOrigin-RevId: 252846439
2019-06-18 13:21:02 -04:00
dniz
1f244318d8 Add @hide to all @RestrictTo annotations that are missing it
PiperOrigin-RevId: 243646339
2019-04-19 16:29:30 -04:00
afohrman
4476564820 Vertically center the filled text field's expanded label.
PiperOrigin-RevId: 241791031
2019-04-05 15:46:27 -04:00
afohrman
e847a22103 Remove @VisibleForTesting annotation from CollapsingTextHelper#getCurrentCollapsedTextColor.
The annotation was only necessary for the method in TextInputLayout that calls CollapsingTextHelper#getCurrentCollapsedTextColor.

PiperOrigin-RevId: 230616582
2019-01-25 13:57:02 -05:00
cketcham
dc72aaeed4 Migrate Gradle build and sources to androidx
PiperOrigin-RevId: 225551505
2018-12-21 11:07:45 -05:00
leticiars
df551410c4 Fixing padding of hint label when there is a leading icon
PiperOrigin-RevId: 213277053
2018-09-28 14:49:23 -04:00
dniz
461101bc5b Fix Gradle build by removing Java 8 method reference
PiperOrigin-RevId: 212685609
2018-09-14 11:00:30 -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
dniz
b4529d2a88 Remove unused MathUtils methods and add documentation. Also replace
MathUtils#constrain with Support Library MathUtils#clamp

PiperOrigin-RevId: 197905324
2018-05-30 17:31:27 -04:00
dniz
9ca33544ac Update package name to com.google.android.material
PiperOrigin-RevId: 193236235
2018-04-30 11:24:23 -04:00