You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using FastAdapterDiffUtil to update current list of items. The adapter which uses ExpandableExtension and has withIsExpanded set before putting into DiffUtil
Nothing new when updating the list: FastAdapterDiffUtil.set( expandableAdapter.getItemAdapter(), items, new ExpandedDiffCallback(), false );
Also I need to manually control expanded items state so my ISubItem has isAutoExpanding set to false
Stacktrace: java.lang.IndexOutOfBoundsException: Index: 2, Size: 2 at java.util.ArrayList.get(ArrayList.java:437) at com.mikepenz.fastadapter.utils.DefaultItemListImpl.get(DefaultItemListImpl.java:29) at com.mikepenz.fastadapter.utils.DefaultItemListImpl.get(DefaultItemListImpl.java:15) at com.mikepenz.fastadapter.adapters.ModelAdapter.getAdapterItem(ModelAdapter.java:265) at com.mikepenz.fastadapter.FastAdapter.getItem(FastAdapter.java:856) at com.mikepenz.fastadapter.expandable.ExpandableExtension.notifyAdapterItemRangeChanged(ExpandableExtension.java:154) at com.mikepenz.fastadapter.FastAdapter.notifyAdapterItemRangeChanged(FastAdapter.java:1364) at com.mikepenz.fastadapter.commons.utils.FastAdapterDiffUtil$FastAdapterListUpdateCallback.onChanged(FastAdapterDiffUtil.java:191) at android.support.v7.util.BatchingListUpdateCallback.dispatchLastEvent(BatchingListUpdateCallback.java:65) at android.support.v7.util.BatchingListUpdateCallback.onRemoved(BatchingListUpdateCallback.java:94) at android.support.v7.util.DiffUtil$DiffResult.dispatchRemovals(DiffUtil.java:791) at android.support.v7.util.DiffUtil$DiffResult.dispatchUpdatesTo(DiffUtil.java:713) at com.mikepenz.fastadapter.commons.utils.FastAdapterDiffUtil.set(FastAdapterDiffUtil.java:57) at com.mikepenz.fastadapter.commons.utils.FastAdapterDiffUtil.set(FastAdapterDiffUtil.java:75)
Steps to reproduce:
List with two expandable items everyone of each has one child
Expand the first parent. Update the list with new items.
Calling collapse before FastAdapterDiffUtil.set solves the problem. Checked out previous implementation and noticed that in v 2.x callapse was caled at the beginning (before calculating diff result). Is this a bug? Is there a build-in way to persist expandable state after using diff utils ?
Details
[ 3.2.2@aar] Used library version
[27.0.2 ] Used support library version
[26.0.2 ] Used gradle build tools version
[3.0.1] Used tooling / Android Studio version
[] Other used libraries, potential conflicting libraries
@michalbujalski sorry the FastAdapterDiffUtil can not handle expendables. if they are expanded.
I think you are right that we require a collapse before that again. as I don't think there is a nice solution to maintain the current open state. (other than collapsing, remembering, restoring it.
About this issue
I'm using
FastAdapterDiffUtil
to update current list of items. The adapter which usesExpandableExtension
and haswithIsExpanded
set before putting into DiffUtilNothing new when updating the list:
FastAdapterDiffUtil.set( expandableAdapter.getItemAdapter(), items, new ExpandedDiffCallback(), false );
Also I need to manually control expanded items state so my
ISubItem
hasisAutoExpanding
set tofalse
Stacktrace:
java.lang.IndexOutOfBoundsException: Index: 2, Size: 2 at java.util.ArrayList.get(ArrayList.java:437) at com.mikepenz.fastadapter.utils.DefaultItemListImpl.get(DefaultItemListImpl.java:29) at com.mikepenz.fastadapter.utils.DefaultItemListImpl.get(DefaultItemListImpl.java:15) at com.mikepenz.fastadapter.adapters.ModelAdapter.getAdapterItem(ModelAdapter.java:265) at com.mikepenz.fastadapter.FastAdapter.getItem(FastAdapter.java:856) at com.mikepenz.fastadapter.expandable.ExpandableExtension.notifyAdapterItemRangeChanged(ExpandableExtension.java:154) at com.mikepenz.fastadapter.FastAdapter.notifyAdapterItemRangeChanged(FastAdapter.java:1364) at com.mikepenz.fastadapter.commons.utils.FastAdapterDiffUtil$FastAdapterListUpdateCallback.onChanged(FastAdapterDiffUtil.java:191) at android.support.v7.util.BatchingListUpdateCallback.dispatchLastEvent(BatchingListUpdateCallback.java:65) at android.support.v7.util.BatchingListUpdateCallback.onRemoved(BatchingListUpdateCallback.java:94) at android.support.v7.util.DiffUtil$DiffResult.dispatchRemovals(DiffUtil.java:791) at android.support.v7.util.DiffUtil$DiffResult.dispatchUpdatesTo(DiffUtil.java:713) at com.mikepenz.fastadapter.commons.utils.FastAdapterDiffUtil.set(FastAdapterDiffUtil.java:57) at com.mikepenz.fastadapter.commons.utils.FastAdapterDiffUtil.set(FastAdapterDiffUtil.java:75)
Steps to reproduce:
List with two expandable items everyone of each has one child
Expand the first parent. Update the list with new items.
Calling
collapse
beforeFastAdapterDiffUtil.set
solves the problem. Checked out previous implementation and noticed that in v 2.xcallapse
was caled at the beginning (before calculating diff result). Is this a bug? Is there a build-in way to persist expandable state after using diff utils ?Details
Checklist
The text was updated successfully, but these errors were encountered: