753 Commits

Author SHA1 Message Date
afohrman
a0d4fa03ff [Side Sheet] Changed side sheet title text appearance to Title Large.
This change is in the Catalog, since the developer is responsible for layout elements within the side sheet.

Also changed some other elements of the side sheet content layouts to balance out the visual look of the sheets.

PiperOrigin-RevId: 532788247
2023-05-22 18:31:42 +00:00
rightnao
b57dae57aa [Carousel] Add Carousel Hero strategy demo
PiperOrigin-RevId: 531612383
2023-05-15 17:29:00 +00:00
rightnao
26c377962f [Carousel][Catalog] Add option for snapping with multi-browse carousel demo
PiperOrigin-RevId: 529818471
2023-05-08 14:48:58 -04:00
afohrman
87a45a2a3d [Side Sheet] Fixed modal sheet text field formatting bug in catalog.
Before this change, the modal sheet is initially expanded with a "%f" for the slide offset text and the state TextView doesn't change until the first drag of the sheet.

There was actually no underlying side sheet bug here; the modal sheet has two ways of animating, window animations and the "native" SideSheetBehavior ViewDragHelper animations. In the catalog, the modal sheet's text views weren't getting set yet because it was using the window animations to enter/exit and the callback doesn't run until it's dragged with SideSheetBehavior's ViewDragHelper. The only change necessary here is to set the TextViews to Visibility#GONE until the callback runs, so that there are no uninitialized TextViews visible on screen.

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

PiperOrigin-RevId: 529220073
2023-05-04 07:41:27 -07:00
afohrman
b984e64445 [Predictive Back] [Side Sheet] Added handleBackInvoked() predictive back support for coplanar side sheets.
Added an AnimatorUpdateListener that runs in finishBackProgress() to make the coplanar sibling's margins update as the sheet slides back to its origin edge.

PiperOrigin-RevId: 527749916
2023-04-28 14:46:43 -04:00
dsn5ft
d8c5c2c87d [Predictive Back] Fix custom nav drawer Catalog demo pre-T crash due to OnBackAnimationCallback class not found
PiperOrigin-RevId: 527348628
2023-04-26 16:23:49 -04:00
afohrman
562285e051 [Predictive Back][Side Sheet] Added predictive back support for standard side sheets.
PiperOrigin-RevId: 527326750
2023-04-26 16:20:46 -04:00
pfthomas
29b59c21f5 [MaterialDatePicker] Add getTextColor to DayViewDecorator
PiperOrigin-RevId: 527265648
2023-04-26 16:19:16 -04:00
afohrman
d0ad45e1a1 [Side Sheet] Added left/start modal sheet.
Sheet gravity is intended to be set once at setup before the sheet is shown; sheet gravity changes are not supported at runtime and will cause an IllegalStateException.

Also refactored modal sheet demo to recreate the sheet every time it's shown, which allows the sheet gravity changes to take effect for modal sheets.

PiperOrigin-RevId: 526957847
2023-04-25 17:07:13 -04:00
raajkumars
3b43d41f16 [M3][Catalog][Search] Updated SearchDemoUtils to mark the class and methods as public so that it can be resued.
PiperOrigin-RevId: 525549879
2023-04-24 15:25:09 -04:00
dsn5ft
9405121f62 [Predictive Back] Update side container back helper to support containers with arbitrary child views
PiperOrigin-RevId: 525466973
2023-04-19 14:12:04 -07:00
rightnao
add7f5d650 [TabLayout] Create tab demo fragment that uses viewpager2 in Catalog
PiperOrigin-RevId: 524914935
2023-04-19 12:44:06 -07:00
hunterstich
0184b5baa9 [Carousel] Updated MultiBrowseCarouselStrategy to find best arrangments using a cost function
This changes the way arrangements are found by:
* Finding all possible arrangements of items
* Sort the arrangement candidates using a cost function that optimizes for total space fit, large item size retention, and adherence to other input params
* Fit and use the top arrangement to work within the carousel's available space

