greenfrvr / hashtag-view

Android fully customizable widget for representing data like hashtags collection and similiar.
MIT License
337 stars 54 forks source link

Remove all tags (clear all) programmatically #37

Open dsdebastiani opened 6 years ago

dsdebastiani commented 6 years ago

Can I remove all tags programmatically?

hashtagview.removeAll()

I'm using dynamic mode and applying an for each to remove item by item. But the view refresh only once and only the first tagview is removed.

jay-quetzal commented 6 years ago

@dsdebastiani did u solve this?

dsdebastiani commented 6 years ago

Not exactly @jay-quetzal . I had to insert a new empty data and reapply the transformation to erase the tags.

fun updateData(items: ArrayList<TagObject>) {
    hashtagView.setData(items, TAG_TRANSFORM)
}

In my custom View, where the HashtagView is, I wrote a simple function that receives an array and set as new data in the HastagView component. If the array is empty, the tags will be cleared. It's not an ideal solution, but it works.

greenfrvr commented 6 years ago

@dsdebastiani Sorry for late reply, will add new method and update library soon.