A Music Player App to play songs from local storage, built on MVVM architecture with repository pattern and livedata. Users can play songs, keep track of recent songs, mark their favorite songs, create their own playlists and also shuffle & repeat songs.
-
LiveData & MutableLiveData for updating and listening to realtime datachanges in app. Also livedata can survive configuration changes.
-
ViewModel with ViewModelFactory to acess livedata
-
Repository as single source of truth to make Database operations
-
Coroutines to perform databse operations in background thread without blocking main thread.
-
Various Coroutine Context based on type of operation: e.g Dispatchers.Main for updaing UI in main htread and Dispatchers.IO to work in background thread.
-
Also, database dao methods are defined suspend fun methods so that they run in background thread. This work is done internally by Room library automatically.
-
Also, LiveData in ViewModel are update in viewModelScope, a Coroutine scope provided for livedata.
-
ConstraintLayout for maki device compatible ui in screen.
-
BottomSheet a material design ui component for opening a bottomsheet
-
BottomNavigationView another material design ui component for changing tabs