PiperOrigin-RevId: 522568015
2023-04-10 15:03:52 +00:00
pekingme
6b28ffc664 [BottomSheet] Internal cleanup.
PiperOrigin-RevId: 522410409
2023-04-10 14:53:45 +00:00
hunterstich
5bc7a50b35 [Carousel] Fixed mutli-browse catalog demo crashing due to invalid position slider values.
PiperOrigin-RevId: 522072959
2023-04-10 14:48:34 +00:00
dsn5ft
2c23d2a158 [Predictive Back][Bottom Sheet] Fix bug where standard hideable bottom sheets don't stay hidden after predictive back
It wasn't an issue for modal bottom sheets because they dismiss the whole window when the bottom sheet behavior is hidden

Also updated Bottom App Bar demo drawer to opt into predictive back, which is a standard hideable bottom sheet

PiperOrigin-RevId: 520312905
2023-03-29 19:16:12 +00:00
dsn5ft
d6fad952c6 [Predictive Back][Bottom Sheet] Update Bottom Sheet to support predictive back
- Enable predictive back by default for Bottom Sheet dialogs
- Update Catalog demo to enable predictive back for persistent/standard bottom sheet

PiperOrigin-RevId: 518896205
2023-03-23 18:15:27 +00:00
Material Design Team
2aa1cf3198 [M3][Color] Color Component demo update
PiperOrigin-RevId: 518320238
2023-03-21 20:49:20 +00:00
afohrman
78fa15748f [Side Sheet] Added LeftSheetDelegate and left sheet support for standard and coplanar side sheets.
Standard and coplanar side sheets now support sliding and dragging from the left side, as well as automatic RTL mirroring when `layout_gravity` is set to `start` or `end`. Change the sheet edge by setting `layout_gravity` on the side sheet view in XML or programmatically.

PiperOrigin-RevId: 518048965
2023-03-20 21:25:55 +00:00
Material Design Team
c786582d6a [M3][Color] Color Component demo update
PiperOrigin-RevId: 517511129
2023-03-20 21:23:50 +00:00
dsn5ft
2c297faf4b [Predictive Back][Navigation Drawer] Infrastructure for back handling in components + Navigation Drawer predictive back support
- Added MaterialBackHandler interface and MaterialBackOrchestrator class
- Implemented animations in MaterialSideContainerBackHelper for NavigationView when DrawerLayout parent

PiperOrigin-RevId: 517399606
2023-03-20 21:10:22 +00:00
dsn5ft
22c4e0dd60 [Predictive Back] Migrate Catalog to use AndroidX back pressed callbacks and enable predictive back-to-home
PiperOrigin-RevId: 515136472
2023-03-13 21:16:16 +00:00
rightnao
c22eb0d31b [BottomAppBar][Catalog] Fix bug with transparent top app bar when in bottom app bar layout
resolves https://github.com/material-components/material-components-android/issues/3265

PiperOrigin-RevId: 515043402
2023-03-08 21:29:38 +00:00
hunterstich
9d0732be9e [Carousel] Fixed child index bug causing items to be ordered incorrectly.
When filling the RecyclerView, views need to be added at the correct index (either begginning or end) depending on the direction of fill.

PiperOrigin-RevId: 513510079
2023-03-03 16:25:30 +00:00
hunterstich
4c3e1d513b [Transitions] Fixed catalog errors for some demos.
* Music player controls expands to take the place of the title area by updating constraints to tie both view groups to the bottom of the album art.
* Fixed container transform activity scrolling bug caused by window.setSharedElementsUseOverlay. Removed this as it has no effect on the demo.
* Fixed shared axis fragment end layout not animating by setting the end fragments transition name on the root scroll view instead of the scroll view's inner layout
* Added insets to shared axis controls to be visible above the navigation bar when in edge-to-edge mode

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

