Before 1.12.0-alpha01 which was released on 6/7, BuildCompat#isAtLeastU() only returns true if API level is greater than 33 and the version running is a pre-release. Two things happened on 6/7 -- the version became a "platform stable" version, and core library version 1.12.0-alpha01 was released, which changes BuildCompat#isAtLeastU() to return true if the version is 34 and stable.
PiperOrigin-RevId: 540304068
Clients should prefer listening to back events using androidx.activity.OnBackPressedCallback which has been updated to forward BackEventCompat objects in androidx.activity:activity:1.8.0-alpha05. This updates component predictive back APIs to take in BackEventCompat objects instead of android.window.BackEvent objects to simplify usage - getting rid of the need for version checks and object conversions.
PiperOrigin-RevId: 540290323
The close affordance icon and title text were previously aligned by the top. Since the icon button has extra spacing from insets and padding, the Views appeared to be misaligned. Aligning along the baseline fixes the visual misalignment.
This change is in the catalog since the side sheet view is provided by the developer.
PiperOrigin-RevId: 538570382
The LinearLayouts each contained only one child, so a FrameLayout is a better choice; more lightweight and slightly more performant. This is a visual no-op.
PiperOrigin-RevId: 532823326
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
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
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
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
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
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
- Enable predictive back by default for Bottom Sheet dialogs
- Update Catalog demo to enable predictive back for persistent/standard bottom sheet
PiperOrigin-RevId: 518896205
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
- Added MaterialBackHandler interface and MaterialBackOrchestrator class
- Implemented animations in MaterialSideContainerBackHelper for NavigationView when DrawerLayout parent
PiperOrigin-RevId: 517399606
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
* 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
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
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
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
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