After swiping the last child item I want my parent to be removed from recyclerview , I am deleting the parent from List but its crashing because of notifydatasetchanged, how can I programmatically delete the parent?
Code:
public void onPerformAfterSwipeChildReaction(RecyclerView.ViewHolder holder, int parentPosition, int childPosition, int result, int reaction) {
final long expandablePosition = RecyclerViewExpandableItemManager.getPackedPositionForChild(parentPosition, childPosition);
final int flatPosition = mExpandableItemManager.getFlatPosition(expandablePosition);
if (reaction == RecyclerViewSwipeManager.AFTER_SWIPE_REACTION_REMOVE_ITEM) {
if (mEventListener != null) {
notifyItemRemoved(flatPosition);
mEventListener.onChildSwipedFromParent(parentPosition, childPosition);
}
}
}
And on callback of onChildSwipedFromParent(), I am checking if the child count is 0 for a parent , I am deleting the parent from the list.
Hi. Please check the issue #70, I have posted a sample code which handles the same problem. However the issue #70 is written for a bit old version of this library, so I will port it for the latest version later.
After swiping the last child item I want my parent to be removed from recyclerview , I am deleting the parent from List but its crashing because of notifydatasetchanged, how can I programmatically delete the parent?
Code:
public void onPerformAfterSwipeChildReaction(RecyclerView.ViewHolder holder, int parentPosition, int childPosition, int result, int reaction) {
final long expandablePosition = RecyclerViewExpandableItemManager.getPackedPositionForChild(parentPosition, childPosition);
final int flatPosition = mExpandableItemManager.getFlatPosition(expandablePosition);
And on callback of onChildSwipedFromParent(), I am checking if the child count is 0 for a parent , I am deleting the parent from the list.