I have started basic implementation of MVVM for a User selection screen. I'm not sure how best to handle selecting of a user to adhere to best practices.
LogInActivity contains UsersFragment. UsersFragment has an associated ViewModel (UsersFragmentVM). UsersFragmentVM handles the exposing of Users. The UsersFragment displays them to the user. When the user clicks on a user, what should be the flow of events?
My first thought was to have an observable in UsersFragment that LogInActivity could subscribe to and receive a User object however I'm not confident the Views should be communicating?
So I thought maybe the ViewModel should receive the event from View (user clicking), but then how does that event get to LogInActivity? A separate events ViewModel that both LogInActivity and UsersFragmentVM implement?
Similar to Sharing data between fragments using new architecture component ViewModel however that answer uses LiveData. I'm using generic MVVM with Rx to get away from Android dependency for easier testing and portability. Unless there is a general recommended way of sharing ViewModels?