2424 Commits

Author SHA1 Message Date
pekingme
4de8565634 [Tokens] Upgrade M3 token resources to v0.71
PiperOrigin-RevId: 420319663
2022-01-12 11:16:06 -05:00
conradchen
bbbeacd64e [Badge] Refactor Badge state managing logic
This CL fixes a couple of badge state related issues. First, it prevents the badges created before restoring instance states from being overwritten by the old instance states. Second, it makes badges reload their default style settings everytime when its being recreated so if the environment has been changed, the default values will reflect the environment change.

This CL also fixes that several attributes were not correctly saved/restored or their default values were not correctly loaded.

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

PiperOrigin-RevId: 420096508
2022-01-06 15:51:50 -05:00
conradchen
3db25be3b6 [ButtonGroup] Simplify MaterialButtonToggleGroup's checking logic
1. Consolidates single selected ID and multiple selected IDs to a single selected
   ID set.
2. Separates View states and internal checked states so we can focus and enforce
   policies much easier on only internal states.

PiperOrigin-RevId: 420087718
2022-01-06 15:44:19 -05:00
conradchen
ff97a6805c [SnackBar] Enforce vertical layout when action text is too long
The snack bar content layout is by default horizontal, and we only change it to vertical when the action view is too wide and ellipsizes the message text. Therefore if the layout orientation is already vertical, we should just keep the layout and no need to check if the message text is multi-line again.

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

PiperOrigin-RevId: 419885582
2022-01-05 23:26:51 -05:00
conradchen
a43d7d993c [M3][Theme] Internal change
PiperOrigin-RevId: 419602208
2022-01-04 18:01:05 -05:00
pfthomas
8bc64201d4 [AlertDialog][a11y] Make dialog icon not important for accessibility
Resolves https://github.com/material-components/material-components-android/issues/1400

PiperOrigin-RevId: 419600919
2022-01-04 18:00:22 -05:00
Material Design Team
bc811d231b Automated g4 rollback of changelist 418911641
PiperOrigin-RevId: 418915787
2022-01-04 17:59:36 -05:00
pfthomas
bd15f071e1 [AlertDialog][a11y] Make dialog icon not important for accessibility
Resolves https://github.com/material-components/material-components-android/issues/1400

PiperOrigin-RevId: 418911641
2022-01-04 17:58:32 -05:00
conradchen
246b3400ec [M3][Dialog] Fix dialog icon color tint
Only tints dialog icons when it's an SVG with colorControlNormal, which is the common default color used by vector icons.

PiperOrigin-RevId: 418666657
2021-12-29 13:56:43 -05:00
conradchen
a17af6ee04 Automated g4 rollback of changelist 418054400
PiperOrigin-RevId: 418062580
2021-12-28 11:44:12 -05:00
conradchen
747bcf25ff [ButtonGroup] Simplify MaterialButtonTogglerGroup's checking logic
1. Consolidates single selected ID and multiple selected IDs to a single selected
   ID set.
2. Separates View states and internal checked states so we can focus and enforce
   policies much easier on only internal states.

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

PiperOrigin-RevId: 418054400
2021-12-28 08:55:31 -05:00
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