bento icon indicating copy to clipboard operation
bento copied to clipboard

More fine-grained control over data in ListComponent

Open zachbryant opened this issue 5 years ago • 6 comments

This commit improves the flexibility of ListComponent by enabling more fine-grained updates to the data. The return type of ListComponent.removeData(T data) now returns the int value of the index removed. Additionally a new method to insert data at a certain index in the existing data has been added. The user should be able to replace or re-insert data into the list without re-rendering the entire list to change one item.

zachbryant avatar Jul 16 '19 19:07 zachbryant

@zachbryant that would be a great addition! It seems though that this change does not take into account the presence or not of dividers. If the ListComponent has separator, then it also displays some grey line between each element. In effet, it displays some extra items, which will impact the index of the item being added. Check https://github.com/Yelp/bento/blob/master/bento/src/main/java/com/yelp/android/bento/components/ListComponent.java#L105

redwarp avatar Jul 31 '19 13:07 redwarp

bump

dwaxemberg avatar Oct 08 '19 18:10 dwaxemberg

Thanks for the reminder! Things are currently crazy at school but I'll have time to revise my request after Halloween

zachbryant avatar Oct 25 '19 22:10 zachbryant

@zachbryant bump?

redwarp avatar Feb 05 '20 11:02 redwarp

@zachbryant that would be a great addition! It seems though that this change does not take into account the presence or not of dividers. If the ListComponent has separator, then it also displays some grey line between each element. In effet, it displays some extra items, which will impact the index of the item being added. Check https://github.com/Yelp/bento/blob/master/bento/src/main/java/com/yelp/android/bento/components/ListComponent.java#L105

@redwarp I noticed that no matter what index is given, as long as the item count is correct the whole list re-renders. Not sure if that's intended.. but passing just index seems to be in line with appendData too, unless I'm missing something? Let me know and I'll change it to an adjusted index

zachbryant avatar Feb 12 '20 10:02 zachbryant

@zachbryant is this still alive?

redwarp avatar May 27 '21 11:05 redwarp