2211 Commits

Author SHA1 Message Date
conradchen
89d80d080f [TopAppBar] Fix expanded title margin not applied
In the original logic we compares interpolated text size to decide if the available width should be the collapsed one or the expanded one. This logic wouldn't work if the collapsed text size and the expanded text size are the same. Refactors the logic to make the decision by interpolating fraction directly.

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

PiperOrigin-RevId: 410901171
2021-11-29 16:58:15 +00:00
conradchen
1d50ed7846 [TopAppBar][TextField] Remove unneeded logic
After letter spacing is correctly set in CollapsingTextHelper.calculateUsingTextSize(), we no longer need to set letter spacing separately for collapsed and expanded titles. Also this enhances the logic by using textPaint consistently in CollapsingTextHelper.calculateBaseOffsets(), which was not the case before the change. (We got text height from textPaint and text width from tmpPaint.)

PiperOrigin-RevId: 410888232
2021-11-29 16:56:38 +00:00
leticiars
2d337c5b81 [A11y][ExposedDropdownMenu] Improved accessibility for switch access.
Now clicking on dropdown menu via switch access triggers the dropdown list. Plus, the arrow icon is set to be not important for a11y only for screen readers.

PiperOrigin-RevId: 410858001
2021-11-29 16:55:06 +00:00
jeremymuhia
65754bd152 [CollapsingToolbarLayout][a11y] collapsing toolbar layout not respecting system level bold
PiperOrigin-RevId: 410846065
2021-11-29 16:53:01 +00:00
pfthomas
f028380fb2 [M3][Button] Update padding to match specs
PiperOrigin-RevId: 410823046
2021-11-29 16:48:32 +00:00
serniebanders
185a0f9c92 [BottomSheetBehavior] Add margin flags to BottomSheetBehavior for system inset bars.
Updates bottom sheet styles to default to left and right margins, top and bottom padding.

Resolves: https://github.com/material-components/material-components-android/issues/2221
PiperOrigin-RevId: 410580245
2021-11-29 16:46:09 +00:00
conradchen
cf5df22cce [TextField] Fix crashes when text field size is too large
When we try to draw cutout on text field borders, we draw the stroke on a bitmap first. However if the text field is too large, the bitmap size will be too large and cannot be drawn back to the real canvas, which causes crashes.

Adds a workaround/fallback solution to avoid the crash.

PiperOrigin-RevId: 410523013
2021-11-29 16:29:59 +00:00
conradchen
adbcf8cbbc [M3][BottomNavigation] Set backgroundTint explicity to @null in M3 bottom navigation syles
PiperOrigin-RevId: 410346437
2021-11-29 16:27:58 +00:00
conradchen
6b57c52973 [M3][NavigationRail] Update M3 navigation rail text appearances
PiperOrigin-RevId: 410245619
2021-11-16 12:39:35 -05:00
conradchen
728a1e658b [M3][Dialog] Enforce material theme in M3 dialog styles
PiperOrigin-RevId: 410027983
2021-11-16 12:38:56 -05:00
conradchen
04a6b6c39e [M3][Tab] Do not enforce text appearance with M3 styles
PiperOrigin-RevId: 409445341
2021-11-16 12:35:44 -05:00
serniebanders
d5729d5935 Automated g4 rollback of changelist 409212345
PiperOrigin-RevId: 409279906
2021-11-16 12:34:36 -05:00
conradchen
fba1a341c3 [M3][DatePicker] Fix M3 date picker styles
Some attributes were wrongly added to the styles. We need to remove them to make the color correct.

PiperOrigin-RevId: 409241943
2021-11-16 12:33:57 -05:00
conradchen
cc18f3f7e8 [M3][Chip] Add missing attributes to M3 chip styles
PiperOrigin-RevId: 409239837
2021-11-16 12:31:56 -05:00
serniebanders
022a05f526 [BottomSheetBehavior] Add margin flags to BottomSheetBehavior for system inset bars.
Updates bottom sheet styles to default to left and right margins, top and bottom padding.

Resolves: https://github.com/material-components/material-components-android/issues/2221
PiperOrigin-RevId: 409212345
2021-11-16 12:29:43 -05:00
leticiars
b878fc3209 [a11y][ExposedDropdownMenu] accessibilityManager.isEnabled() is not reliable to check if component is in a11y mode, as it may return true unexpectedly.
Automated g4 rollback of changelist 408655618

PiperOrigin-RevId: 409182047
2021-11-16 12:28:50 -05: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