0

I'm using ListViewDraggingAnimation by DevBytes.

I'm using it twice : in one Fragment and in a nested Fragment in an other part of the app. But it displays the exact same thing.

On Lollipop 5.1 (Nexus 6) it's working perfectly fine. On my other test device, Galaxy S3 4.1.1 it's different : non-nested Fragment is working fine, but in the nested one, when I want to drag an item, it starts dragging and then, after a little move (not enough to switch with an other cell) it's going back to is previous position.

For compatibility from API 14, I'm using Support Fragment (nested classic fragments don't work below api 17)

I searched for solutions but didn't find something. Has someone already faced this issue and solved it ?

Any hints? Thanks :)

milcaepsilon
  • 272
  • 3
  • 16

1 Answers1

0

Ok, after looking the code and logs with attention, finally I found the solution !

The problem was that the motionEvent was cancel by throwing it to the parent View.

So, in the DynamicListView, I modify the onTouchEvent function by adding this.requestDisallowInterceptTouchEvent(true); in the MotionEvent.ACTION_MOVE case.

From the doc :

requestDisallowInterceptTouchEvent (boolean disallowIntercept)
Called when a child does not want this parent and its ancestors to intercept touch events with onInterceptTouchEvent(MotionEvent).
This parent should pass this call onto its parents. This parent must obey this request for the duration of the touch (that is, only clear the flag after this parent has received an up or a cancel.

Hope this can help others :)

milcaepsilon
  • 272
  • 3
  • 16