Sep 5, 2018 · 1 min read
why not in Activity? It’s responsible for all the views anyway, just like snackbar field.
Great article btw!
Few comments about it tho:
1. Your viewholder and adapter have more boilerplate that it needs, it’s always a good idea to try to abstract it as much as possible, greate example here https://proandroiddev.com/android-data-binding-listadapter-9e72ce50e8c7
2. When you are creating view model for post item this whole class can be replaced with class extending ObservableField that takes your post object to constructor, xml can use this object directly, no need for any binding code
3. You don’t have to create mutableText bindings, plain android:text=”@{viewModel.post.title}” is all that is needed
