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

[BottomSheetBehavior] Expose slide offset calculation

Open OxygenCobalt opened this issue 3 years ago • 0 comments

Is your feature request related to a problem? Please describe. I have several runtime transitions dependent on the offset of my bottom sheet. However, these transitions need to be initialized on startup, something that can't be provided by BottomSheetCallback as it does not fire on startup. Since making that callback fire on startup would break compatibility, instead I want a way to get the slide offset so I can initialize the components myself.

Describe the solution you'd like A method (calculateSlideOffset) that returns the current slide offset of the bottom sheet. If the sheet is not laid out, it can just be 0.

Describe alternatives you've considered The only other option is either reflecting for the private attributes required to find the slide offset and calculating it myself (Something I dislike), or making the callback fire on startup (Which again, would not be backwards compatible)

OxygenCobalt avatar Jul 28 '22 21:07 OxygenCobalt