Skip to content
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

Position must be increased by value returned from "expand" method. #592

Closed
AlexandreGorobets opened this issue Apr 11, 2018 · 5 comments
Closed

Comments

@AlexandreGorobets
Copy link

position++; //+1 Check also subItems with expanded = true

Currently in case of multilevel expanded items, they will be added more then one time to the mItems list.

@davideas
Copy link
Owner

davideas commented Apr 12, 2018

Already worked on it. No duplication.
It is similar to a recursive function, having a sub-item that is expandable will expand also its children. If not expandable the if isExpanded(item) returns false, and it goes to the next position without appending items. So no duplication.

@AlexandreGorobets
Copy link
Author

AlexandreGorobets commented Apr 12, 2018

Examlple:
level0 1
level1 1_1
level2 1_1_1
level0 2

All items 1, 1_1 and 1_1_1 marked as Expanded on adapter fill
Then I call method expandItemsAtStartUp
At first iteration ("position" == 0) after processing item 1 you will add all expanded items (1_1 and 1_1_1) to mItems list.
On next loop iteration ("position" == 1) item 1_1 will be processed and item 1_1_1 will be added to mItems again.
And this is error. "position" must be increased on size on new item that was added to mItems, because we already processed all child items recursively.

@davideas
Copy link
Owner

davideas commented Apr 12, 2018

@AlexandreGorobets, I will check again, it might be that after I added the recursive function I didn't modify the expandItemsAtStartUp() function.

@davideas davideas reopened this Apr 12, 2018
@davideas davideas added bug and removed invalid labels Apr 12, 2018
@davideas
Copy link
Owner

@AlexandreGorobets, thanks to have insisted because the function was modified initially to expand all subItems. Then I added the recursive expand function without modifying the start up function.
I will try to add also a UnitTest on it now.

Time is always limited for this open library, unfortunately.

@AlexandreGorobets
Copy link
Author

AlexandreGorobets commented Apr 12, 2018

Nice job!)
Thank you for fast response!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants