miguelhincapie / CustomBottomSheetBehavior

Custom BottomSheetBehavior for Android that mimic Google Maps behavior
Apache License 2.0
915 stars 184 forks source link

Very sensitive scroll when use anchor point #15

Open marynovskyi opened 7 years ago

marynovskyi commented 7 years ago

When set anchor point - it has very sensitive scroll. It's easy to scroll to expanded state without stoping on anchored. Can I make it less sensitive or stop when use scroll to anchored state?

deividas717 commented 7 years ago

Same problem here! It should be fixed!

miguelhincapie commented 7 years ago

I have committed some changes, please look at them and tell me if it persist. The BottomSheet always has to stop on anchor point coming from collapsed or expanded mode. I'm gonna try adding a threshold when it reaches collapsed, anchor or expanded state.

deividas717 commented 7 years ago

Thank you! However I didn't noticed any changes. As an example in google maps when I drag bottom sheet from the bottom of the screen to the top without releasing finger from screen it always stops at anchor point! But in this lib if I drag bottom sheet without releasing my finger I get always STATE_EXPANDED

miguelhincapie commented 7 years ago

Yeah I know what are you talking about is like a threshold. I'm gonna add it later on this month.

vit001 commented 7 years ago

I believe my fix to Issue #26 fixes this issue as well.

miguelhincapie commented 7 years ago

@vit001 rocks! he did it

deividas717 commented 7 years ago

There are some problems: I made that when user clicks back button bottom sheet should collapse. It is working but when bottom sheet is fully expanded and when I press back button and then when I touch (just a little bit) bottom sheet it immediately expands to (ANCHOR_POINT) without any animation

vit001 commented 7 years ago

Hi - how do you collapse the bottom sheet with back button? Can you post code?

On Jan 23, 2017 10:38 AM, "deiauk" notifications@github.com wrote:

I will add video link here https://vimeo.com/200703338 There are some problems: I made that when user clicks back button bottom sheet should collapse. It is working but when bottom sheet is fully expanded and when I press back button and then when I touch (just a little bit) bottom sheet it immediately expands to (ANCHOR_POINT) without any animation (see video)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/miguelhincapie/CustomBottomSheetBehavior/issues/15#issuecomment-274577178, or mute the thread https://github.com/notifications/unsubscribe-auth/ADoGrzHW1zpkTyBKykeubEw3Kux5ZbPiks5rVPOagaJpZM4K6ngs .

vit001 commented 7 years ago

I think I know what the issue is, will fix, but please post your bottom sheet ollapse code to be sure.

On Jan 23, 2017 10:38 AM, "deiauk" notifications@github.com wrote:

I will add video link here https://vimeo.com/200703338 There are some problems: I made that when user clicks back button bottom sheet should collapse. It is working but when bottom sheet is fully expanded and when I press back button and then when I touch (just a little bit) bottom sheet it immediately expands to (ANCHOR_POINT) without any animation (see video)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/miguelhincapie/CustomBottomSheetBehavior/issues/15#issuecomment-274577178, or mute the thread https://github.com/notifications/unsubscribe-auth/ADoGrzHW1zpkTyBKykeubEw3Kux5ZbPiks5rVPOagaJpZM4K6ngs .

deividas717 commented 7 years ago

Hi, its just bottomSheetBehaviorGoogleMapsLike.setState(BottomSheetBehaviorGoogleMapsLike.STATE_COLLAPSED);

vit001 commented 7 years ago

Can you try my fork and see if it fixes the issue? If yes, I will issue a PR.

https://github.com/vit001/CustomBottomSheetBehavior/blob/master/app/src/main/java/co/com/parsoniisolutions/custombottomsheetbehavior/lib/BottomSheetBehaviorGoogleMapsLike.java

vit001 commented 7 years ago

Also, can you share your code for scrolling the bottom sheet to the top when collapsed? Thx!

deividas717 commented 7 years ago

@vit001 Great it works almost perfectly. Here's the code it's just one line bottomSheet.scrollTo(0, 0); however sometimes this method doesn't work.

deividas717 commented 7 years ago

However there's some strange behaviour. Look at this video https://vimeo.com/200729039 I think it happens when I release my finger at anchor point (try it you will see that bottomsheet never stops at anchor point)

vit001 commented 7 years ago

@deiauk I cannot reproduce the behavior (bottomsheet doesn't stop at anchor) in the demo app. Does it happen only in your app, or in the demo from this lib as well?

vit001 commented 7 years ago

@deiauk - OK I can reproduce it now. When you give enough fling velocity to fling from collapsed to expanded it will not stop at anchor. It seems mViewDragHelper.smoothSlideViewTo( child, child.getLeft(), anchor ) doesn't respect the anchor and keeps scrolling if it has enough momentum. It works if the fling velocity is small. I don't know how to fix it! It seems like a bug in ViewDragHelper. Any ideas?

miguelhincapie commented 7 years ago

mmm what if we try forcing it to check Dy or Y position, looking for anchor_point? But we need to know its a single event: scrolling from collapsed in one shot.

vit001 commented 7 years ago

I have fixed this issue in my fork, please confirm it works for you: https://github.com/vit001/CustomBottomSheetBehavior