2197 Commits

Author SHA1 Message Date
Bruno Coelho
8fb12fd2f6 Merge branch 'master' into feature/bottomsheetdialogfragment-layoutid-in-constructor
# Conflicts:
#	build.gradle
2021-11-11 20:26:33 +00:00
pfthomas
c07e5f2c36 [TimePicker][a11y] Fix Talkback doesn't announce minutes selection
PiperOrigin-RevId: 408921292
2021-11-10 17:00:22 -05:00
conradchen
44d4c3ea3f [TopAppBar] Correctly set letter spacing when expanding titles
We recreated title text layout when expanding from the collapsed state but didn't correctly set the letter spacing to the expanded one. The letter spacing being used will be a interpolated value between collapsed and expanded letter spacing (close to the collapsed one due to the implementation). This will cause the text layout incorrectly calculate the line count from the wrong letter spacing and result in a broken layout.

Correctly sets the letter spacing to fix the issue.

Resolves https://github.com/material-components/material-components-android/issues/2463

PiperOrigin-RevId: 408910555
2021-11-10 16:54:12 -05:00
conradchen
34cce18d4a [TextField] Correctly calculate hint text offset
We changes letter spacing during expanding/collapsing animations, which causes us use letter spacing during animation while calculating final expanded/collapsed offset instead of final letter spacing. This in turn causes hints be drawn at the wrong positions. Uses final letter spacing during calculating offset instead to fix the problem.

Resolves https://github.com/material-components/material-components-android/issues/2277

PiperOrigin-RevId: 408904991
2021-11-10 16:52:14 -05:00
conradchen
e6db8a4d31 [TopAppBar] Fix text alignment of multi-line title in collapsing toolbar
In single line mode, we implement the expanded title alignment by calculating the expected x-coordinate of expanded title and translate the canvas so the title will be aligned. However, when maxLines > 1, the static layout will always occupy the full available width, therefore the text alignment need to be done by the static layout instead.

Provides text alignment other than NORMAL when it's in multi-line mode to solve the issue.

Resolves https://github.com/material-components/material-components-android/issues/1276

PiperOrigin-RevId: 408895140
2021-11-10 16:13:26 -05:00
conradchen
823c34a90c [Tab] Fix NPE caused by set a position less than 0
If somehow scroll position is set to -1 with and position offset greater than 0.5, we will decide it's a valid scroll position which causes NPE for selected child not found.

Fixes this by checking if position is valid regardless the offset and falling back to 0 if a negative position is given.

Resolves https://github.com/material-components/material-components-android/issues/2464

PiperOrigin-RevId: 408894188
2021-11-10 16:12:49 -05:00
conradchen
283715d348 [Card] Fix checked icon gravity issues
Re-measures the card when checked icon gravity changes in order to move the icon position. Also corrects the padding adjustment logic for pre-lolipop or when compat paddings are being used.

PiperOrigin-RevId: 408876717
2021-11-10 16:11:35 -05:00
pfthomas
38406e15a5 [TimePicker][a11y] Make Talkback announce action on clock items
PiperOrigin-RevId: 408660379
2021-11-10 16:09:26 -05:00
leticiars
d8e19ddedf [a11y][ExposedDropdownMenu] Fixed dropdown list not showing for non editable dropdown menus in switch access mode.
For the editable type it remains as was: clicking on the edit text triggers the keyboard and clicking on the arrow icon shows the dropdown list.

PiperOrigin-RevId: 408655618
2021-11-10 16:06:58 -05:00
leticiars
c7c5c7c625 [TextInputLayout] Fixed calculateLabelMarginTop() value for filled text field style, which caused getBaseline() to return a wrong offset.
PiperOrigin-RevId: 408655451
2021-11-10 16:06:08 -05:00
conradchen
c80177d062 [CollapsingTextHelper] Small clean-up of CollapsingTextHelper
PiperOrigin-RevId: 408644009
2021-11-10 16:04:13 -05:00
leticiars
dca7fc0701 [TextInputLayout][a11y] Fixed RTL support for setting corner radius on TextInputLayout.
PiperOrigin-RevId: 408621523
2021-11-10 16:03:01 -05:00
pfthomas
c6be59ce8b [Chip][a11y] Fix system level bold not applied
PiperOrigin-RevId: 408609073
2021-11-10 16:02:22 -05:00
conradchen
bc56d5b43b [M3][Card] Change checkedIconGravity values to enum
PiperOrigin-RevId: 408415041
2021-11-10 16:00:52 -05:00
leticiars
9b5356f2fe [DatePicker] Wrapped text fields from range picker selection in a ScrollView so their heights don't change in landscape mode.
PiperOrigin-RevId: 408333813
2021-11-10 15:57:22 -05:00
Gabriele Mariotti
250d56de4b [MaterialCardView] Added option to set the checkedIcon gravity
Resolves https://github.com/material-components/material-components-android/pull/1679

