131 Commits

Author SHA1 Message Date
conradchen
27757d026a [M3] Create M3 skeleton themes
PiperOrigin-RevId: 390228317
2021-08-16 13:36:10 -07:00
Material Design Team
9fb73b50ff [BottomSheetBehavior] Apply the max width/height during measure instead of modifying layout params
Previously the BottomSheetBehavior was checking the measured size during onLayout and if it exceeded the max width or height configured it would "adjust" them by directly modifying the width and height on the layout params and then posting a setLayoutParams. This has many problems and is fundamentally the wrong way to do it. First off, a view should never modify the layout params that are configured on it for two reasons, one, they are properties of the parent view group, not the view itself, and two, they are almost always intended for users of the view group to configure, not the view group itself. Modifying the layout params directly is clobbering any previously configured parameter and permanently changing the layout (for example consider the case where the max width is set to 100dp and then later set to 200dp, the view would not be allowed to grow to 200dp because its layout params would already have been clobbered). Secondly the post is a very bad way to apply this max, not only does it trigger an entire layout pass a second time but it does so after having completed the first layout pass so it will cause the bottom sheet to render at the original size and then the capped size, it's both inefficient and will cause user visible jank.

The correct way to apply a maximum width/height is to do it during layout by incorporating it into the measure specs that are passed to the child. This doesn't clobber any state that the user of the view configured (i.e. when the parent measure specs change, e.g. due to screen rotation, the views correctly relayout) and it avoids doing multiple layout passes, the child can measure itself to the correct size the first time.

PiperOrigin-RevId: 387379138
2021-07-30 10:55:45 -04:00
conradchen
a2e76736c5 [BottomSheetBehavior] Fix ViewDragHelper state inconsistency
When BottomSheetBehavior is set to not draggable, it's still forwarding touch event to ViewDragHelper, which causes ViewDragHelper changes its state to dragging although it's not really dragging. This causes bugs like if we change draggable to true during "no-effect" dragging, ViewDragHelper won't report the dragging state change because it thinks the state is not changing.

Fixes this by avoiding forwarding touch events to ViewDragHelper when it's not draggable, so its state won't be changed.

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

PiperOrigin-RevId: 384942764
2021-07-15 12:37:35 -04:00
Afzal Najam
c3713724de [BottomSheet] Fix fitToContents reference in comment
Resolves https://github.com/material-components/material-components-android/pull/2196

GIT_ORIGIN_REV_ID=d996a3692496f60bd895df1a3a22b6bb4697d41f
PiperOrigin-RevId: 384750498
2021-07-15 12:33:43 -04:00
Wilson Filho
a38d2d89a8 [BottomSheet] Add maxHeight to bottom sheet behavior
Resolves https://github.com/material-components/material-components-android/pull/2216

GIT_ORIGIN_REV_ID=be136b9c5cedfb018b5a05fecac5ea9a3e242f36
PiperOrigin-RevId: 383682661
2021-07-09 15:28:02 -04:00
Sascha Huth
77c2a8383c [BottomSheet] make FloatRange for setHalfExpandedRatio() exclusive
Resolves https://github.com/material-components/material-components-android/pull/2239

GIT_ORIGIN_REV_ID=2eb3b01052ed017f23a53e5db121bb0c571f0fe6
PiperOrigin-RevId: 379791479
2021-06-17 14:30:42 -04:00
Material Design Team
b4982f9cdc [BottomSheet] Adds additional methods that are restricted to the library. They will be used for Experiment and deleted/revised after experiment.
PiperOrigin-RevId: 378874986
2021-06-14 18:32:13 +00:00
leticiars
ce928fcb65 [Bottomsheets][Large Screens] Adding a max width for bottom sheets to optimize for large screens.
PiperOrigin-RevId: 368533002
2021-04-16 17:47:14 -04:00
Material Design Team
030e5bd65b [BottomSheet] read the edgeToEdgeEnabled value earlier in the lifecycle
The DialogFragment will set the content view during the INITIALIZED state of the Lifecycle.  This happens prior to onCreate and currently results in the edgeToEdgeEnabled value always being false at the time the OnApplyWindowInsertListener is conditionally set.

PiperOrigin-RevId: 366294759
2021-04-01 16:46:49 -04:00
cketcham
6f220b11a7 [BottomSheet] Sets default for BottomSheetBehavior paddingTopSystemWindowInsets to true
This adds space where the status bar is for any bottomsheet that would have otherwise been fullscreen.

