2519 Commits

Author SHA1 Message Date
dsn5ft
241aa5cd8b [CollapsingToolbarLayout] Added experimental API to allow generic customizations of the StaticLayout.Builder used for the title text
Example usage:

```
collapsingToolbarLayout.setStaticLayoutBuilderConfigurer(
    builder ->
        builder.setLineBreakConfig(
            new LineBreakConfig.Builder()
                .setLineBreakWordStyle(LineBreakConfig.LINE_BREAK_WORD_STYLE_PHRASE)
                .build()));
```

PiperOrigin-RevId: 455625977
2022-06-23 18:32:33 +00:00
pekingme
3fdfb6e230 [I18n] Updated translated strings. We know how to say "Cancel" now :)
PiperOrigin-RevId: 454915686
2022-06-14 12:36:12 -07:00
pekingme
ecb6284a8b [Shape] Fixed overlapping of compat shadow of inner corners.
Resolves https://github.com/material-components/material-components-android/issues/1388

PiperOrigin-RevId: 454893622
2022-06-14 10:21:03 -07:00
conradchen
fd5ee4a989 [Snackbar] Avoid update layout if bottom margins for anchor view does not change
Whenever the anchor view is being relaid out, we will try to update the bottom margin of the snack bar, which may cause the anchor view be relaid out again, thus an infinite loop. Avoids updating margins if the bottom margin for anchor view doesn't change to fix the issue.

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

PiperOrigin-RevId: 454885847
2022-06-14 10:19:33 -07:00
conradchen
051410b7ef [TextField] Stop saving/restoring TextInputLayout's themeable fields
Saving/restoring themeable fields will cause problems when the view is recreated, because those fields will be restored to the value resolved from the context before the recreation, instead of the current context. For example, when the device locale changes, those fields will still be restored to the previous locale instead of the new one.

It's a general practice in Android framework and AndroidX not to save/restore themeable fields. If clients need this, they should implement their own logic.

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

PiperOrigin-RevId: 454708278
2022-06-13 16:15:10 -07:00
conradchen
687e73590d [TopAppBar] Exclude gone views from scroll range calculation
Resolves https://github.com/material-components/material-components-android/issues/2709

PiperOrigin-RevId: 454163860
2022-06-10 16:38:51 -07:00
leticiars
254abc58b8 [RadioButton] Refactored button tint color resource and updated docs
PiperOrigin-RevId: 453664804
2022-06-09 13:41:56 -07:00
rightnao
a601107868 [MaterialButton] Add methods to not toggle checked state on buttons on click
Resolves https://github.com/material-components/material-components-android/issues/2291

PiperOrigin-RevId: 453569861
2022-06-07 18:53:01 -07:00
leticiars
8dd9c7e30c [Checkbox] Added support for error state.
PiperOrigin-RevId: 453496914
2022-06-07 18:52:10 -07:00
hunterstich
5c0003ca81 [ExtendedFloatingActionButton] Updated show and hide motion specs to use motion tokens.
Resolves https://github.com/material-components/material-components-android/issues/2086

PiperOrigin-RevId: 453457969
2022-06-07 18:51:11 -07:00
hunterstich
11578b34f3 [NavigationBar][NavigationRail] Updated item ripple to be contained within active indicator shape when enabled.
PiperOrigin-RevId: 453449225
2022-06-07 18:49:19 -07:00
dsn5ft
c5b37e6ea6 [MaterialToolbar] Add clearNavigationIconTint() method
Resolves https://github.com/material-components/material-components-android/issues/2678

PiperOrigin-RevId: 453220817
2022-06-06 14:25:49 -07:00
pekingme
25482b1425 [FAB] Migrated "regular/default" sized styles to new shape system.
PiperOrigin-RevId: 452817382
2022-06-03 15:49:33 -07:00
conradchen
1fe1618fca [BottomSheet] Do not find scrolling child that's not visible
Resolves https://github.com/material-components/material-components-android/issues/1834

PiperOrigin-RevId: 452813746
2022-06-03 15:42:29 -04:00
conradchen
71bfaca706 [ProgressIndicator] Fix ProgressIndicator's size under a complex measurement
When a ProgressIndicator doesn't have a preferred width or height, its size will be calculated incorrectly as we rely on its super class, ProgressBar's onMeasure() method to decide its size. But ProgressBar doesn't support "unspecified" preferred width/height, in this case it will set measured dimensions to fixed values based on the incorrect "preferred size".

Fixes this issue by fallback to the default View.onMeasure() logic when no preferred width or height is specified.

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

