Skip to content

I20181029-1800

@Bananeweizen Bananeweizen tagged this 29 Oct 20:34
The tree is based on a content provider, which in turn uses the model,
and that has a change listener. When the change listener is triggered,
then under some conditions the view adds new items directly to the tree
view. This is wrong, since at all other places the content provider is
used, and the tree view is refreshed from the content provider.

This also explains the wrong identical entries at the end of the tree:
Whenever an item is added to the tree instead of to the content
provider, we now have N+1 items, where the content provider has N
elements. The next refresh() causes N items to be refreshed, and the
last item in the tree is without update. That leads to the last 2 items
having the same label. Repeat this m times, and the last m+1 items in
the tree are identical.

So to fix this, we need to avoid adding/removing items to/from the tree
manually, and instead just refresh from the content provider. That is
sufficient because the model was already updated before the change event
is triggered.

Change-Id: I3376ee23d6006226bde848ca35b93dcecaf7f14e
Signed-off-by: Michael Keppler <Michael.Keppler@gmx.de>
Assets 2
Loading