Closed Vavassor closed 5 years ago
@connyduck still relevant? Did you decide against it?
Well I would like Tusky to be quite similar to the web, and this is definitely something we should do, but it doesn't have any priority.
I thought this might not be too complicated to do so I checked the code a bit but I couldn’t find where toot displaying is done. Do you think it would be easy to do for someone not familiar with the code base? I’d like to have some pointers, and try to do that if I find the time.
@ariasuni I think it's totally doable and I would like to help! I think you need to look into StatusViewHolder If you need any additional help feel free to ping me here, on Masto or in our Riot room!
(or base view holder)
So I looked a bit at the code and managed to do something really buggy. I’m not sure how I can do that properly.
Here’s what I found:
I tried to change the text of the view instead of changing the visibility of the text. So here’s what I did:
LinkHelper.setClickableText()
and retrieve it with .getText()
setText()
with one or the other text I retrieved when clicking on the buttonBut it needed some type casting (to store both texts as members of StatusBaseViewHolder
). And the different string types used in Android aren’t always clear.
Also, it only worked in threaded view and not right away, only after having clicked on the spoiler button so I guess there are other places to look at.
Edit: here’s my code.
Hey, thanks for the changes! From your code I see that you use mentions array directly which is probably the easiest and the most sane option. I'm not sure which type casting you're referring to, tbh. I looked only briefly but it looks fine and should work fine too. For the future I would recommend opening a pull request. Even if it's WIP just make it clear. It's easier to review changes and keep track of all requests there (I stumbled upon this comment by accident now).
I think you are on the right track, but this should be even simpler.
setClickableText
method alone, create a new one that takes a TextView
, the mentions array and a LinkListener
and build the needed Spannable in there.
This is how the website displays them. Also, it makes it clear that the post is a reply and who it's replying to without having to "show more".