PiperOrigin-RevId: 452795304
2022-06-03 12:10:03 -07:00
Sujit Kumar
ed11e694e7 [Slider] Fix label visibility when slider is hidden
Resolves https://github.com/material-components/material-components-android/pull/2730
Resolves https://github.com/material-components/material-components-android/issues/2726

GIT_ORIGIN_REV_ID=40d8798531f9a4ec82465909c8ec9b83d0201371
PiperOrigin-RevId: 452791189
2022-06-03 12:09:21 -07:00
dsn5ft
e981f2f96c [Snackbar] Add defensive null check for messageView.getLayout() in SnackbarContentLayout onMeasure
PiperOrigin-RevId: 452776106
2022-06-03 11:59:14 -07:00
conradchen
e9b5328490 [Switch] Tokenize the new switch styles
PiperOrigin-RevId: 452763569
2022-06-03 11:56:35 -07:00
conradchen
132ff888ea [BottomSheet] Update javadoc of setHideable() method
It actually affects both swiping and setting the state programmatically. Removes the description regarding swiping to make it more accurate.

PiperOrigin-RevId: 452684555
2022-06-03 11:55:45 -07:00
pekingme
d0c3ea0eb5 [Tokens] Upgraded token resources to v0.99.
PiperOrigin-RevId: 452574141
2022-06-02 15:41:39 -07:00
conradchen
2d3024ea10 [BottomSheet] Fix BottomSheetDialog edge-to-edge mode
PiperOrigin-RevId: 452302946
2022-06-02 10:05:29 -07:00
conradchen
a9a57af629 Automated g4 rollback of changelist 452075757
PiperOrigin-RevId: 452112331
2022-05-31 13:50:56 -07:00
conradchen
072578dde6 [Switch] Refine tinting logic to have better performance
Move the unchecked and checked state calculation off from each invalidate() call to onCreateDrawableState() so we can make sure we will only calculate the states when needed.

PiperOrigin-RevId: 452092712
2022-05-31 13:50:12 -07:00
conradchen
fd8d30d55c [BottomSheet] Fix BottomSheetDialog edge-to-edge mode
Replace the usage of deprecated setSystemUiVisibility() with WindowCompat.setDecorFitsSystemWindows(). The original implementation will override any existing system visibility flags, so this CL also fixes the issue that certain existing system visibility settings like light navigation bar is reset.

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

PiperOrigin-RevId: 452075757
2022-05-31 13:49:38 -07:00
conradchen
ea12f84f2b [FAB] Fix the issue that state-list animator cannot be customized
Before this CL we always reset the state-list animator when FAB elevation changes, i.e., any state-list animators set via XML will be overridden because elevation is set later. Fixes this by storing the default state-list animator created in onElevationsChanged() and check if it's been overridden before we update and reset it.

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

PiperOrigin-RevId: 452073249
2022-05-31 13:48:53 -07:00
raajkumars
7d0f1badea [Material Theme] Added isMaterial3DynamicColorApplied attr to identify whether dynamic colors are being used in a theme.
PiperOrigin-RevId: 451486255
2022-05-31 13:36:11 -07:00
conradchen
2f33cfc213 [Switch] Add thumb icon tint to the new switch styles
PiperOrigin-RevId: 451422588
2022-05-31 13:32:39 -07:00
conradchen
69e484dd1e [ProgressIndicator] Make progress indicator drawables scalable by setBounds()
Resolves https://github.com/material-components/material-components-android/issues/2364

PiperOrigin-RevId: 451214292
2022-05-26 16:16:49 -04:00
conradchen
06bba009d4 [Switch] Add associated text styles
Also increases the min height to match the min touch target size.

PiperOrigin-RevId: 450987495
2022-05-26 16:16:11 -04:00
conradchen
1e08c680d4 [Switch] Add material switch style to M3 themes
Also add public attributes to public.xml

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

PiperOrigin-RevId: 450782655
2022-05-25 15:17:43 -04:00
pekingme
3db2109311 [ExFAB] Migrated to new shape system.
PiperOrigin-RevId: 450741383
2022-05-25 15:16:34 -04:00
conradchen
53086a0533 [BottomSheet] Add back accidentally removed setLightStatusBar method and annotate it as deprecated
PiperOrigin-RevId: 450696352
2022-05-24 13:23:43 -04:00
conradchen
1a91e683a3 [BottomSheet] Fix bottom sheet dialog status bar color adjustment
This CL fixes two issues regarding bottom sheet dialog status color adjustment in edge-to-edge mode:

