thibseisel / android-odeon

A simple but efficient music player on Android.
Apache License 2.0
69 stars 9 forks source link

Make fragments only depend on a single ViewModel #34

Closed thibseisel closed 2 years ago

thibseisel commented 2 years ago

Sharing ViewModels between multiple fragments makes it harder to reason about how components interact together. By dedicating a single ViewModel to each Fragment, each screen computes and retains its own state. State shared between multiple screens should be shared from the data layer.