GIT_ORIGIN_REV_ID=a35c862071d83ced72c4d7257f2b7bc93101bfbb
PiperOrigin-RevId: 407662373
2021-11-10 15:35:03 -05:00
conradchen
e9ec82f5e9 [M3][Chip] Add input chip elevated styles to public
PiperOrigin-RevId: 407408090
2021-11-04 10:54:56 -04:00
conradchen
8ed0ac9fd3 [M3][Chip] Update M3 chip styles with spec
Adds elevation to selected & hovered state. Adds leading icon tint.

PiperOrigin-RevId: 407397700
2021-11-04 10:53:39 -04:00
Gabriele Mariotti
b2fbacecd4 [MaterialDatePicker] added methods to use custom text for positive and negative button
Resolves https://github.com/material-components/material-components-android/pull/1607

GIT_ORIGIN_REV_ID=75093200ddeae117ae57a3e89e28d109f520ec8d
PiperOrigin-RevId: 407376627
2021-11-04 10:53:04 -04:00
Material Design Team
aaac96d724 [TextField] Fix helper text label for usage
The setLabelFor calls were made in the call to populate the accessibility node but they were made after calling super (one of them was actually nested inside of a getter!), this is too late, the accessibility node is populated with the label for by the super class

PiperOrigin-RevId: 407178334
2021-11-04 10:52:21 -04:00
conradchen
a455a53a6d [M3][Color] Move dynamic color public resources to all versions
PiperOrigin-RevId: 407141799
2021-11-04 10:51:45 -04:00
conradchen
e5023f63ae [M3][Colors] Add supporting manufacturer list of dynamic colors
PiperOrigin-RevId: 406892239
2021-11-04 10:49:57 -04:00
Khang NT
b935604e2c [AppBarLayout] Fix snap issue with transparent status bar
Resolves https://github.com/material-components/material-components-android/pull/2387

GIT_ORIGIN_REV_ID=47538c3b4cb10337c537d1ef532bd1d73b216ae3
PiperOrigin-RevId: 406835368
2021-11-01 19:53:05 +00:00
pfthomas
bed2ac17a7 [M3] Add textAppearanceListItem* styles to theme
PiperOrigin-RevId: 406832937
2021-11-01 19:31:19 +00:00
leticiars
9d2f864f0a [TextInputLayout] Fixed getBoxCornerRadiusBottomEnd and getBoxCornerRadiusBottomStart returning wrong values.
PiperOrigin-RevId: 406360531
2021-10-29 18:48:29 +00:00
leticiars
c352dfde8d [TextInputLayout] Fixed shouldAnimateCaptionView() returning true when captionText is null.
captionView.getText() doesn't ever return null (only "" if it's empty), so changed captionText parameter to be @NonNull

PiperOrigin-RevId: 406358148
2021-10-29 18:47:26 +00:00
leticiars
3ca3b71bb2 [TextInputLayout] Don't add placeholder view to text field's input frame if placeholder is null.
PiperOrigin-RevId: 406129696
2021-10-28 18:50:16 +00:00
leticiars
20c3ad0413 [a11y][TextInputLayout] Removed TextInputLayout's placeholder text duplicated announcement.
Before, when swiping with TalkBack on, the placeholder text would be mistakenly announced. This change makes it so it's only announced when it appears, for API >= 16. It's still announced as part of the description announcement when the text field is selected, as before, so it's still accessible for APIs < 16.

PiperOrigin-RevId: 405668594
2021-10-27 18:54:35 +00:00
pfthomas
dbd37d2791 [BottomSheetBehavior] Remove IllegalArgumentException in settleToState
PiperOrigin-RevId: 405497835
2021-10-27 18:53:26 +00:00
conradchen
dc0c5f3d85 [M3][Color] Add public dynamic color resources
PiperOrigin-RevId: 405411796
2021-10-25 16:10:26 +00:00
Material Design Team
8bf3bdeb8a Automated g4 rollback of changelist 404871534
PiperOrigin-RevId: 404899483
2021-10-25 16:08:53 +00:00
leticiars
2701161bbd [a11y][TextInputLayout] Removed TextInputLayout's placeholder text duplicated announcement, and fixed edge case where placeholder text was being enabled and added to the input frame while it was set to null.
Before, when swiping with TalkBack on, the placeholder text would be mistakenly announced. This change makes it so it's only announced when it appears, for API >= 16. It's still announced as part of the description announcement when the text field is selected, as before, so it's still accessible for APIs < 16.

PiperOrigin-RevId: 404871534
2021-10-25 16:07:47 +00:00
conradchen
abb9d5bf99 [M3][Chip] Update chip styles with spec
PiperOrigin-RevId: 404852054
2021-10-25 16:06:43 +00:00
Material Design Team
df873168e0 [M3][Color] Harmonize iteration
PiperOrigin-RevId: 404797844
2021-10-21 18:56:00 +00:00
dsn5ft
3a57f5d58b [TimePicker] Attempt to fix onDoubleTap() NullPointerException
PiperOrigin-RevId: 404651939
2021-10-21 18:54:41 +00:00
conradchen
8729d8ab57 [SnackBar] Fix maxWidth and maxInlineActionWidth are not applied
We load maxWidth and maxInlineActionWidth style attributes in SnackbarContentLayout, but the snackbar styles are only applied to SnackbarLayout. We need to pass the values to SnackbarContentLayout, as we did for actionTextColorAlpha.