1. Uses WindowInsetsControllerCompat to set status bar color to replace the deprecated way of setting flags, which cannot override the light/dark setting set by WindowInsetsControllerCompat.
2. Tracks Window change so the original status bar color can be updated when the dialog is re-shown. (The day/night mode can be changed when the dialog is hidden.)

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

PiperOrigin-RevId: 450463570
2022-05-24 13:16:26 -04:00
rightnao
21f9b0ff25 [BottomAppBar] Add a callback for whenever bottom view hides/unhides through scrolling
PiperOrigin-RevId: 450449206
2022-05-24 13:13:10 -04:00
pubiqq
382ce9c792 [TopAppBar] Fix copy constructors
Resolves https://github.com/material-components/material-components-android/pull/2686

GIT_ORIGIN_REV_ID=7f62b56c7edf01046e85b474d1cf0f17c6153b68
PiperOrigin-RevId: 450440535
2022-05-23 11:20:15 -04:00
conradchen
a3ca744776 [Switch] Create icon style for the new switch design
PiperOrigin-RevId: 450037491
2022-05-23 11:19:33 -04:00
pekingme
30bb583f20 [FAB] Migrated "Large" styles to use new shape system.
PiperOrigin-RevId: 450021484
2022-05-23 11:18:39 -04:00
pekingme
acc75697ea [FAB] Added "Small" styles with new shape system.
PiperOrigin-RevId: 450003295
2022-05-23 11:13:49 -04:00
Material Design Team
78d2c1f3db [M3][Color] Fix Resources Loader bug for color harmonization
PiperOrigin-RevId: 449926388
2022-05-23 11:07:01 -04:00
pekingme
65120923d5 [Token][Switch] Added token generated resources.
PiperOrigin-RevId: 449904422
2022-05-23 11:04:09 -04:00
rightnao
4ded01ed3f [TextInputLayout] Add a new custom length counter field and getters/setters to switch how text length is calculated for the counter.
Resolves https://github.com/material-components/material-components-android/issues/2418

PiperOrigin-RevId: 449842640
2022-05-23 10:21:23 -04:00
pekingme
c3406dc3ab [Tokens] Upgrade resources to v0.95.
PiperOrigin-RevId: 449840889
2022-05-20 15:19:31 -04:00
pekingme
a1e83052d9 [Tokens] Regenerated token resources with <macro> type.
PiperOrigin-RevId: 449829080
2022-05-20 15:18:57 -04:00
conradchen
80d5ba5894 [Switch] Internal change
PiperOrigin-RevId: 449794117
2022-05-20 15:13:01 -04:00
Material Design Team
b3a7dafe6e [M3][Color] Update Dynamic Colors condition
PiperOrigin-RevId: 449782139
2022-05-19 14:28:10 -04:00
conradchen
3b257c0169 [Switch] Support tinting thumb & track according to thumb position
PiperOrigin-RevId: 449760154
2022-05-19 14:27:11 -04:00
conradchen
2db8b0cd5a [TextField] Link OnItemSelectedListener of AutoCompleteTextView with the actual drop-down list
Framework has no default implementation of how or when OnItemSelectedListener will be called. We need to link it with the actual ListPopupWindow we are going to show.

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

PiperOrigin-RevId: 449725174
2022-05-19 14:24:31 -04:00
conradchen
73cb1b6e78 [TextField] Fix hint is not displayed when expanding space is limited
In CollapsingTextHelper we are checking both the expanded bound and the collapsed bound to be larger than 0 to decide if we are going to draw the collapsing text. However this can result in a situation that when there's no space to display expanded hint, the collapsed hint won't be drawn either, even if the hint is not expandable at all.

This CL fixes the issue in a more generic way - whenever draw() is called, we check if the current bound (should be calculated whenever the collapsing fraction is changed) is larger than 0 to decide if we need to draw the collapsing text.

This CL also adds the logic to ensure the cutout bound will never be larger than the collapsed bound.

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

PiperOrigin-RevId: 449597658
2022-05-18 21:14:13 -04:00
raajkumars
673cefc714 [TextInputLayout] Fix for TextInputLayout leak via AccessibilityManager.
Resolves https://github.com/material-components/material-components-android/issues/2615

PiperOrigin-RevId: 449517571
2022-05-18 21:12:36 -04:00
rightnao
be1b38c30b [BottomSheet] Exposing bottom sheet hide friction with get/set methods.
PiperOrigin-RevId: 449334214
2022-05-18 11:13:08 -04:00