PiperOrigin-RevId: 511764274
2023-02-23 06:06:26 -08:00
conradchen
33e4f841b2 [Catalog][Menu] Fixes context menu are not themed on S
On S, it seems like the framework has a different behavior of applying themes/styles on the decor view theme. Catalog's theme overlay applying logic didn't take care of the implication of the decor view theme, somehow this causes the Material themes are not applied to decor views at all, when a theme overlay is applied.

We've solved the similar issue with the dynamic color implementation. Applies the same fix on catalog to fix this issue.

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

PiperOrigin-RevId: 511254476
2023-02-23 03:45:00 -08:00
hunterstich
6166e73d36 [Carousel] Implemented smoothScrollToPosition
PiperOrigin-RevId: 509873609
2023-02-17 04:32:27 -08:00
hunterstich
220415d3c1 [Carousel] Fixed scroll offset calculation error when last focal keyline comes after the last child
Calculating end scroll offset was using the distance between the last child and the last focal keyline. When the last child came before the last keyline, an unexpected scroll offset was returned. This also adds a dropdown to the catalog demo to allow setting the number of items in the carousel.

PiperOrigin-RevId: 508739119
2023-02-10 22:52:03 +00:00
hunterstich
fc0f53a0cd [Carousel] Renamed CarouselConfiguration to CarouselStrategy.
PiperOrigin-RevId: 508619540
2023-02-10 14:24:39 +00:00
conradchen
3e6a196832 [Catalog][BottomSheet] Make scrollable content demo behaves consistently in edge-to-edge mode
By default bottom sheets will add paddings at the bottom of its content to account for the navigation bar insets in edge-to-edge mode. However in the case of bottom sheet with a scrollable content, this actually creates inconsistent or at its best confusing behavior - with a plain bottom sheet, the content will be shown behind the navigation bar if you can still scroll down, but with scrollable content, whenever the bottom sheet is fully expanded, the bottom padding shows and cut the scrollable content.

It's debatable which behavior is better. But in our catalog demo I feel we can demonstrate how to do that if clients prefer a less confusing behavior, i.e., only when there's no more content to scroll, the bottom padding shows.

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

PiperOrigin-RevId: 508468196
2023-02-10 14:01:02 +00:00
hunterstich
8014267740 [Carousel] Changed CarouselConfiguration to have an empty constructor and pass Carousel in through onFirstChildMeasuredWithMargins
PiperOrigin-RevId: 508389752
2023-02-09 18:25:29 +00:00
dsn5ft
697d93a854 [Bottom Sheet] Animate bottom sheet position when keyboard is shown using WindowInsetsAnimationCompat API
Note: android:windowSoftInputMode="adjustResize" is required in order for inset animation API to propagate the correct values, otherwise this is a no-op. This change also updates the M3 modal Bottom Sheet themes / theme overlays to use adjustResize by default (can still be overridden by the client).
PiperOrigin-RevId: 508351766
2023-02-09 14:08:51 +00:00
hunterstich
e32e625e14 [Carousel] Updated to support MaterialDivider and helper for getting the bounds of a masked item from the layout manager.
PiperOrigin-RevId: 507612229
2023-02-07 22:11:57 +00:00
Material Design Team
0dd220a6e9 [M3][Carousel] Updated assets for Carousel demo
PiperOrigin-RevId: 507501256
2023-02-06 17:33:01 +00:00
dsn5ft
2e7979b60b [Catalog][TopAppBar] Fix flickering color fill in preferences demo
Set the AppBarLayout's app:liftOnScrollTargetViewId to the Preferences RecyclerView so the AppBarLayout knows which exact view is scrolling

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

PiperOrigin-RevId: 506971393
2023-02-03 21:03:44 +00:00
hunterstich
ff48bc5e3b [Carousel] Removed CenteredCarouselConfiguration.
This removes CenteredCarouselConfigration and its superclass MultibrowseCarouselConfiguration and renames StartCarouselConfiguration to MultiBrowseCarouselConfiguration.

