768 Commits

Author SHA1 Message Date
manabu-nakamura
6c2dd5d69e [Catalog] Applied edge-to-edge to bottom sheet in Carousel demo
Resolves https://github.com/material-components/material-components-android/pull/3505
Resolves https://github.com/material-components/material-components-android/issues/3504

GIT_ORIGIN_REV_ID=7bdf0989eac11e9b496dd38e9e6fda8acae3b593
PiperOrigin-RevId: 555208372
2023-08-09 17:43:01 +00:00
rightnao
af7d09a43d [Catalog] Fix fullscreen vertical carousel to use vertical dividers
resolves https://github.com/material-components/material-components-android/issues/3500

PiperOrigin-RevId: 554496440
2023-08-09 15:51:22 +00:00
rightnao
0171624c16 [Carousel][Catalog] Remove default list from Carousel catalog demos as it is not an example of a carousel
PiperOrigin-RevId: 551280479
2023-07-27 22:49:17 +00:00
pfthomas
db9a6412ec [MaterialSwitch] Amendments to thumb icon size support
Resolves https://github.com/material-components/material-components-android/pull/3364

PiperOrigin-RevId: 549627031
2023-07-20 22:17:48 +00:00
rightnao
7cfd30f99b [Catalog][Carousel] Add alignment option to hero carousel
PiperOrigin-RevId: 548725196
2023-07-18 16:51:24 +00:00
rightnao
ad6afbf6d8 [Carousel][Catalog] Add fullscreen demo to catalog
PiperOrigin-RevId: 544700979
2023-07-05 13:40:20 +00:00
rightnao
27abfdba4f [Badge] Deprecate bottom badge gravities and update docs and usages in catalog
PiperOrigin-RevId: 543527285
2023-06-27 18:55:22 +00:00
afohrman
f2e70d2d66 [Android U] Replaced BuildCompat#isAtLeastU() method calls with explicit SDK checks for UPSIDE_DOWN_CAKE.
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
2023-06-14 12:45:51 -07:00
hunterstich
a67a885668 [Predictive Back] Update components to use BackEventCompat
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
2023-06-14 12:44:53 -07: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
Material Design Team
2336c23fab [Build] Update to compileSdkVersion 34 and update catalog to use androidx.activity:activity:1.8.0-alpha05
PiperOrigin-RevId: 539031943
2023-06-09 08:02:47 -07:00
afohrman
7a3f30b065 [Side Sheet] Aligned close affordance and title text along the baseline rather than the top.
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
2023-06-09 08:01:54 -07:00
afohrman
7ee0b72e8a [Side Sheet] Mapped close affordance to ?attr/colorOnSurfaceVariant in catalog.
PiperOrigin-RevId: 538533345
2023-06-09 08:01:15 -07:00
Material Design Team
836c51e44a [M3][Color] Fix harmonization demo bug
PiperOrigin-RevId: 538259732
2023-06-06 20:02:18 +00:00
afohrman
690cd5d695 [Side Sheet] Changed side sheet child containers in Catalog from LinearLayouts to FrameLayouts.
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
2023-05-22 18:32:29 +00:00
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