BabushkaText
BabushkaText copied to clipboard
Support for custom spans
Hi,
First of all, thanks for your library, it looks really nice. But it will be much better to give an ability to add custom spans.
Thanks.
Hey Anton, thanks for the feedback. I actually thought about adding this, but my main goal while developing this library was to completely abstract it from the idea of Spannables, and letting people attach their custom spans would kind of defeat this purpose. Since this is just a wrapper around Spannables, I guess the only way to give user 100% of the functionality of spans without having to expose them to Spannables themselves, would be to add the fews spans that the library's missing (drawables for example) and hopefully that would be enough and there wouldn't be the need to add customs spans. Unless you have a better approach of course, them I'm all ears :)
I understand your idea to hide spans, they are awful, but it's always a good idea not to limit users of the library, as you don't know what they need :) Possibly it's possible to wrap some spans with own interface and give users an ability to implement onDraw method. For sure one more important this will be adding an ability to hand click on specific pieces.
For example I want to use this textview to display "Website: \nPhone:
Adding an ability to add custom spans is the most easy way to make it possibly. Adding own interfaces is another way, but it's more complex :)
Yeah, definitely agree with being able to define click events for the different spans.