-
Notifications
You must be signed in to change notification settings - Fork 554
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for fully recursive lists (expansion, collapsing, and update) #397
Conversation
…item positions will be checked for nested expansion during update.
…e into account recursive expansions at previous subitems.
…h is not necessary since the method already traverses recursively through subitems as expansions occur. Cleaned up comments and removed unused variable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will make those changes.
@@ -4945,7 +4976,7 @@ private RestoreInfo getPendingRemovedItem(T item) { | |||
* @since 5.0.0-b1 | |||
*/ | |||
private void createRestoreSubItemInfo(IExpandable expandable, T item) { | |||
List<T> siblings = getExpandableList(expandable); | |||
List<T> siblings = getExpandableList(expandable, true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this call should return only direct siblings, so the parameter should be false
.
Because when restoring deleted items in restoreDeletedItems()
, the position is relative to the parent when addSubItem()
is called there.
for(int index = 0; index < subPosition; index++) { | ||
T tempSubItem = subItems.get(index); | ||
// Check whether item is also expandable, and expanded | ||
if(this.isExpandable(tempSubItem) && ((IExpandable) tempSubItem).isExpanded()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When isExpanded()
is called isExpandable()
is checked internally too.
// Add the current subitem | ||
subItems.add(subItem); | ||
// If expandable, expanded, and of non-zero size, recursively add sub-subItems | ||
if(this.isExpandable(subItem) && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, isExpandable()
can be removed.
Code added to support full recursion, returning all nested subchildren that are expanded and thus appropriate counts for expansion and collapse.