expandable-recycler-view icon indicating copy to clipboard operation
expandable-recycler-view copied to clipboard

Specify expansion mode for adapter

Open girubhai opened this issue 8 years ago • 6 comments

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 avatar Jan 12 '16 11:01 girubhai

@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 avatar Jan 12 '16 18:01 dgreenhalgh

@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; }

girubhai avatar Jan 16 '16 06:01 girubhai

Re-opening this issue to track progress on a collapse mode feature

dgreenhalgh avatar Mar 29 '16 16:03 dgreenhalgh

@girubhai I had implement this Api https://github.com/HuaJianJiang/ExpandableRecyclerView you can see my lib refer to this lib,thanks!

janjandev avatar Oct 16 '16 19:10 janjandev

Did you add the mode for only one parent expansion? If Yes how to use it?

benevolent13 avatar Mar 01 '17 07:03 benevolent13

No this feature has not been added yet. This issue is being used to track that effort.

paul-turner avatar Mar 02 '17 21:03 paul-turner