marinat / tree-view-list-android

Automatically exported from code.google.com/p/tree-view-list-android
BSD 2-Clause "Simplified" License
0 stars 0 forks source link

addAfterChild adds before 'afterChild' instead of after #19

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
addAfterChild(final T parent, final T newChild, final T afterChild),
when afterChild is not null, adds the new child before afterChald and not after.

As I understand it (I only looked at the code for this method so I don't know 
if there is other implications) the line:

final InMemoryTreeNode<T> added = node.add(
     index == -1 ? node.getChildrenListSize() : index, newChild, 
     visibility);

should be:

final InMemoryTreeNode<T> added = node.add(
     index == -1 ? node.getChildrenListSize() : index+1, newChild,
     visibility);

So the index of the added node will be 1 after 'afterChild' so it will appear 
after.

Original issue reported on code.google.com by nicola.l...@googlemail.com on 11 Jan 2012 at 12:40

GoogleCodeExporter commented 9 years ago
This issue was closed by revision 51409b85214d.

Original comment by jarek.po...@polidea.pl on 11 Jan 2012 at 8:10

GoogleCodeExporter commented 9 years ago
Thanks. Good Catch!

Original comment by jarek.po...@polidea.pl on 11 Jan 2012 at 8:11