-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
[FastAdapter Branch] Sometimes subitems are duplicated in the main list #926
Comments
@justjanne could you please add the code how you generate those items? |
This is inside the DemoActivity class I use to test the drawer: public static class Parent extends PrimaryDrawerItem {
public Parent(String name, List<IDrawerItem> children) {
super();
withName(name);
withSubItems(children);
}
}
public static class Child extends SecondaryDrawerItem {
public Child(String name) {
super();
withName(name);
}
}
static final ArrayList<IDrawerItem> LIST = new ArrayList<>(Arrays.asList(
new Parent("Freenode", Arrays.asList(
new Child("##political_chat"),
new Child("##politics"),
new Child("#amarok"),
new Child("#android-dev"),
new Child("#kde"),
new Child("#quassel")
)),
new Parent("HackInt", Arrays.asList(
new Child("#32c3"),
new Child("#33c3"),
new Child("#ffki"),
new Child("#toppoint"),
new Child("#voc-lounge")
)),
new Parent("QuakeNet", Arrays.asList(
new Child("#frozen"),
new Child("#yepityha"),
new Child("gal"),
new Child("NK33"),
new Child("Sapphi"),
new Child("staffehn"),
new Child("voluhy")
))
));
protected void onCreate(Bundle savedInstanceState) {
// Here I left out some initialization stuff
drawer = new DrawerBuilder()
.withActivity(this)
.withToolbar(toolbar)
.withHasStableIds(true)
.withDrawerItems(LIST)
.withAccountHeader(header)
.withOnDrawerItemClickListener((view, position, drawerItem) -> {
if (drawerItem != null) {
if (((ICollapsible) drawerItem).getSubItems() != null) {
drawer.getAdapter().toggleCollapsible(position);
} else {
// Navigate there
}
return true;
}
return false;
})
.build();
} All very plain, very simple code, nothing advanced yet. |
just tried it. can't reproduce it with the following items ArrayList<IDrawerItem> LIST = new ArrayList<IDrawerItem>(Arrays.asList(
new Parent("1. Freenode", Arrays.<IDrawerItem>asList(
new Child("1.2.1. ##political_chat"),
new Child("1.2.2. ##politics"),
new Child("1.2.3. #amarok"),
new Child("1.2.4. #android-dev"),
new Child("1.2.5. #kde"),
new Child("1.2.6. #quassel")
)),
new Parent("2. HackInt", Arrays.<IDrawerItem>asList(
new Child("2.2.1. #32c3"),
new Child("2.2.2. #33c3"),
new Child("2.2.3. #ffki"),
new Child("2.2.4. #toppoint"),
new Child("2.2.5. #voc-lounge")
)),
new Parent("3. QuakeNet", Arrays.<IDrawerItem>asList(
new Child("3.2.1. #frozen"),
new Child("3.2.2. #yepityha"),
new Child("3.2.3. gal"),
new Child("3.2.4. NK33"),
new Child("3.2.5. Sapphi"),
new Child("3.2.6. staffehn"),
new Child("3.2.7. voluhy")
))
)); add numbers so i can directly see when there are duplicates could it probably happend that there are issues with the code updating the items? |
Just had one thought. it may also can happens because the subItems do not have an |
I don’t update the items at all currently – and even if I give the items a unique identifier I’ll put the code on GitHub, wait a minute. |
you don't update them. what else do you do. do you click anything special. i can't reproduce it with the above items. |
Here’s the source: https://github.com/justjanne/TestApplication |
@justjanne thanks. i will test it now |
@mikepenz The issue seems to disappear when I remove the AccountHeader – and reappear when I add it again. |
Can you replicate the issue? |
@justjanne yes. i can replicate the issue. and i just commit and push the solution ;) |
Thanks! |
new snapshot Thanks for you help tracking down this bug ;) |
See this example: http://imgur.com/a/OMbI3
Expanded and collapsed.
For the
n
th parent item in the list, then
last children are duplicated.The text was updated successfully, but these errors were encountered: