Hi guys, what would be the best presentation pattern for implementing a rich text editor on Android? What do you think?
a
Anastasia Finogenova
12/12/2019, 9:55 PM
Why does a text editor differ from other apps? I think it should be mvvvm no matter what is the app you are creating unless there is some unique things to the use case (like a particular library or you can't add lifecycle dependencies )
s
stantronic
12/13/2019, 10:26 AM
I would imagine this is the kind of thing that Compose would really shine at. In the mean time, I’d second mvvm with databinding. Sounds like a complex task though.
u
ursus
12/13/2019, 8:00 PM
Well, yes MVVM/MVI ish would be best, however I'd look into diffing of the Spannables, since it can be nontrivial perf wise I think, since youd be ditching the whole String/SpananbleString every emit (every char types)
And then youre basically reimplementing compose lolz
tldr; If perf were and issue, I'd ditch immutability and keep some mutable tree structure, and handle it on main thread only to prevent threading issues, look into Dank reddit app https://github.com/saket/Dank
btw you should be handling state on main thread only anyways, if you wont wanna mess with synchronization