https://kotlinlang.org logo
Title
r

raghunandan

04/23/2022, 3:16 PM
How to achieve @ mentions like twitter and facebook similar to https://github.com/linkedin/Spyglass using compose. Any suggestions or ideas?
One option is to use android view in compose. So i can use the same library view in compose as well
a

andrew

04/24/2022, 3:38 PM
Really shouldn't be hard to implement tokenization manually, I think the JetChat sample has something for that
r

raghunandan

04/24/2022, 3:39 PM
Ok. Will look into it. Gotta give it a try.
n

Nick

04/26/2022, 2:12 AM
I did this. It was one of the most fun tasks I've worked on with Compose. I used a core text field and used VisualTransformation. I suggest looking at how that works and rendering everything bold first, then render portions of the text bold next. Additionally, it might be fun to code than visually confirm it works, we were actually able to develop faster by writing this feature in unit tests first. https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/VisualTransformation
r

raghunandan

04/28/2022, 1:59 AM
Thanks i did exactly that. It was little difficult to actually figure out that i need to use transformation. Just one question - is it possible to delete the entire names that are spans on back press in soft keyboard rather than a character at a time.
Something to do with offsetmapping??
n

Nick

05/01/2022, 2:12 PM
I don't remember how I did it but I did.
It is with the transformations again.
r

raghunandan

05/01/2022, 2:16 PM
Hmm. Need to explore this.
n

Nick

05/04/2022, 1:32 PM
Write unit tests to test the interface. In my base I was looking for {{userid-xxx}}. If it detected that the last } got deleted then I'd return the entire backing string before the first {
r

raghunandan

05/08/2022, 11:15 AM
Jetchat does not have this feature.
In my case i have range start and end which is use to style replaced text on drop down selection. But when user deletes the range is out of bound. Eg. @abc is colored 4 chars. Range is from 0-3. So delete c my range is till 0-3. So basically beed to delete the span from span list of this happens. I think having some of delimeter to figure out start and end of span should help.
a

andrew

05/08/2022, 10:12 PM
They usually have an internal representation that gets replaced
Like @<123456>
And then you map it to the ID of the user, snag their information, etf
Etc
r

raghunandan

05/09/2022, 5:31 PM
hmm. got it