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

How to get adapter position with giving group position and child position? #514

Open zeroarst opened 2 years ago

zeroarst commented 2 years ago

I have group position and child position

val groupPos = 1
val childPos = 2
val packedChildPos = RecyclerViewExpandableItemManager.getPackedPositionForChild(groupPos , childPos )
val adapterPos = RecyclerViewExpandableItemManager.getPackedPositionChild(packedChildPos)

but this is incorrect. Dose anyone know what is the correct way to do it?

Also I found it is very confusing with getPackedPositionForChild and getPackedPositionChild names. Maybe should should call them packPositionForChild and unpackPositionForChild if I understand these two methods properly?

zeroarst commented 2 years ago

OK. I found it. It is in RecyclerViewExpandableItemManager's getFlatPosition