EverythingMe / overscroll-decor

Android: iOS-like over-scrolling effect applicable over almost all scrollable Android views.
BSD 2-Clause "Simplified" License
2.85k stars 397 forks source link

Not registering onClick in RecyclerView #24

Open IonAalbers opened 8 years ago

IonAalbers commented 8 years ago

Using the VerticalOverScrollBounceEffectDecorator on a RecyclerView causes the first touch over the overscroll to be ignored.

Reproduce steps:

When debugging, it seems like the onTouchListener of the Recyclerview in the OverScrollBounceEffectDecoratorBase is called. This calls the UP on the IdleState and returns false.

But in a normal usecase, the onTouchListener shouldn't be called when a item is clicked. So it seems like the first touch after the overscroll goes to the children instead of the RecyclerView items.

Currently using: new VerticalOverScrollBounceEffectDecorator(new RecyclerViewOverScrollDecorAdapter(mRecyclerView), 1.8f, VerticalOverScrollBounceEffectDecorator.DEFAULT_TOUCH_DRAG_MOVE_RATIO_BCK, VerticalOverScrollBounceEffectDecorator.DEFAULT_DECELERATE_FACTOR);

mardann commented 8 years ago

I'v encountered a similar problem while implementing OverScrollDecoratorHelper.setUpOverScroll

tzrgaga commented 8 years ago

@mardann Hi buddy,how do you solve this issue?

d4vidi commented 8 years ago

Hey all, I've had numerous reports that sound similar. I'll have to look into this exact scenario and see for myself.

d4vidi commented 8 years ago

Hey @IonAalbers. Regarding -

No onclick is notified.

I could really use some more info on how you're registering the on-click listener - seeing that with recycler-view this isn't always trivial. Could you please throw in a snippet?

Also, just to see that I understand correctly - what is the bottom-line bug you're having? is it item-level click-listeners not being called when they should?

Would greatly appreciate any further info you could provide.

Thanks!

notnotme commented 7 years ago

Hi, I have a similar problem with a RecyclerView. The bug is when I try to overscroll then let the view going back to it's normal position by removing the touch point on screen. After such a gesture the items in the RecyclerView are no longer clickable (but if I scroll manually they become clickable again).

To handle the click event we use an interface that we pass to the Adapter and click listener is set to the root of each child of the RecyclerView in the onCreateViewHolder method. When user click, we call the adapter's interface onClick.

Riflin commented 7 years ago

Hi! Any progress on this issue? I'm facing the same problem, and what I have found debugging is what @IonAalbers said: In a normal case (before doing the overscroll), the onTouch callback isn't called and the onClick method of the item in the recyclerView is called as expected, but if you have overscrolled, then the onTouch event is triggered, and nothing else happens. You have to click again to get the onClick method of the item called.

I'm trying to solve the issue by myself, but it seems harder than I thought :(

Thanks in advance!

d4vidi commented 7 years ago

None yet, but I should get to it by next week; In any case, this doesn't sound difficult to get fixed, so try to stay tuned :)

d4vidi commented 7 years ago

I've solved this issue, will post a new release asap.

Riflin commented 7 years ago

Great! Thanks a lot! :D

hyunw-oh commented 7 years ago

Great. I am gratefully using your library. When do you think this problem resolved version will be posted? Thank you!

d4vidi commented 7 years ago

@hyunw-oh Fix is ready. Unfortunately I've had very little time lately for working on this project + some issues with bintray. I'll get the fixed version published by next week.

d4vidi commented 7 years ago

Released version 1.0.4 - please give it a try!!!

hyunw-oh commented 7 years ago

고마워요, Thank you, but the Overscrolled last item is pressed unintentionally.

d4vidi commented 7 years ago

Are you positive that you updated to 1.0.4? I've double & triple checked this!

d4vidi commented 7 years ago

@hyunw-oh I would love additional feedback. wdyt?

hyunw-oh commented 7 years ago

I',m sorry, I think u'r solution is good. but it's not friendly to me. in IOS, Far Overscrolled Item won't be clicked. but your solution allow 'click' (in overscolling) therefore first time, it's confusing to me.

d4vidi commented 7 years ago

The definitely a Ux point for me to consider. Thanks!!!