Open mukovozov opened 5 years ago
@mukovozov can you provide an example of the composition you're trying to build. As well as what you expect to happen. Not able to infer much from you code - it'd help if you could expand
@ValCanBuild i have created dummy project to show that behavior. Link: https://github.com/mukovozov/GroupieExpandableGroupsTest
OnClickListener was not called.
I checked out your project. I think the problem was the if (expandableGroup.itemCount != other.expandableGroup.itemCount)
. It's not the correct thing to check for.
You create a brand new ExpandableGroup
when you call your update()
function, so the correct equals
should be
override fun equals(other: Any?): Boolean {
if (this === other) return true
if (javaClass != other?.javaClass) return false
other as HeaderItem
if (identifier != other.identifier) return false
if (expandableGroup != other.expandableGroup) return false
return true
}
Does that help?
expandableGroup != other.expandableGroup
always true, because, as you said, when I call update()
I create new ExpandableGroup
.
And every ExpadandableGroup
redraw after that. I think that this is strange behavior.
Hmm, perhaps. I need to have a think about this and play with it before making a decision.
I don't want to redraw all ExpandableGroups, so i override equals in my Item as follows:
But if I change ChildrenItem and don't redraw HeaderItems I can't click on other HeaderItems.