PiperOrigin-RevId: 361933708
2021-03-10 10:03:14 -05:00
cketcham
28c3254d2a [BottomSheet] Allow opting out of edge to edge on the top
PiperOrigin-RevId: 359525223
2021-03-03 12:40:48 -05:00
cketcham
33f5aefb35 [BottomSheet] Only add OnApplyWindowInsetsListener if edgeToEdgeEnabled is true
PiperOrigin-RevId: 359407836
2021-03-03 12:40:08 -05:00
cketcham
2933600552 [BottomSheet] Prevent adding half expanded accessibility action if fitToContents is true
PiperOrigin-RevId: 356805609
2021-02-17 06:45:07 -08:00
haodong
0d0c90b9ef Updated string translations.
PiperOrigin-RevId: 354978993
2021-02-01 11:03:44 -08:00
Mao
8f77050a25 [BottomSheetBehavior] Remove duplicate state from BottomSheetBehavior#getState doc.
Resolves https://github.com/material-components/material-components-android/pull/1927

GIT_ORIGIN_REV_ID=50d11909b926457822ab310f1d4316aa0e3a0908
PiperOrigin-RevId: 350785062
2021-01-08 14:08:39 -05:00
cketcham
c15139a5c3 [BottomSheet] Automatically enable insets for ThemeOverlay style
Because the BottomSheet could be shown under the navigation bar if it's transparent or translucent, it's best to ensure insets are added. If no insets are added, views can end up behind the navigation bar which prevents any interaction.

PiperOrigin-RevId: 348470697
2021-01-06 13:28:56 -05:00
cketcham
c574e9ea23 [BottomSheet] Add flag to opt in to edge to edge behavior rather than only relying on the navigationBarColor
PiperOrigin-RevId: 347387288
2020-12-14 15:08:19 -05:00
cketcham
b1812b9a6b Internal Change
PiperOrigin-RevId: 347042445
2020-12-11 14:47:53 -05:00
cketcham
3037cf046c Automated g4 rollback of changelist 343006492
PiperOrigin-RevId: 347038837
2020-12-11 14:45:45 -05:00
cketcham
b163458a3a [BottomSheet] Updates the way BottomSheet handles insets
This updates ThemeOverlay styles to prevent drawing a transparent nav bar and updates BottomSheetBehavior and BottomSheetDialog to handle insets correctly so content isn't drawn behind the status bar or navigation bar.

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

PiperOrigin-RevId: 343006492
2020-11-18 10:40:16 -05:00
dniz
9d1d9773cd [BottomSheet] Added string translations for i18n / l10n
PiperOrigin-RevId: 334800004
2020-10-01 11:29:12 -04:00
marianomartin
e944d1b2a6 [BottomSheet] Fixed issue where peekHeight is more than the height of the contents
PiperOrigin-RevId: 329722448
2020-09-02 13:29:54 -04:00
Material Design Team
d30f4d2d27 [BottomSheet] Changed DialogFragment import to package qualifier in javadoc.
PiperOrigin-RevId: 329011683
2020-08-28 18:09:02 -04:00
connieshi
db4275fbd3 [a11y][Bottomsheet] Add custom action to drag bottomsheet half expanded.
PiperOrigin-RevId: 326237250
2020-08-12 14:17:36 -04:00
dniz
0df77248d5 [BottomSheet] Changed bottom gesture inset handling to ensure a minimum peek height with a buffer built in, instead of always adding the inset to the peek height (when gesture nav is enabled)
PiperOrigin-RevId: 325866040
2020-08-11 14:41:15 -04:00
Mattia
38216643d6 [BottomSheet] Added missing defensive checks to viewDragHelper calls
Resolves https://github.com/material-components/material-components-android/issues/1295
Resolves https://github.com/material-components/material-components-android/pull/1392

GIT_ORIGIN_REV_ID=cadca3f7e20c387562ab8088227f62f4cd6a40de
PiperOrigin-RevId: 323870916
2020-07-30 00:19:39 -04:00
dniz
96674d59ab [BottomSheet] Fixed NullPointerException when calling updatePeekHeight with null viewRef
PiperOrigin-RevId: 323107185
2020-07-27 13:21:54 -04:00
dniz
9fa9f1e8ea [BottomSheet] Updated gesture inset bottom to be saved in separate field to fix compounding peek height issue
Follow up for https://github.com/material-components/material-components-android/issues/1472

PiperOrigin-RevId: 323079427
2020-07-27 13:21:20 -04:00
marianomartin
049ad022a6 Delete components build.gradle files
PiperOrigin-RevId: 320944144
2020-07-15 09:38:31 -07:00
hunterstich
b93042df2c [BottomSheet] Updated a11y focus to move to bottom sheet when expanded and siblings are hidden from a11y services.
PiperOrigin-RevId: 320631879
2020-07-10 11:53:10 -07:00
dniz
7b620035a7 [Bottom Sheet] Updated peek height gesture inset behavior to only add extra inset if necessary
Previously on Q the peek height would have the bottom gesture inset size added to it regardless of whether edge to edge mode or gesture navigation were enabled. Now the extra inset will only be added if it is needed due to a system gesture conflict, in order to give the user some space to drag the sheet.

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

