expandable-recycler-view
expandable-recycler-view copied to clipboard
Specify expansion mode for adapter
Edited from original submission: This issue is tracking the ability to give a specialized collapse/expand mode. For example, that only one item can be expanded at a time, or only one can be collapsed at a time.
Original title: Is there any method to collapse other items?
Original body: I found method as "mAdapter.collapseAllParents();" to collapse all items but is there any method to collapse other items when expanding one item.
@girubhai There's currently a story that may be of some help to you here: #90. We don't currently have an official way of doing this rolled into the library, but it's something we've discussed.
Let's use this story to track this feature request going forward.
@dgreenhalgh Thanks to reply,For the time being I did use "lastExpanded" variable to find last expanded item and it working. private int lastExpanded = -1; And use it on onListItemExpanded method as
if (lastExpanded != -1) mAdapter.collapseParent(lastExpanded); // collapse previous expanded item. lastExpanded = position; // set last expanded parent position.
And in onListItemCollapsed method reset lastExpanded if same expanded parent is collapsing again as
if (position == lastExpanded) { lastExpanded = -1; }
Re-opening this issue to track progress on a collapse mode feature
@girubhai I had implement this Api https://github.com/HuaJianJiang/ExpandableRecyclerView you can see my lib refer to this lib,thanks!
Did you add the mode for only one parent expansion? If Yes how to use it?
No this feature has not been added yet. This issue is being used to track that effort.