material-components-android icon indicating copy to clipboard operation
material-components-android copied to clipboard

[BottomSheetBehavior] Add internal method to disable hiding gestures

Open OxygenCobalt opened this issue 3 years ago • 1 comments

Some users of BottomSheetBehavior need to enable isHideable so that they can set a state programmatically, but still want to disable hiding in the UI, as the hiding action would represent something too destructive (Removing the currently playing song, for example). This was discussed in #2786 and a workaround proposed, but the workaround did not necessarily work in all situations, and it was largely a band-aid around the larger issue that isHideable simultaneously represents the ability for the bottom sheet to hide programmatically, and the ability to hide the bottom sheet.

This PR adds a new internal method called shouldEnableHidingGestures (a la shouldSkipHalfExpandedStateWhileDragging) that allows hiding gestures to be disabled even when isHideable is enabled. This preserves the behavior of isHideable while also allowing a escape hatch for those who need the hidden state internally, but don't want to expose such to the user.

Also see #2786.

OxygenCobalt avatar Aug 01 '22 15:08 OxygenCobalt

LGTM. I need to send it for internal review and see what other folks think though. Stay tuned.

drchen avatar Aug 02 '22 19:08 drchen

Any update on the review process for this one? @drchen

OxygenCobalt avatar Sep 02 '22 02:09 OxygenCobalt

Hi we are having some debate over the method naming so it takes a while. (Plus I'm super busy these couple of weeks..)

I hope we can get this submitted today.

drchen avatar Sep 02 '22 14:09 drchen