Cutta / TagView

Android TagView-HashTagView
Apache License 2.0
490 stars 93 forks source link

Supporting drag and drop on tags #47

Closed ghost closed 6 years ago

ghost commented 6 years ago

Hi, I am just getting on board with the library. Would like to know if there is any way to drag and drop tags from one TagView to another. My use case is to create a tag filter using the tags from the tag view. Thanks, Prasanna

Cutta commented 6 years ago

The official documentation for drag and drop says "..you can allow your users to move data from one View to another.." I have no experience with "drag and drop" but I know you can drag and drop any view. TagView extends from RelativeLayout which is extended from View class. So you can. but it is not this library's aim. May these links will useful for you. https://developer.android.com/guide/topics/ui/drag-drop.html https://www.tutorialspoint.com/android/android_drag_and_drop.htm

ghost commented 6 years ago

Actually I am not trying to drag and drop the TagView but the tags in the view. The TagView is excellent in how it works but the Tag class that is implemented is not a view hence I am not able to drag / drop it. If it is possible to make the Tag class extend a View then drag and drop should be possible.

PS. I tried dragging the tag using a OnTouch listener on the view but it gives a native android error.

Cutta commented 6 years ago

But Tag class is jus for hold the properties (id,color,text, etc. ), It would be pointless extend Tag class from View class. Sorry, I can't understand you.

ghost commented 6 years ago

Yes these are the attributes of the tag. If the Tag class is not a view then it cannot be a child of a container but only a drawable as in the case of TagView. Hence drag / drop, animation etc will not be possible on the tag itself.

ghost commented 6 years ago

Have done the implementation yesterday by using tag longClickListener with remove and add from one TagView container to the other. This works but will not be as elegant as drag / drop with animation.

Thanks, Prasanna