PiperOrigin-RevId: 506424085
2023-02-01 22:32:20 +00:00
afohrman
8c2b511ad1 [Adaptive][Side Sheet] Modularized side sheet demo.
PiperOrigin-RevId: 502905537
2023-01-19 17:44:50 +00:00
pfthomas
4bd5e619fb [Catalog][Card] Fix CardSelectionModeActivity sample
Resolves https://github.com/material-components/material-components-android/issues/2716
Resolves https://github.com/material-components/material-components-android/pull/2717

PiperOrigin-RevId: 502659028
2023-01-18 15:24:59 +00:00
hunterstich
4ecba81de6 [Carousel] Release carousel component
PiperOrigin-RevId: 501635363
2023-01-12 12:25:52 -08:00
manabu-nakamura
ee00523b63 [Catalog] Applied edge-to-edge to modal side sheet
Resolves https://github.com/material-components/material-components-android/pull/3134

GIT_ORIGIN_REV_ID=8e6913689cfd8155f03b308f3e8f2e4ffb5d7261
PiperOrigin-RevId: 500759266
2023-01-10 13:39:03 -05:00
afohrman
e92414c460 [Adaptive][Side Sheet] Disabled lift on scroll in Side Sheet demo.
PiperOrigin-RevId: 499915843
2023-01-05 13:00:49 -05:00
pekingme
08595de396 [Adaptive] Changed the nav drawer's width from 232dp to wrap_content.
PiperOrigin-RevId: 499483294
2023-01-05 12:55:58 -05:00
manabu-nakamura
68688e9d61 [Switch] Use MaterialSwitch instead of SwitchCompat in Catalog.
Resolves https://github.com/material-components/material-components-android/pull/3154

GIT_ORIGIN_REV_ID=91e38eea6378a0f3a76e4db6118f0cae10042797
PiperOrigin-RevId: 498385616
2022-12-29 13:18:06 -05:00
afohrman
ad3cf5ad6b [Adaptive][Side Sheet] Add detached variant of modal side sheet.
PiperOrigin-RevId: 495709828
2022-12-16 00:57:15 +00:00
afohrman
938105a93b [Adaptive] [Side Sheet] Added detached variants of standard and coplanar sheets.
Added logic for an innerMargin to SideSheetBehavior and delegates and incorporated innerMargin into the sheet offset calculations to account for the extra spacing and avoid a jump when dragging the sheet to STATE_EXPANDED.

Also added a colored background to the catalog demo in order to see the corners of the sheet.

PiperOrigin-RevId: 495701453
2022-12-16 00:56:31 +00:00
afohrman
2fd2d66b43 [Adaptive][Side Sheet] Fixed issue where sheet would jump to the far edge of the screen in RTL without temporary fix.
PiperOrigin-RevId: 495687169
2022-12-16 00:55:39 +00:00
afohrman
27529582c7 [Adaptive][Side Sheet] Added explicit style definition to coplanar sheet catalog demo.
The coplanar sheet catalog demo was missing an explicit style definition, which was causing some attributes like the background to display improperly.

PiperOrigin-RevId: 494217653
2022-12-09 14:55:29 -05:00
afohrman
7096161776 [Adaptive][Side Sheet] Updated close sheet button content description in catalog.
PiperOrigin-RevId: 494211768
2022-12-09 14:53:52 -05:00
afohrman
bc61d6db62 [Adaptive][Side Sheet] Added coplanar side sheet with APIs for setting a coplanar sibling view.
PiperOrigin-RevId: 493959543
2022-12-08 20:03:52 +00:00
pubiqq
86fc5faaec [Catalog][DatePicker] Fix incorrect time stamps
Resolves https://github.com/material-components/material-components-android/pull/3132

GIT_ORIGIN_REV_ID=c918a0dc107d164bdc486788f5def004c5bdeb77
PiperOrigin-RevId: 493921722
2022-12-08 19:49:21 +00:00