I am wondering if there is a best way to use LiveData and ViewModel to update RecyclerView's ViewHolders. Because in a complex ViewHolder, it is much better to let the ViewModel controls the ViewHolder to update it's UI.
Also , when the ViewHolder wants to change the source in ViewModel. It can get ViewModel and call the related change method in ViewModel. the ViewHolder only need to observe the liveData in ViewModel.
But I do not know how to write these code in the best way.
I am wondering if there is a best way to use LiveData and ViewModel to update RecyclerView's ViewHolders. Because in a complex ViewHolder, it is much better to let the ViewModel controls the ViewHolder to update it's UI. Also , when the ViewHolder wants to change the source in ViewModel. It can get ViewModel and call the related change method in ViewModel. the ViewHolder only need to observe the liveData in ViewModel. But I do not know how to write these code in the best way.