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

2 Expandable Items inside each other withOnlyOneExpandedItem #1692

Closed
DasserBasyouni opened this issue Jan 7, 2017 · 4 comments
Closed

2 Expandable Items inside each other withOnlyOneExpandedItem #1692

DasserBasyouni opened this issue Jan 7, 2017 · 4 comments
Assignees
Labels

Comments

@DasserBasyouni
Copy link

DasserBasyouni commented Jan 7, 2017

result.getAdapter().withOnlyOneExpandedItem(true);
Is not working with the 2nd level of expandable items, It is working for all expandable items including the 1st level of them, So on expanding the 2nd inside-ed item it collapse the 1st level one

even using this method
if(previousExpandableItemPosition != position) { result.getAdapter().collapse(previousExpandableItemPosition); previousExpandableItemPosition = position; }
bugged on the 3rd dirffrerent item of 2nd position

for more explanation
Expandable item 1 --> "1st level"
Expandable item 2 -------> "2nd level"
Normal item 3 -----------------> "3rd level"

the method of withOnlyOneExpandedItem needs to be customized with .withLevel()

@mikepenz
Copy link
Owner

mikepenz commented Jan 8, 2017

@DasserBasyouni the withOnlyOneExpandedItem was not created to work for deeper hierarchies.
If you want to collapse others but allow the single hierachy you will have to handle this manually.

@mikepenz mikepenz self-assigned this Jan 8, 2017
@DasserBasyouni
Copy link
Author

sorry for the stupid question but will you tell me how, I have tried and searched so much

@mikepenz
Copy link
Owner

mikepenz commented Jan 8, 2017

@DasserBasyouni the MaterialDrawer's internals depend on the FastAdapter, so everything which is true for the FastAdapter is true for the MaterialDrawer

https://github.com/mikepenz/FastAdapter

You can get the FastAdapter via Drawer.getAdapter(). In general you will have to listen for the click event. and collapse items which are not inside the current hierarchy.
So you can get the current expanded elements via the FastAdapter.
And the FastAdapter also has the methods which allow you to collapse an item.

The general complexity here is that nested collapsable hierarchies are not too easy to handle as many aspects have to be considered.

@DasserBasyouni
Copy link
Author

thank you so much, appreciate your reply

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

No branches or pull requests

2 participants