2405 Commits

Author SHA1 Message Date
dsn5ft
c6527d177b [M3][Colors] Add additional condition to check dynamic color supported devices
PiperOrigin-RevId: 416582032
2021-12-16 14:37:30 -05:00
conradchen
e7bc947cd5 [DatePicker] Replace fragment container with FragmentContainerView
As suggested in https://developer.android.com/reference/androidx/fragment/app/FragmentContainerView

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

PiperOrigin-RevId: 416323969
2021-12-14 14:54:29 -05:00
conradchen
833f410404 [Color] Add additional condition to check dynamic color supported devices
PiperOrigin-RevId: 415066134
2021-12-09 01:18:43 +00:00
Material Design Team
822a5b2cb2 [M3][Color] Add Resource Table format for XML color Harmonization.
PiperOrigin-RevId: 415021439
2021-12-09 01:14:46 +00:00
Material Design Team
cfc00aa5a3 Update android core class definitions across material
PiperOrigin-RevId: 414839941
2021-12-08 14:56:25 +00:00
conradchen
35d9da8f67 [SnackBar] Fix NPE on Android 8 & 9
It seems like on Android 8 & 9 framework's View implementation has a bug that under certain scenarios if we set a view's visibility when view.getParent() is null, it can cause NPE crash.

Fixes this by switching the order of addView and setVisibility() call.

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

PiperOrigin-RevId: 413978332
2021-12-06 19:46:57 +00:00
pfthomas
fcc68a2de7 [TimePicker][a11y] Make Talkback announce selected state for clock items
PiperOrigin-RevId: 413955068
2021-12-06 19:44:45 +00:00
conradchen
6a3ea94ae0 [Snackbar] Fix maxWidth is not applied on Snackbar
During a previous refactoring, the maxWidth enforcement logic was incorrectly moved to the inner layout of snackbar. Moves the logic back to the outer layout so it can be properly applied.

PiperOrigin-RevId: 413938993
2021-12-06 19:43:13 +00:00
Material Design Team
b2f05d5454 [M3][Colors] Add supporting brand list of dynamic colors
PiperOrigin-RevId: 413825567
2021-12-06 19:37:00 +00:00
conradchen
acb7958c66 [TopAppBar] Fix top app bar snapping issue
Unlike other child views of AppBarLayout, CollapsingToolbarLayout will shift its top boundary to consume the window insets as well. Therefore we need to shift the top boundary back when calculating snapping positions to have a consistent logic with other views.

This CL also simplifies the calculation so the origin of the y-coordinate used in the calculation will always be the top of the AppBarLayout.

PiperOrigin-RevId: 413750156
2021-12-06 19:34:30 +00:00
conradchen
b8f2dd53e0 [Badge] Support different locale on badges
Resolves https://github.com/material-components/material-components-android/issues/2465

PiperOrigin-RevId: 413738198
2021-12-06 19:32:16 +00:00
conradchen
9980596586 [M3][Dialog] Start-align message text with centered styles
According to the spec the centered dialog theme overlay should have message text start-aligned and it's also the previous behavior in old MaterialComponent theme overlay.

Spec: https://m3.material.io/components/dialogs/specs
PiperOrigin-RevId: 413671708
2021-12-06 19:29:03 +00:00
conradchen
62e89933d6 [DatePicker] Fix wrong month title with certain months
The issue is caused by failing to correctly take the daylight saving time into account - internally we use UTC time to represent dates, however when generating month titles we try to calculate the time difference of the UTC time and the local time, which can result in off-by-one errors when the first day of the month is also the first day of the daylight saving time, e.g., April 1, 1979 in Poland.

Fixes this by always using UTC time to generate month titles. Also clears the relevant implementation for a little bit since context is actually not required when we only need to format years and months.

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

PiperOrigin-RevId: 413505587
2021-12-01 19:08:56 -05:00
serniebanders
2e73d1a1cf [BottomSheetBehavior] Remove paddingTopSystemWindowInsets from flags checked to apply windowInsetListener
PiperOrigin-RevId: 413474393
2021-12-01 19:08:17 -05:00
conradchen
79b2c3d7c5 [TextField] Refine the hint cutout logic
Use canvas.clipRect() to avoid drawing strokes in cutout areas instead of painting-it-white approach we are using right now.

PiperOrigin-RevId: 413246249
2021-12-01 19:06:55 -05:00
Dan Nizri
5b6c878cbb
Merge pull request #2488 from material-components/revert-2406-master
Revert "[Material Toolbar] Change logo scaleType and set logo adjustViewBounds"
2021-12-01 19:04:06 -05:00
Dan Nizri
b7c7d18834
Revert "[Material Toolbar] Change logo scaleType and set logo adjustViewBounds" 2021-12-01 18:41:20 -05:00
Dan Nizri
e59fa50343
Revert "[BottomSheetDialogFragment] Added constructor that takes a layout ID" 2021-12-01 18:40:58 -05:00
Jose Figueroa
8c50ee2c12
Merge pull request #2237 from 4brunu/feature/bottomsheetdialogfragment-layoutid-in-constructor
[BottomSheetDialogFragment] Added constructor that takes a layout ID
2021-12-01 16:55:15 -05:00
Jose Figueroa
71a110fe89
Merge pull request #2406 from P1NG2WIN/master
[Material Toolbar] Change logo scaleType and set logo adjustViewBounds
2021-12-01 16:47:25 -05:00
jeremymuhia
e8bde7546b [TextInputLayout] text field should comply with system level bold
PiperOrigin-RevId: 413194807
2021-11-30 20:48:48 +00:00
conradchen
bb23e2d6ad [M3][Card] Update M3 card elevation according to the spec
Spec: https://m3.material.io/components/cards/specs
PiperOrigin-RevId: 412921858
2021-11-29 19:17:33 +00:00
Material Design Team
a487c89185 Internal change
PiperOrigin-RevId: 412135443
2021-11-29 17:35:39 +00:00
Andre\u0301 Wachter
5ff917dc5f [MaterialShapeDrawable] Implement getAlpha()
Resolves https://github.com/material-components/material-components-android/pull/2479

GIT_ORIGIN_REV_ID=20d18f9732871b06aa9f95af0bd02f23b3e7995a
PiperOrigin-RevId: 412092198
2021-11-29 17:31:06 +00:00
pfthomas
3c9b45292d [M3][Button] Add missing attributes to M3 button styles
PiperOrigin-RevId: 411585842
2021-11-29 17:29:47 +00:00
pfthomas
db64adb5fb [M3][Button] Update elevation to match specs
PiperOrigin-RevId: 411148215
2021-11-29 16:59:33 +00:00
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
Bruno Coelho
0b63bb76e8 Update AppCompat to 1.4.0 stable 2021-11-17 21:35:14 +00:00
Bruno Coelho
6d29bddb0f Merge branch 'master' into feature/bottomsheetdialogfragment-layoutid-in-constructor 2021-11-17 21:32:22 +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
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