Resolves https://github.com/material-components/material-components-android/issues/781

PiperOrigin-RevId: 404320339
2021-10-20 19:18:47 +00:00
Material Design Team
01c1fc723d Automated g4 rollback of changelist 404266249
PiperOrigin-RevId: 404294350
2021-10-20 19:11:30 +00:00
conradchen
d10c75b357 [TextField] Fix collapsed hint cutout is not correctly applied
The box background of text fields are applied to EditTexts instead of the TextInputLayout. So when there are paddings in TextInputLayout, we will need to adjust cutout bounds, which is calculated based on TextInputLayout's coordinates, according to the paddings.

PiperOrigin-RevId: 404281248
2021-10-20 19:09:50 +00:00
leticiars
aa58657042 [a11y][TextInputLayout] Removed TextInputLayout's placeholder text duplicated announcement.
Before, when swiping with TalkBack on, the placeholder text would be mistakenly announced. This change makes it so it's only announced when it appears, for API >= 16. It's still announced as part of the description announcement when the text field is selected, as before, so it's still accessible for APIs < 16.

PiperOrigin-RevId: 404266249
2021-10-20 19:07:29 +00:00
dsn5ft
9ae56ceedd [Javadocs] Remove all broken attr links from Javadocs
PiperOrigin-RevId: 404246710
2021-10-20 19:06:18 +00:00
pekingme
9de9319b1e [Resources] Added styles in res-public.
PiperOrigin-RevId: 403451624
2021-10-18 15:31:13 -04:00
dsn5ft
93cdd95d6a [TimePicker] Make MaterialTimePicker implement OnDoubleTapListener interface instead of instantiating anonymous inner class
PiperOrigin-RevId: 403415529
2021-10-18 12:37:06 -04:00
conradchen
841fe974f0 [M3][TimePicker] Unify the theme/style names of time pickers
Renames all Material3.TimePicker.* to Material3.MaterialTimePicker.*.

PiperOrigin-RevId: 402844038
2021-10-13 16:39:56 -04:00
serniebanders
a290c38cfd [AppBar] Defines collapsing text alpha value to be at most as transparent as the user defines.
This enables the user to set the expanded text as fully transparent, as well as any other text alpha value.

Fixes: https://github.com/material-components/material-components-android/issues/2293
PiperOrigin-RevId: 402829737
2021-10-13 16:36:27 -04:00
pfthomas
e906367de5 [MaterialTimePicker] Fix showing keyboard requires 2 taps in text input mode
PiperOrigin-RevId: 402567146
2021-10-12 11:43:03 -04:00
pfthomas
228ad853f4 [TimePicker][Accessibility] Announce time has changed after clock selection
PiperOrigin-RevId: 402557800
2021-10-12 11:41:55 -04:00
Nitish Bhatt
1f7202a953 [FloatingActionButton]add setter for max image size
Resolves https://github.com/material-components/material-components-android/pull/2415

GIT_ORIGIN_REV_ID=3f0603a3f169c12d02c127726dff091c94f3561a
PiperOrigin-RevId: 402552778
2021-10-12 11:40:58 -04:00
nikhiljainlive
0181029efb [MaterialTimePicker] Fix Input mode is not changed when keyboard icon is clicked when the app is returned from background
Resolves https://github.com/material-components/material-components-android/pull/2419

GIT_ORIGIN_REV_ID=80ba4c214cbd565ad461bef80fb9ae01b8671a0e
PiperOrigin-RevId: 402550766
2021-10-12 11:40:24 -04:00
pekingme
c1f7dfc314 [Tokens] Updated resources to v0.54.
PiperOrigin-RevId: 402383462
2021-10-12 11:39:48 -04:00
conradchen
79ae9b1351 [TextInputLayout] Create label cutout only on borders
When a collapsed label is showing, we cutout part of the border of an outlined text input box according to the exact stroke width. However when using rounded corners, there can be slight offsets from where the border is really drawn. Also, if the corner size is large, the part of border we need to cutout might not just be a straight line but contains part of the corner.

However, with the existing cutout logic, we cannot just cutout the whole label area, which will cause the area inside the border also gets cutout, if it has color. This CL changes the cutout drawing logic to only apply the cutout on stroke drawing to fix the issue.

This CL also fixes the bug that when the label is too long, we didn't take the ellipsized text length into account. Creates a variable to store the calculated collapsed text width to fix the issue.

Resolves https://github.com/material-components/material-components-android/issues/2145

PiperOrigin-RevId: 402316057
2021-10-12 11:26:21 -04:00