214 Commits

Author SHA1 Message Date
pubiqq
204811089d [Internal] Replace deprecated androidx.core.view.* methods
Resolves https://github.com/material-components/material-components-android/pull/4180

GIT_ORIGIN_REV_ID=8e4ec29abacc33cde748b8f07f0ba5c251cef395
PiperOrigin-RevId: 656004130
2024-07-25 19:09:36 +00:00
rightnao
20f92dfb51 [NavigationDrawer] Notify each adapter item of a potential change in case there are any item changes
Resolves https://github.com/material-components/material-components-android/issues/4168

PiperOrigin-RevId: 646154192
2024-06-25 14:53:10 +00:00
shawn hwang
3a31eef6f4 [NavigationView] Fixed item being checked instead of submenu item
Resolves https://github.com/material-components/material-components-android/pull/4155

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

GIT_ORIGIN_REV_ID=0f539d1e079f4bfcb044db26a4a0064538d29f05
PiperOrigin-RevId: 642317463
2024-06-11 19:00:12 +00:00
rightnao
99e8044f85 [NavigationRail] Add item spacing attribute
PiperOrigin-RevId: 639835301
2024-06-05 18:29:56 +00:00
rightnao
60a525a167 [BottomNavigationView][NavigationRailView] Modifying NavigationBarView to match more to specs and restructuring layout to prepare for expressive changes
Changes:
- minHeight for BottomNavigationView is actually a minimum height, not an exact height; the bar height now wraps content properly
- For BottomNavigationView, bottom item padding now counts from the bottom of the label group instead of from the lowest label baseline. The label TextViews also have a min height of the line height supplied by the provided TextAppearance. This aligns with our m3 specs
- Structural changes in navigation item layouts. Previously the label and the icon were not aware of each other in a FrameLayout and could potentially overlap; this is no longer the case as they are in a LinearLayout
- padding between icon and label is 4dp as per specs
- Centering logic changed to center the icon and label as a group, not separately
PiperOrigin-RevId: 635922505
2024-05-23 14:54:36 +00:00
pubiqq
8edae9b8cc [NavigationView] Fix section label alignment in RTL.
Resolves https://github.com/material-components/material-components-android/pull/4119
Resolves https://github.com/material-components/material-components-android/issues/4178

GIT_ORIGIN_REV_ID=8bb965ac42ed085a6a3d5541ca846ee263d7d5be
PiperOrigin-RevId: 635461461
2024-05-20 21:18:18 +00:00
pubiqq
26bfdd2257 [NavigationView] Fix subheader and divider insets and use relative listPreferredItemPaddings.
Resolves https://github.com/material-components/material-components-android/pull/4122
Resolves https://github.com/material-components/material-components-android/pull/4123

GIT_ORIGIN_REV_ID=911d1af88c0d10c6894bf38546b870430e86b6f9
PiperOrigin-RevId: 634517597
2024-05-16 21:30:24 +00:00
pubiqq
510881a469 [Internal] Stop using deprecated androidx.core.view.* methods
Resolves https://github.com/material-components/material-components-android/pull/4117

GIT_ORIGIN_REV_ID=dd157e8360c2511810496693cec1616fce578655
PiperOrigin-RevId: 632284856
2024-05-13 17:37:38 +00:00
Ga\u00ebtan Muller
b3fe6a7f61 [Cleanup] Remove redundant version checks for api <= 19.
Resolves https://github.com/material-components/material-components-android/pull/3849

GIT_ORIGIN_REV_ID=47bb2fcc8031740e5a7d4f741f1ada2af025e126
PiperOrigin-RevId: 632154861
2024-05-09 18:46:02 +00:00
dsn5ft
b56afa75a9 [SearchView] Update back arrow to be auto mirrored for RTL
PiperOrigin-RevId: 622863529
2024-04-09 18:46:12 +00:00
pfthomas
5bf6831b14 [NavDrawer][a11y] Fix wrong item selected after click
PiperOrigin-RevId: 616214272
2024-03-20 18:47:11 +00:00
pubiqq
7674e12ea8 [CollapsingToolbarLayout] Fix text shadow fading when transitioning between expanded and collapsed states
Resolves https://github.com/material-components/material-components-android/pull/3641

GIT_ORIGIN_REV_ID=7243f7a2f09b04caceec488443b1652a8ffef961
PiperOrigin-RevId: 578838845
2023-11-06 13:57:49 +00:00
dsn5ft
094e3e21ea [CollapsingToolbarLayout] Fix issue where expanded text gets ellipsized too aggressively when using title fade mode and the toolbar has menu items
PiperOrigin-RevId: 569287167
2023-10-02 13:39:52 +00:00
pubiqq
0663019f45 [Color] Add ColorStateListDrawable support
Resolves https://github.com/material-components/material-components-android/pull/3538

