2441 Commits

Author SHA1 Message Date
conradchen
0c8fc4144e [M3][Color] Add missing M3 color attributes to public
Resolves https://github.com/material-components/material-components-android/issues/2538

PiperOrigin-RevId: 424403413
2022-01-27 09:50:52 -08:00
conradchen
1c5c054b70 [Dialog] Fix crashes when colorControlHighlight is a CSL
We set ?attr/colorControlHighlight as scroll indicators' background attribute. However, on older platforms this will crash the app due to Android expects a drawable or a plain color for the background attribute.

Changes the view to TextView so it will be rendered as MaterialTextView, which supports app:backgroundTint with CSLs. Also changes the base background color to #1F000000 and the tint color to ?attr/colorForeground, which are aligned with what framework's alert dialog implementation is doing.

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

PiperOrigin-RevId: 423917985
2022-01-25 14:48:33 -05:00
dsn5ft
96fa85e216 [MaterialButtonToggleGroup] Removed getAccessibilityClassName() override since TalkBack doesn't recognize the class name, in favor of getting identified as a generic list container
PiperOrigin-RevId: 423814546
2022-01-24 15:47:55 -05:00
pfthomas
7d46b95e9e [TextInputLayout] Add support for minEms and maxEms
Resolves https://github.com/material-components/material-components-android/issues/2269

PiperOrigin-RevId: 423118234
2022-01-24 14:48:13 -05:00
Material Design Team
285fa9de30 Automated g4 rollback of changelist 422930284
PiperOrigin-RevId: 422949121
2022-01-20 10:24:30 -05:00
Material Design Team
c52b95d4d5 Automated g4 rollback of changelist 420096508
PiperOrigin-RevId: 422930284
2022-01-19 19:34:23 -05:00
dsn5ft
b84f35f121 [Color] Update DynamicColors util to use activity.getTheme().applyStyle() instead of activity.setTheme() to workaround Force Dark issue
Resolves https://github.com/material-components/material-components-android/issues/2521

PiperOrigin-RevId: 422816956
2022-01-19 11:15:01 -05:00
pekingme
d0e0d9404d [Tokens] Downgraded token resources to v0.71.
PiperOrigin-RevId: 421954490
2022-01-18 12:04:57 -05:00
conradchen
3cf0647da0 [Slider] Fix lint error caused by hidden super interface
Overriding the inherited methods from a hidden super interface to fix lint errors caused by those methods being hidden.

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

PiperOrigin-RevId: 421909180
2022-01-18 12:03:14 -05:00
conradchen
6c41f070e8 [Button] Support icon gravity with text alignments other than centered
Resolves https://github.com/material-components/material-components-android/issues/1371

PiperOrigin-RevId: 421605261
2022-01-18 12:02:02 -05:00
conradchen
8342f9025e [M3][Dialog] Add date and time picker themes to M3 dialog themes
Also moves all theme overlays to separate files for internal building purpose.

PiperOrigin-RevId: 421385265
2022-01-13 12:18:05 -05:00
conradchen
698cf9b45e [AppBarLayout] Save and restore scroll state during scroll range recalculation
When scroll range changes, the current scroll position may not make sense anymore. Therefore we need to save the scroll state and restore it after the scroll range is invalidated. This change reuses and refactors the existing saving instance state logic to support this need. Also adds a flag to denote "fully expanded" state to avoid improper scroll position calculation when views are still being initialized.

PiperOrigin-RevId: 421348135
2022-01-13 12:15:17 -05:00
dsn5ft
8f4837e059 [MaterialCheckBox] Horizontally center the checkbox button drawable if there is no text
PiperOrigin-RevId: 421304994
2022-01-12 11:30:33 -05:00
jeremymuhia
90787bf0e0 [TextAppearance] fix drawables not applying system level bold
PiperOrigin-RevId: 421066050
2022-01-12 11:21:15 -05:00
conradchen
a74675177f [Badge] Internal change
PiperOrigin-RevId: 420376250
2022-01-12 11:20:32 -05:00
dsn5ft
48741b4e16 [Color] Avoid Short#compare usage in ColorResourcesTableCreator.java since it requires API level 19
PiperOrigin-RevId: 420358384
2022-01-12 11:19:45 -05:00
pekingme
4527272319 [Tokens] Upgraded token resources to v0.73.
PiperOrigin-RevId: 420329292
2022-01-12 11:18:41 -05:00
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