2413 Commits

Author SHA1 Message Date
Vyacheslav
26d862bc54 [TextInputLayout] Speedup simple inflate.
Changes are mostly to keep start/end layouts and icon views hidden (visibility = gone) when they are not needed.

Resolves https://github.com/material-components/material-components-android/pull/2326

GIT_ORIGIN_REV_ID=0393ac65d562bc87d340ec7bb260ebba99a1ac3b
Co-authored-by: leticiarossi <9288695+leticiarossi@users.noreply.github.com>
PiperOrigin-RevId: 418038435
2021-12-28 08:54:28 -05:00
conradchen
88eb089021 [TextField] Apply edit text's letter spacing to expanded hints
Resolves https://github.com/material-components/material-components-android/issues/2202

PiperOrigin-RevId: 417863400
2021-12-23 13:54:06 -05:00
hunterstich
a295de9728 [TabLayout] Added fade inidcator animation mode.
PiperOrigin-RevId: 417842993
2021-12-22 14:48:54 -05:00
conradchen
dac9bf360a [M3][Color] Set android:windowBackground to android:colorBackground
The same remapping is done on API 21+ by framework base themes. On API levels lower than 21, AppCompat base themes "backport" the behavior to map window background to a separate color resources. With Material 3 we want a consistent and clear behavior, this CL explicitly remaps android:windowBackground to android:colorBackground so the behavior will be the same across all API levels.

PiperOrigin-RevId: 417711790
2021-12-22 14:47:20 -05:00
conradchen
672e7440f9 [M3][Dialog] Fix dialog paddings
We missed to include top/bottom insets of button styles into dialog action margin calculation. Also the paddings between titles and messages were not correct.

PiperOrigin-RevId: 417626927
2021-12-22 14:46:19 -05:00
conradchen
2ae3ca4298 [M3][ActionBar] Migrate action bar popup themes to M3
PiperOrigin-RevId: 417454499
2021-12-20 16:11:30 -05:00
leticiars
9416b2c7d6 [Divider] Added attribute in MaterialDividerItemDecoration to remove item decoration from last recycler view item.
PiperOrigin-RevId: 416890397
2021-12-20 15:57:15 -05:00
conradchen
7665730a0b [M3][Theme] Remove unneeded TODOs in M3 themes
PiperOrigin-RevId: 416835249
2021-12-16 14:38:41 -05:00
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