If you need a lot of logic to bind your view holder, where do people usually put it?
d
denis.shakinov
08/21/2017, 9:42 AM
in presenter i guess
denis.shakinov
08/21/2017, 9:43 AM
btw, what kind of logic do you mean?
p
peasee
08/21/2017, 9:47 AM
Like, for instance I want to ellipsis text if it's more than 500 characters, and check what the time before printing a date, so I can format it better. My viewholder just seems to be getting longer and longer
a
arekolek
08/21/2017, 9:50 AM
I’d consider preparing the data once, instead of computing it every time for every item during bind, making the binding simple again
p
peasee
08/21/2017, 9:51 AM
Interesting... Like if it was ellipsising the text would I put the whole array through a function that checked for textsize etc..
d
denis.shakinov
08/21/2017, 9:53 AM
formatting date and ellipsising text is a view logic you can keep it in a viewholder, just avoid heavy computating operations in bind method as @arekolek mentioned