trafi / anchor-bottom-sheet-behavior

BottomSheet behavior with collapsed, expanded and anchor states
Apache License 2.0
172 stars 25 forks source link

onSlide not called when peekHeight changed in COLLAPSED state #16

Closed davidbilik closed 5 years ago

davidbilik commented 5 years ago

Hello, I am switching content in BottomSheet with attached AnchorBottomSheetBehavior and each content has different peek height. It works fine if I call something like

bottomSheetBehavior.peekHeight = activeFragment.peekHeight
bottomSheetBehavior.state = AnchorBottomSheetBehavior.STATE_COLLAPSED

and the behavior is not in COLLAPSED state. However if it is COLLAPSED, the peek height changes abruptly without animation and without onSlide callback so I cannot react to this change. Is there any way how to perform animation of the peekHeight (without manual animating this property) and to make callback to fire? Thanks

justasm commented 5 years ago

Not with the current behavior. You could try temporarily switching to a different state, e.g.

state = STATE_EXPANDED
peekHeight = newPeekHeight
state = STATE_COLLAPSED

although I haven't tested if this would work.

davidbilik commented 5 years ago

It works 💪 thanks :)