h6ah4i / android-advancedrecyclerview

RecyclerView extension library which provides advanced features. (ex. Google's Inbox app like swiping, Play Music app like drag and drop sorting)
https://advancedrecyclerview.h6ah4i.com/
Apache License 2.0
5.32k stars 860 forks source link

onCheckCanDrop method issue with StaggeredGridLayoutManager and setFullSpan #508

Open isNoobDev opened 4 years ago

isNoobDev commented 4 years ago

Hi, I have a StaggeredGridLayout RecyclerView with a spanCount of 3. The last item if a footer and it's set as: (itemView.layoutParams as StaggeredGridLayoutManager.LayoutParams).isFullSpan = true

by doing so, the method onCheckCanDrop is triggered multiple times when i move an element on it. screenshot

Let's suppose I have 5 items plus the footer, when I move the 5th (index 4) item to the footer (index 5), as shown in the screenshot, the onCheckCanDrop is called several in this way:

onCheckCanDrop from 4 to 4
onCheckCanDrop from 4 to 5
onCheckCanDrop from 4 to 4
onCheckCanDrop from 4 to 5
onCheckCanDrop from 4 to 4
onCheckCanDrop from 4 to 5
onCheckCanDrop from 4 to 4
onCheckCanDrop from 4 to 5
onCheckCanDrop from 4 to 4
onCheckCanDrop from 4 to 5
onCheckCanDrop from 4 to 4
onCheckCanDrop from 4 to 5
onCheckCanDrop from 4 to 4
onCheckCanDrop from 4 to 5
onCheckCanDrop from 4 to 4
onCheckCanDrop from 4 to 5

as you can see, the draggingPosition remains the same while the dropPosition switches between 4 and 5.

This is my adapter https://pastebin.com/pSSajdfz

Thank you in advance