PiperOrigin-RevId: 320606747
2020-07-10 11:47:27 -07:00
marianomartin
555356b03f Internal cleanup
PiperOrigin-RevId: 318134343
2020-06-26 14:06:52 -04:00
Material Design Team
342ea9ad25 Internal cleanup
PiperOrigin-RevId: 317147378
2020-06-19 13:42:35 -04:00
Material Design Team
76ffe35fef Cleanup
PiperOrigin-RevId: 313865830
2020-06-01 16:52:06 -04:00
Mygod
aa8042f498 [BottomSheet] Make touch_outside unfocusable
Resolves https://github.com/material-components/material-components-android/pull/974

GIT_ORIGIN_REV_ID=682a8b7ac7eb4bcdc238e04c14349b7beb4a8185
PiperOrigin-RevId: 304632071
2020-04-06 12:31:53 -07:00
melaniegoetz
4e28d9c916 Adjust BottomSheet peek height based on insets
PiperOrigin-RevId: 303819564
2020-04-03 08:44:46 -07:00
hunterstich
dce680b91a Fix BottomSheet java doc lint errors
PiperOrigin-RevId: 300605854
2020-03-13 11:13:06 -04:00
melaniegoetz
2a188e507a Change Theme.MaterialComponents.BottomSheetDialog to use new bottomSheet style
Fixes: https://github.com/material-components/material-components-android/issues/1086
PiperOrigin-RevId: 299402955
2020-03-09 09:25:30 -07:00
melaniegoetz
d0f13768b5 Make @style/Widget.MaterialComponents.BottomSheet public
PiperOrigin-RevId: 299139774
2020-03-05 13:11:40 -08:00
cketcham
2cb8909027 Add attributes from BottomSheetBehavior to public.xml
PiperOrigin-RevId: 293841078
2020-02-10 09:56:42 -05:00
Guillermo Mazzola
7ef37a05dd [BottomSheetBehavior] Resolving behavior_expandedOffset as a dimen
Using an integer will remain allowed, however using a dimen will be preferred.

Resolves https://github.com/material-components/material-components-android/pull/836

GIT_ORIGIN_REV_ID=4a02d95855569a076e5ee7a682ea5e8c9988eab9
PiperOrigin-RevId: 293623878
2020-02-06 17:25:57 -05:00
Material Design Team
dc4efe78d9 Make draggable true by default - so it will be true when using Empty Constructor as well
PiperOrigin-RevId: 290121017
2020-01-17 13:02:36 -05:00
ethanhsuhsu
6c1b620565 [BottomSheetDialog] Removed existing content during each setContentView
Resolves https://github.com/material-components/material-components-android/pull/873
Resolves https://github.com/material-components/material-components-android/issues/869

GIT_ORIGIN_REV_ID=7528e645a033c00dee0eac03237eb6d87aa9d002
PiperOrigin-RevId: 288762766
2020-01-08 14:10:39 -08:00
Material Design Team
5b4ea9c966 [BottomSheetBehavior] Add an ability to prevent dragging to expand/collapse the BottomSheet
PiperOrigin-RevId: 288710272
2020-01-08 12:10:25 -08:00
Material Design Team
67fc0c9ff8 Allow collapsed bottom sheet to settle to half expanded state on dragging up.
PiperOrigin-RevId: 286554369
2019-12-21 08:48:14 -05:00
melaniegoetz
e0578295e1 Update BottomSheet to have a singular SettleRunnable
Resolves https://github.com/material-components/material-components-android/issues/516

PiperOrigin-RevId: 283802793
2019-12-05 14:50:09 -05:00
Material Design Team
c47e6a4e3f Set threshold for hiding the bottom sheet so that dragging it down doesn't accidently dismiss it.
PiperOrigin-RevId: 274646607
2019-10-21 10:22:32 -04:00
ldjesper
60da1489fd Provide users with more control over a11y handling with BottomSheet
Resolves https://github.com/material-components/material-components-android/issues/519

Update the catalog to demonstrate usage

PiperOrigin-RevId: 273757779
2019-10-10 15:51:39 -04:00
ldjesper
8b90f02f2b Remove unreleased deprecated method BottomSheetBehavior.getBottomSheetCallback before release
PiperOrigin-RevId: 272934464
2019-10-04 15:32:08 -04:00
ldjesper
747ad12725 Maintain API backwards compatability for BottomSheetBehavior from 1.0.0 by adding a Deprecated constructor.
PiperOrigin-RevId: 272683597
2019-10-03 15:42:38 -04:00