Closed ildar2 closed 5 years ago
@ildar2, thank you for your message. Actually that is normal because the code to move an item from a parent to another is not done in the sample App. In the implementation of the dragging event callback, we need to actually move the item in the sublist of the new parent item.
If you drag sub item out of its parent and try to collapse parent, app will crash with IndexOutOfBoundsException link to the video
Crash log:
java.lang.IndexOutOfBoundsException: Inconsistency detected. Invalid item position 7(offset:-1).state:257 androidx.recyclerview.widget.RecyclerView{26ce0f1 VFED..... ......ID 0,0-720,1224 #7f0900cb app:id/recycler_view}, adapter:eu.davidea.samples.flexibleadapter.ExampleAdapter@4b64d6, layout:eu.davidea.flexibleadapter.common.SmoothScrollLinearLayoutManager@c575357, context:android.view.ContextThemeWrapper@ac9933 at androidx.recyclerview.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:5923) at androidx.recyclerview.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5858) at androidx.recyclerview.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5854) at androidx.recyclerview.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:2230) at androidx.recyclerview.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1557) at androidx.recyclerview.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1517) at androidx.recyclerview.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:612) at androidx.recyclerview.widget.RecyclerView.dispatchLayoutStep1(RecyclerView.java:3875) at androidx.recyclerview.widget.RecyclerView.dispatchLayout(RecyclerView.java:3639) at androidx.recyclerview.widget.RecyclerView.consumePendingUpdateOperations(RecyclerView.java:1888) at androidx.recyclerview.widget.RecyclerView$1.run(RecyclerView.java:407) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:911) at android.view.Choreographer.doCallbacks(Choreographer.java:723) at android.view.Choreographer.doFrame(Choreographer.java:655) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:897) at android.os.Handler.handleCallback(Handler.java:789) at android.os.Handler.dispatchMessage(Handler.java:98) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6944) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)