GIT_ORIGIN_REV_ID=1bf9e320dc148e1bc959e7577372d3a393f35574
PiperOrigin-RevId: 563258432
2023-09-07 12:37:54 +00:00
pfthomas
917da52393 [NavigationDrawer] Do not count headers for accessibility
PiperOrigin-RevId: 540975970
2023-06-26 21:25:15 +00:00
pfthomas
022e217770 [Navigation] Add itemTextAppearanceActiveBoldEnabled attr
Resolves https://github.com/material-components/material-components-android/issues/3191
Resolves https://github.com/material-components/material-components-android/issues/3293

PiperOrigin-RevId: 539977391
2023-06-14 15:14:24 +00:00
Michael Shafrir
d29ed38f5a [Internal] Guard against NPE in ManufacturerUtils
Resolves https://github.com/material-components/material-components-android/pull/3347

GIT_ORIGIN_REV_ID=0d6a0096b1ec98ba598a559369d7f17ad9d1723c
PiperOrigin-RevId: 524912877
2023-04-17 12:18:07 -07:00
dsn5ft
a4b6f46f0c [Predictive Back][Search] Update SearchView to support predictive back when set up with SearchBar
PiperOrigin-RevId: 520613990
2023-03-30 16:35:21 +00:00
rightnao
8499b83ba1 [BadgeDrawable] Add padding in between top and bottom edges of badge and text
PiperOrigin-RevId: 518370027
2023-03-21 20:50:42 +00:00
hunterstich
3f993923b2 [NavigationRailView] Added attribute to control the application of start window inset padding.
PiperOrigin-RevId: 516904093
2023-03-15 21:10:53 +00:00
pfthomas
4032a74112 [MaterialDatePicker] Fix keyboard not showing at first in text input mode
Resolves https://github.com/material-components/material-components-android/issues/2747

PiperOrigin-RevId: 511501130
2023-02-23 03:46:22 -08:00
pubiqq
e06a11982b [Internal] Add compat method to get the screen size
Resolves https://github.com/material-components/material-components-android/pull/3221

GIT_ORIGIN_REV_ID=9323e23689386561d38b0c8c73114e0db7a30557
PiperOrigin-RevId: 509548792
2023-02-15 10:25:53 -08:00
dsn5ft
bdb6f5dc47 [CollapsingToolbarLayout] Fix issue with multiline title text flickering when titleCollapseMode=fade
PiperOrigin-RevId: 506622125
2023-02-02 16:51:40 +00:00
dsn5ft
87ce239b01 [Docs] Remove smart characters from doc comments
PiperOrigin-RevId: 494733732
2022-12-12 16:40:01 -05:00
pfthomas
b1bd580d7e [NavigationDrawer] Updated active text label to use a bold typeface.
PiperOrigin-RevId: 487600688
2022-11-18 16:53:12 -05:00
rightnao
cb384c5c2c [NavigationView] Disable drawing left and right insets if the nav bar is not edge to edge
resolves https://github.com/material-components/material-components-android/issues/3016

PiperOrigin-RevId: 484304490
2022-10-28 07:44:17 -07:00
leticiars
a85204eb75 [TextInputLayout] Updated expanded label color to take error color when on error.
Partially fixes https://github.com/material-components/material-components-android/issues/2719

PiperOrigin-RevId: 471799584
2022-09-02 12:54:09 -07:00
Material Design Team
44cc9b745c Add @CanIgnoreReturnValue to some APIs that return this.
PiperOrigin-RevId: 468721442
2022-08-22 15:22:27 -04:00
leticiars
00dfeaca53 [Internal] Merge DrawableUtils classes
PiperOrigin-RevId: 466426273
2022-08-10 13:14:53 +00:00
leticiars
079371fd10 [Checkbox] Fix pre-21 issue where a child of the layer drawable (the button and/or the icon drawables) may not have its constant state set up properly.
PiperOrigin-RevId: 464128801
2022-08-04 14:21:36 -04:00
leticiars
9ca8a80468 [Checkbox] Fixed issue where AppCompatCheckBox would not display its drawable when a Material theme was being used.
Instead of nulling android:button and buttonCompat in the Material style, we now check if the legacy drawable is being used, and override that if so.

PiperOrigin-RevId: 463643386
2022-07-28 17:41:12 -04:00
raajkumars
dfbbf609c5 [Internal] Added ExpandCollapseAnimationHelper and MultiViewUpdateListener.
PiperOrigin-RevId: 462451046
2022-07-22 15:23:37 +00:00
leticiars
8fae47a39e [Checkbox] Updated checkbox to M3 look.
The checkbox is now composed of an `app:buttonCompat` button drawable (the squared
icon) and an `app:buttonIcon` icon drawable (the checkmark icon) layered on top
of it. The animation has also been updated.

PiperOrigin-RevId: 462244130
2022-07-22 15:22:30 +00:00
raajkumars
07938f572f [Internal] Added utility methods to ViewUtils.
PiperOrigin-RevId: 462208023
2022-07-20 21:49:42 +00:00
raajkumars
2a58122252 [Internal] Move RectEvaluator to Material Android Library
PiperOrigin-RevId: 461973938
2022-07-20 21:47:03 +00:00
raajkumars
3a37288453 [Internal] Moved ReversableAnimatedValueInterpolator to Material Android Library.
PiperOrigin-RevId: 461963086
2022-07-20 21:45:58 +00:00
raajkumars
ec8e70babb [Internal] Moved TouchObserverFrameLayout to Material Android Library.
PiperOrigin-RevId: 461948017
2022-07-20 21:45:16 +00:00
raajkumars
f3d422fb99 [Internal] Moved FadeThroughDrawable to Material Android Library.
PiperOrigin-RevId: 461932441
2022-07-19 18:43:37 +00:00
raajkumars
c8878f1790 [Internal] Move ClippableRoundedCornerLayout to Material Android library.
PiperOrigin-RevId: 461898783
2022-07-19 18:43:09 +00:00
pubiqq
4dc3d93ac2 [NavigationView] Update foreground boundaries of menu items when setting a new foreground
Resolves https://github.com/material-components/material-components-android/pull/2737
Resolves https://github.com/material-components/material-components-android/issues/2735

GIT_ORIGIN_REV_ID=8632d22d414f592378b68a8d27f7fba73edc28f9
PiperOrigin-RevId: 458198734
2022-07-06 04:52:55 -07:00
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
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
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
dsn5ft
2ac796fdf4 [MaterialToolbar] Add null check for logo ConstantState check
Resolves https://github.com/material-components/material-components-android/issues/2708

PiperOrigin-RevId: 449305810
2022-05-17 22:16:43 -04:00
pubiqq
5d6678cc66 [MaterialDatePicker] Hide the keyboard when switching to calendar mode
Resolves https://github.com/material-components/material-components-android/pull/2688
Resolves https://github.com/material-components/material-components-android/issues/2687

GIT_ORIGIN_REV_ID=686526aa049eadb08ded72ca9eb0b60027358756
PiperOrigin-RevId: 447819486
2022-05-11 09:41:38 -04:00
conradchen
0c341c4e9b [TopAppBar] Fix collapsing title issue with different fonts
When the collapsing title is fully expanded, the current logic won't update the linear text setting correctly to false, which may result in the issue that the type face is not updated correctly. Fixes this by always updating linear text settings when the available text width is not 0.

Also refactors the typeface relevant logic so we will decide if we should recreate the static text layout in a consistent way.

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

PiperOrigin-RevId: 446735260
2022-05-05 15:15:16 -04:00
conradchen
526ce8c6c5 [TopAppBar] Fix margins not applied when collapsed and expanded text size and type face are the same
We missed to check if the available text width is changed when deciding if we should recreate the static text layout. Adds the check to fix the issue.

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

PiperOrigin-RevId: 445941276
2022-05-02 11:45:14 -04:00
Venugopal Rao Gubbala
7b043c3b68 [CollapsingToolbarLayout] Allow application to Set ellipsis to Title in CollapsingToolBar
Resolves https://github.com/material-components/material-components-android/pull/2636

GIT_ORIGIN_REV_ID=f6c2b07c1eb936ed2de47b7586688a5f6b322e48
PiperOrigin-RevId: 445200467
2022-04-28 16:26:58 -04:00
pfthomas
b1f7d5bebc [NavigationView][a11y] Announce number of items in drawer
Resolves https://github.com/material-components/material-components-android/issues/678

PiperOrigin-RevId: 445165922
2022-04-28 12:40:24 -04:00
pubiqq
3ca41be8f0 [General] Fix typos
Resolves https://github.com/material-components/material-components-android/pull/2654

GIT_ORIGIN_REV_ID=b8f6728979875629f2c813ef90d2f671cf56b4eb
PiperOrigin-RevId: 442852630
2022-04-19 14:48:55 -04:00