Code refactor
This commit is contained in:
parent
ffa0749849
commit
061b9c90ab
24 changed files with 108 additions and 126 deletions
|
@ -31,7 +31,7 @@ object Constants {
|
|||
const val APP_TWITTER_LINK = "https://twitter.com/retromusicapp"
|
||||
const val FAQ_LINK = "https://github.com/h4h13/RetroMusicPlayer/blob/master/FAQ.md"
|
||||
const val PINTEREST = "https://in.pinterest.com/retromusicapp/"
|
||||
const val BASE_URL = "https://ws.audioscrobbler.com/2.0/"
|
||||
const val AUDIO_SCROBBLER_URL = "https://ws.audioscrobbler.com/2.0/"
|
||||
|
||||
const val IS_MUSIC =
|
||||
MediaStore.Audio.AudioColumns.IS_MUSIC + "=1" + " AND " + MediaStore.Audio.AudioColumns.TITLE + " != ''"
|
||||
|
@ -70,8 +70,8 @@ const val NOW_PLAYING_SCREEN_ID = "now_playing_screen_id"
|
|||
const val CAROUSEL_EFFECT = "carousel_effect"
|
||||
const val COLORED_NOTIFICATION = "colored_notification"
|
||||
const val CLASSIC_NOTIFICATION = "classic_notification"
|
||||
const val GAPLESS_PLAYBACK = "gapless_playback"
|
||||
const val ALBUM_ART_ON_LOCKSCREEN = "album_art_on_lockscreen"
|
||||
const val GAP_LESS_PLAYBACK = "gap_less_playback"
|
||||
const val ALBUM_ART_ON_LOCK_SCREEN = "album_art_on_lock_screen"
|
||||
const val BLURRED_ALBUM_ART = "blurred_album_art"
|
||||
const val NEW_BLUR_AMOUNT = "new_blur_amount"
|
||||
const val TOGGLE_HEADSET = "toggle_headset"
|
||||
|
@ -92,7 +92,6 @@ const val ALBUM_COVER_STYLE = "album_cover_style_id"
|
|||
const val ALBUM_COVER_TRANSFORM = "album_cover_transform"
|
||||
const val TAB_TEXT_MODE = "tab_text_mode"
|
||||
const val LANGUAGE_NAME = "language_name"
|
||||
const val DIALOG_CORNER = "dialog_corner"
|
||||
const val SLEEP_TIMER_FINISH_SONG = "sleep_timer_finish_song"
|
||||
const val ALBUM_GRID_STYLE = "album_grid_style_home"
|
||||
const val ARTIST_GRID_STYLE = "artist_grid_style_home"
|
||||
|
|
|
@ -13,7 +13,6 @@ import code.name.monkey.retromusic.fragments.artists.ArtistDetailsViewModel
|
|||
import code.name.monkey.retromusic.fragments.genres.GenreDetailsViewModel
|
||||
import code.name.monkey.retromusic.fragments.playlists.PlaylistDetailsViewModel
|
||||
import code.name.monkey.retromusic.fragments.search.SearchViewModel
|
||||
import code.name.monkey.retromusic.fragments.songs.SongsViewModel
|
||||
import code.name.monkey.retromusic.model.Genre
|
||||
import code.name.monkey.retromusic.network.networkModule
|
||||
import code.name.monkey.retromusic.repository.*
|
||||
|
@ -152,10 +151,6 @@ private val viewModules = module {
|
|||
viewModel {
|
||||
SearchViewModel(get())
|
||||
}
|
||||
|
||||
viewModel {
|
||||
SongsViewModel(get())
|
||||
}
|
||||
}
|
||||
|
||||
val appModules = listOf(mainModule, dataModule, viewModules, networkModule, roomModule)
|
|
@ -51,7 +51,8 @@ class AddToRetroPlaylist : BottomSheetDialogFragment() {
|
|||
return materialDialog(R.string.add_playlist_title)
|
||||
.setItems(playlistNames.toTypedArray()) { _, which ->
|
||||
if (which == 0) {
|
||||
CreateRetroPlaylist.create(songs).show(requireActivity().supportFragmentManager, "Dialog")
|
||||
CreateRetroPlaylist.create(songs)
|
||||
.show(requireActivity().supportFragmentManager, "Dialog")
|
||||
} else {
|
||||
lifecycleScope.launch(Dispatchers.IO) {
|
||||
val songEntities = songs.toSongEntity(playlistEntities[which - 1])
|
||||
|
|
|
@ -12,9 +12,7 @@ import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
|||
import code.name.monkey.retromusic.interfaces.MusicServiceEventListener
|
||||
import code.name.monkey.retromusic.model.*
|
||||
import code.name.monkey.retromusic.repository.RealRepository
|
||||
import kotlinx.coroutines.Deferred
|
||||
import kotlinx.coroutines.Dispatchers.IO
|
||||
import kotlinx.coroutines.async
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
class LibraryViewModel(
|
||||
|
@ -25,75 +23,95 @@ class LibraryViewModel(
|
|||
private val albums = MutableLiveData<List<Album>>()
|
||||
private val songs = MutableLiveData<List<Song>>()
|
||||
private val artists = MutableLiveData<List<Artist>>()
|
||||
private val playlists = MutableLiveData<List<Playlist>>()
|
||||
private val roomPlaylists = MutableLiveData<List<PlaylistWithSongs>>()
|
||||
private val playlists = MutableLiveData<List<PlaylistWithSongs>>()
|
||||
private val genres = MutableLiveData<List<Genre>>()
|
||||
private val home = MutableLiveData<List<Home>>()
|
||||
|
||||
val paletteColorLiveData: LiveData<Int> = paletteColor
|
||||
val homeLiveData: LiveData<List<Home>> = home
|
||||
val albumsLiveData: LiveData<List<Album>> = albums
|
||||
val songsLiveData: LiveData<List<Song>> = songs
|
||||
val artistsLiveData: LiveData<List<Artist>> = artists
|
||||
val playlisitsLiveData: LiveData<List<Playlist>> = playlists
|
||||
val roomPlaylistsLiveData: LiveData<List<PlaylistWithSongs>> = roomPlaylists
|
||||
val genresLiveData: LiveData<List<Genre>> = genres
|
||||
|
||||
init {
|
||||
viewModelScope.launch {
|
||||
loadLibraryContent()
|
||||
private fun loadLibraryContent() = viewModelScope.launch(IO) {
|
||||
fetchSongs()
|
||||
fetchAlbums()
|
||||
fetchArtists()
|
||||
fetchGenres()
|
||||
fetchHomeSections()
|
||||
fetchPlaylists()
|
||||
}
|
||||
|
||||
fun getSongs(): LiveData<List<Song>> {
|
||||
fetchSongs()
|
||||
return songs
|
||||
}
|
||||
|
||||
fun getAlbums(): LiveData<List<Album>> {
|
||||
fetchAlbums()
|
||||
return albums
|
||||
}
|
||||
|
||||
fun getArtists(): LiveData<List<Artist>> {
|
||||
fetchArtists()
|
||||
return artists
|
||||
}
|
||||
|
||||
fun getPlaylists(): LiveData<List<PlaylistWithSongs>> {
|
||||
fetchPlaylists()
|
||||
return playlists
|
||||
}
|
||||
|
||||
fun getGenre(): LiveData<List<Genre>> {
|
||||
fetchGenres()
|
||||
return genres
|
||||
}
|
||||
|
||||
fun getHome(): LiveData<List<Home>> {
|
||||
fetchHomeSections()
|
||||
return home
|
||||
}
|
||||
|
||||
private fun fetchSongs() {
|
||||
viewModelScope.launch(IO) {
|
||||
songs.postValue(repository.allSongs())
|
||||
}
|
||||
}
|
||||
|
||||
private fun loadLibraryContent() = viewModelScope.launch {
|
||||
home.value = loadHome.await()
|
||||
songs.value = loadSongs.await()
|
||||
albums.value = loadAlbums.await()
|
||||
artists.value = loadArtists.await()
|
||||
playlists.value = loadPlaylists.await()
|
||||
roomPlaylists.value = loadPlaylistsWithSongs.await()
|
||||
genres.value = loadGenres.await()
|
||||
private fun fetchAlbums() {
|
||||
viewModelScope.launch(IO) {
|
||||
albums.postValue(repository.fetchAlbums())
|
||||
}
|
||||
}
|
||||
|
||||
private val loadHome: Deferred<List<Home>>
|
||||
get() = viewModelScope.async { repository.homeSections() }
|
||||
|
||||
private val loadSongs: Deferred<List<Song>>
|
||||
get() = viewModelScope.async(IO) { repository.allSongs() }
|
||||
|
||||
private val loadAlbums: Deferred<List<Album>>
|
||||
get() = viewModelScope.async(IO) {
|
||||
repository.allAlbums()
|
||||
private fun fetchArtists() {
|
||||
viewModelScope.launch(IO) {
|
||||
artists.postValue(repository.fetchArtists())
|
||||
}
|
||||
}
|
||||
|
||||
private val loadArtists: Deferred<List<Artist>>
|
||||
get() = viewModelScope.async(IO) {
|
||||
repository.albumArtists()
|
||||
private fun fetchPlaylists() {
|
||||
viewModelScope.launch(IO) {
|
||||
playlists.postValue(repository.fetchPlaylistWithSongs())
|
||||
}
|
||||
}
|
||||
|
||||
private val loadPlaylists: Deferred<List<Playlist>>
|
||||
get() = viewModelScope.async(IO) {
|
||||
repository.allPlaylists()
|
||||
private fun fetchGenres() {
|
||||
viewModelScope.launch(IO) {
|
||||
genres.postValue(repository.fetchGenres())
|
||||
}
|
||||
private val loadPlaylistsWithSongs: Deferred<List<PlaylistWithSongs>>
|
||||
get() = viewModelScope.async(IO) {
|
||||
repository.playlistWithSongs()
|
||||
}
|
||||
|
||||
private val loadGenres: Deferred<List<Genre>>
|
||||
get() = viewModelScope.async(IO) {
|
||||
repository.allGenres()
|
||||
private fun fetchHomeSections() {
|
||||
viewModelScope.launch(IO) {
|
||||
home.postValue(repository.homeSections())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fun forceReload(reloadType: ReloadType) = viewModelScope.launch {
|
||||
when (reloadType) {
|
||||
Songs -> songs.value = loadSongs.await()
|
||||
Albums -> albums.value = loadAlbums.await()
|
||||
Artists -> artists.value = loadArtists.await()
|
||||
HomeSections -> home.value = loadHome.await()
|
||||
Playlists -> roomPlaylists.value = loadPlaylistsWithSongs.await()
|
||||
Genres -> genres.value = loadGenres.await()
|
||||
Songs -> fetchSongs()
|
||||
Albums -> fetchAlbums()
|
||||
Artists -> fetchArtists()
|
||||
HomeSections -> fetchHomeSections()
|
||||
Playlists -> fetchPlaylists()
|
||||
Genres -> fetchGenres()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,6 @@ enum class NowPlayingScreen constructor(
|
|||
Gradient(R.string.gradient, R.drawable.np_gradient, 17),
|
||||
Material(R.string.material, R.drawable.np_material, 11),
|
||||
Normal(R.string.normal, R.drawable.np_normal, 0),
|
||||
|
||||
//Peak(R.string.peak, R.drawable.np_peak, 14),
|
||||
Plain(R.string.plain, R.drawable.np_plain, 3),
|
||||
Simple(R.string.simple, R.drawable.np_simple, 8),
|
||||
|
|
|
@ -287,7 +287,7 @@ class AlbumDetailsFragment : AbsMainActivityFragment(R.layout.fragment_album_det
|
|||
}
|
||||
R.id.action_add_to_playlist -> {
|
||||
lifecycleScope.launch(Dispatchers.IO) {
|
||||
val playlists = get<RealRepository>().roomPlaylists()
|
||||
val playlists = get<RealRepository>().fetchPlaylists()
|
||||
withContext(Dispatchers.Main) {
|
||||
AddToRetroPlaylist.create(playlists, songs)
|
||||
.show(childFragmentManager, "ADD_PLAYLIST")
|
||||
|
|
|
@ -23,7 +23,7 @@ class AlbumsFragment : AbsRecyclerViewCustomGridSizeFragment<AlbumAdapter, GridL
|
|||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
libraryViewModel.albumsLiveData.observe(viewLifecycleOwner, Observer {
|
||||
libraryViewModel.getAlbums().observe(viewLifecycleOwner, Observer {
|
||||
if (it.isNotEmpty())
|
||||
adapter?.swapDataSet(it)
|
||||
else
|
||||
|
|
|
@ -227,7 +227,7 @@ class ArtistDetailsFragment : AbsMainActivityFragment(R.layout.fragment_artist_d
|
|||
}
|
||||
R.id.action_add_to_playlist -> {
|
||||
lifecycleScope.launch(Dispatchers.IO) {
|
||||
val playlists = get<RealRepository>().roomPlaylists()
|
||||
val playlists = get<RealRepository>().fetchPlaylists()
|
||||
withContext(Dispatchers.Main) {
|
||||
AddToRetroPlaylist.create(playlists, songs)
|
||||
.show(childFragmentManager, "ADD_PLAYLIST")
|
||||
|
|
|
@ -22,7 +22,7 @@ class ArtistsFragment : AbsRecyclerViewCustomGridSizeFragment<ArtistAdapter, Gri
|
|||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
libraryViewModel.artistsLiveData.observe(viewLifecycleOwner, Observer {
|
||||
libraryViewModel.getArtists().observe(viewLifecycleOwner, Observer {
|
||||
if (it.isNotEmpty())
|
||||
adapter?.swapDataSet(it)
|
||||
else
|
||||
|
|
|
@ -72,7 +72,7 @@ abstract class AbsPlayerFragment(@LayoutRes layout: Int) : AbsMainActivityFragme
|
|||
}
|
||||
R.id.action_add_to_playlist -> {
|
||||
lifecycleScope.launch(IO) {
|
||||
val playlists = get<RealRepository>().roomPlaylists()
|
||||
val playlists = get<RealRepository>().fetchPlaylists()
|
||||
withContext(Main) {
|
||||
AddToRetroPlaylist.create(playlists, song)
|
||||
.show(childFragmentManager, "ADD_PLAYLIST")
|
||||
|
|
|
@ -26,7 +26,7 @@ class GenresFragment : AbsRecyclerViewFragment<GenreAdapter, LinearLayoutManager
|
|||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
libraryViewModel.genresLiveData.observe(viewLifecycleOwner, Observer {
|
||||
libraryViewModel.getGenre().observe(viewLifecycleOwner, Observer {
|
||||
if (it.isNotEmpty())
|
||||
adapter?.swapDataSet(it)
|
||||
else
|
||||
|
|
|
@ -96,7 +96,7 @@ class HomeFragment :
|
|||
adapter = homeAdapter
|
||||
}
|
||||
|
||||
libraryViewModel.homeLiveData.observe(viewLifecycleOwner, Observer {
|
||||
libraryViewModel.getHome().observe(viewLifecycleOwner, Observer {
|
||||
homeAdapter.swapData(it)
|
||||
})
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ class PlaylistsFragment : AbsRecyclerViewFragment<PlaylistAdapter, GridLayoutMan
|
|||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
libraryViewModel.roomPlaylistsLiveData.observe(viewLifecycleOwner, Observer {
|
||||
libraryViewModel.getPlaylists().observe(viewLifecycleOwner, Observer {
|
||||
if (it.isNotEmpty())
|
||||
adapter?.swapDataSet(it)
|
||||
else
|
||||
|
|
|
@ -16,9 +16,11 @@ import code.name.monkey.retromusic.util.RetroUtil
|
|||
|
||||
class SongsFragment : AbsRecyclerViewCustomGridSizeFragment<SongAdapter, GridLayoutManager>() {
|
||||
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
libraryViewModel.songsLiveData.observe(viewLifecycleOwner, Observer {
|
||||
libraryViewModel.getSongs().observe(viewLifecycleOwner, Observer {
|
||||
println(Thread.currentThread().name)
|
||||
if (it.isNotEmpty())
|
||||
adapter?.swapDataSet(it)
|
||||
else
|
||||
|
|
|
@ -1,31 +0,0 @@
|
|||
package code.name.monkey.retromusic.fragments.songs
|
||||
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import androidx.lifecycle.ViewModel
|
||||
import androidx.lifecycle.viewModelScope
|
||||
import code.name.monkey.retromusic.model.Song
|
||||
import code.name.monkey.retromusic.repository.SongRepository
|
||||
import kotlinx.coroutines.Dispatchers.IO
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
class SongsViewModel(
|
||||
private val songRepository: SongRepository
|
||||
) : ViewModel() {
|
||||
init {
|
||||
update()
|
||||
}
|
||||
|
||||
private val songsData = MutableLiveData<List<Song>>().apply { value = mutableListOf() }
|
||||
|
||||
fun getSongList(): LiveData<List<Song>> {
|
||||
return songsData
|
||||
}
|
||||
|
||||
fun update() {
|
||||
viewModelScope.launch(IO) {
|
||||
val songs = songRepository.songs()
|
||||
songsData.postValue(songs)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -45,7 +45,7 @@ object GenreMenuHelper : KoinComponent {
|
|||
}
|
||||
R.id.action_add_to_playlist -> {
|
||||
CoroutineScope(Dispatchers.IO).launch {
|
||||
val playlists = get<RealRepository>().roomPlaylists()
|
||||
val playlists = get<RealRepository>().fetchPlaylists()
|
||||
withContext(Dispatchers.Main) {
|
||||
AddToRetroPlaylist.create(playlists, getGenreSongs(genre))
|
||||
.show(activity.supportFragmentManager, "ADD_PLAYLIST")
|
||||
|
|
|
@ -58,7 +58,7 @@ object PlaylistMenuHelper : KoinComponent {
|
|||
}
|
||||
R.id.action_add_to_playlist -> {
|
||||
CoroutineScope(Dispatchers.IO).launch {
|
||||
val playlists = get<RealRepository>().roomPlaylists()
|
||||
val playlists = get<RealRepository>().fetchPlaylists()
|
||||
withContext(Dispatchers.Main) {
|
||||
AddToRetroPlaylist.create(playlists, playlistWithSongs.songs.toSongs())
|
||||
.show(activity.supportFragmentManager, "ADD_PLAYLIST")
|
||||
|
|
|
@ -71,7 +71,7 @@ object SongMenuHelper : KoinComponent {
|
|||
}
|
||||
R.id.action_add_to_playlist -> {
|
||||
CoroutineScope(Dispatchers.IO).launch {
|
||||
val playlists = get<RealRepository>().roomPlaylists()
|
||||
val playlists = get<RealRepository>().fetchPlaylists()
|
||||
withContext(Dispatchers.Main) {
|
||||
AddToRetroPlaylist.create(playlists, song)
|
||||
.show(activity.supportFragmentManager, "ADD_PLAYLIST")
|
||||
|
|
|
@ -45,7 +45,7 @@ object SongsMenuHelper : KoinComponent {
|
|||
}
|
||||
R.id.action_add_to_playlist -> {
|
||||
CoroutineScope(Dispatchers.IO).launch {
|
||||
val playlists = get<RealRepository>().roomPlaylists()
|
||||
val playlists = get<RealRepository>().fetchPlaylists()
|
||||
withContext(Dispatchers.Main) {
|
||||
AddToRetroPlaylist.create(playlists, songs)
|
||||
.show(activity.supportFragmentManager, "ADD_PLAYLIST")
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package code.name.monkey.retromusic.network
|
||||
|
||||
import code.name.monkey.retromusic.App
|
||||
import code.name.monkey.retromusic.Constants.BASE_URL
|
||||
import code.name.monkey.retromusic.Constants.AUDIO_SCROBBLER_URL
|
||||
import com.google.gson.Gson
|
||||
import okhttp3.Cache
|
||||
import okhttp3.ConnectionPool
|
||||
|
@ -37,7 +37,7 @@ fun provideLastFmService(retrofit: Retrofit): LastFMService =
|
|||
retrofit.create(LastFMService::class.java)
|
||||
|
||||
fun providerRetrofit(okHttpClient: OkHttpClient.Builder): Retrofit = Retrofit.Builder()
|
||||
.baseUrl(BASE_URL)
|
||||
.baseUrl(AUDIO_SCROBBLER_URL)
|
||||
.callFactory(okHttpClient.build())
|
||||
.addConverterFactory(GsonConverterFactory.create(Gson()))
|
||||
.build()
|
||||
|
|
|
@ -37,14 +37,14 @@ interface Repository {
|
|||
fun genresFlow(): Flow<Result<List<Genre>>>
|
||||
fun historySong(): LiveData<List<HistoryEntity>>
|
||||
fun favorites(): LiveData<List<SongEntity>>
|
||||
suspend fun allAlbums(): List<Album>
|
||||
suspend fun fetchAlbums(): List<Album>
|
||||
suspend fun albumByIdAsync(albumId: Int): Album
|
||||
fun albumById(albumId: Int): Album
|
||||
suspend fun allSongs(): List<Song>
|
||||
suspend fun allArtists(): List<Artist>
|
||||
suspend fun fetchArtists(): List<Artist>
|
||||
suspend fun albumArtists(): List<Artist>
|
||||
suspend fun allPlaylists(): List<Playlist>
|
||||
suspend fun allGenres(): List<Genre>
|
||||
suspend fun fetchGenres(): List<Genre>
|
||||
suspend fun search(query: String?): MutableList<Any>
|
||||
suspend fun getPlaylistSongs(playlist: Playlist): List<Song>
|
||||
suspend fun getGenre(genreId: Int): List<Song>
|
||||
|
@ -66,12 +66,12 @@ interface Repository {
|
|||
suspend fun homeSections(): List<Home>
|
||||
suspend fun homeSectionsFlow(): Flow<Result<List<Home>>>
|
||||
suspend fun playlist(playlistId: Int): Playlist
|
||||
suspend fun playlistWithSongs(): List<PlaylistWithSongs>
|
||||
suspend fun fetchPlaylistWithSongs(): List<PlaylistWithSongs>
|
||||
suspend fun playlistSongs(playlistWithSongs: PlaylistWithSongs): List<Song>
|
||||
suspend fun insertSongs(songs: List<SongEntity>)
|
||||
suspend fun checkPlaylistExists(playlistName: String): List<PlaylistEntity>
|
||||
suspend fun createPlaylist(playlistEntity: PlaylistEntity): Long
|
||||
suspend fun roomPlaylists(): List<PlaylistEntity>
|
||||
suspend fun fetchPlaylists(): List<PlaylistEntity>
|
||||
suspend fun deleteRoomPlaylist(playlists: List<PlaylistEntity>)
|
||||
suspend fun renameRoomPlaylist(playlistId: Int, name: String)
|
||||
suspend fun deleteSongsInPlaylist(songs: List<SongEntity>)
|
||||
|
@ -107,11 +107,11 @@ class RealRepository(
|
|||
private val roomRepository: RoomRepository
|
||||
) : Repository {
|
||||
|
||||
override suspend fun allAlbums(): List<Album> = albumRepository.albums()
|
||||
override suspend fun fetchAlbums(): List<Album> = albumRepository.albums()
|
||||
|
||||
override suspend fun albumByIdAsync(albumId: Int): Album = albumRepository.album(albumId)
|
||||
override fun albumById(albumId: Int): Album = albumRepository.album(albumId)
|
||||
override suspend fun allArtists(): List<Artist> = artistRepository.artists()
|
||||
override suspend fun fetchArtists(): List<Artist> = artistRepository.artists()
|
||||
|
||||
override suspend fun albumArtists(): List<Artist> = artistRepository.albumArtists()
|
||||
|
||||
|
@ -127,7 +127,7 @@ class RealRepository(
|
|||
|
||||
override suspend fun allPlaylists(): List<Playlist> = playlistRepository.playlists()
|
||||
|
||||
override suspend fun allGenres(): List<Genre> = genreRepository.genres()
|
||||
override suspend fun fetchGenres(): List<Genre> = genreRepository.genres()
|
||||
|
||||
override suspend fun allSongs(): List<Song> = songRepository.songs()
|
||||
|
||||
|
@ -205,7 +205,7 @@ class RealRepository(
|
|||
override suspend fun playlist(playlistId: Int) =
|
||||
playlistRepository.playlist(playlistId)
|
||||
|
||||
override suspend fun playlistWithSongs(): List<PlaylistWithSongs> =
|
||||
override suspend fun fetchPlaylistWithSongs(): List<PlaylistWithSongs> =
|
||||
roomRepository.playlistWithSongs()
|
||||
|
||||
override suspend fun playlistSongs(playlistWithSongs: PlaylistWithSongs): List<Song> =
|
||||
|
@ -222,7 +222,7 @@ class RealRepository(
|
|||
override suspend fun createPlaylist(playlistEntity: PlaylistEntity): Long =
|
||||
roomRepository.createPlaylist(playlistEntity)
|
||||
|
||||
override suspend fun roomPlaylists(): List<PlaylistEntity> = roomRepository.playlists()
|
||||
override suspend fun fetchPlaylists(): List<PlaylistEntity> = roomRepository.playlists()
|
||||
|
||||
override suspend fun deleteRoomPlaylist(playlists: List<PlaylistEntity>) =
|
||||
roomRepository.deletePlaylistEntities(playlists)
|
||||
|
|
|
@ -84,11 +84,11 @@ import code.name.monkey.retromusic.util.MusicUtil;
|
|||
import code.name.monkey.retromusic.util.PreferenceUtil;
|
||||
import code.name.monkey.retromusic.util.RetroUtil;
|
||||
|
||||
import static code.name.monkey.retromusic.ConstantsKt.ALBUM_ART_ON_LOCKSCREEN;
|
||||
import static code.name.monkey.retromusic.ConstantsKt.ALBUM_ART_ON_LOCK_SCREEN;
|
||||
import static code.name.monkey.retromusic.ConstantsKt.BLURRED_ALBUM_ART;
|
||||
import static code.name.monkey.retromusic.ConstantsKt.CLASSIC_NOTIFICATION;
|
||||
import static code.name.monkey.retromusic.ConstantsKt.COLORED_NOTIFICATION;
|
||||
import static code.name.monkey.retromusic.ConstantsKt.GAPLESS_PLAYBACK;
|
||||
import static code.name.monkey.retromusic.ConstantsKt.GAP_LESS_PLAYBACK;
|
||||
import static code.name.monkey.retromusic.ConstantsKt.TOGGLE_HEADSET;
|
||||
|
||||
/**
|
||||
|
@ -727,7 +727,7 @@ public class MusicService extends Service implements
|
|||
@Override
|
||||
public void onSharedPreferenceChanged(@NonNull SharedPreferences sharedPreferences, @NonNull String key) {
|
||||
switch (key) {
|
||||
case GAPLESS_PLAYBACK:
|
||||
case GAP_LESS_PLAYBACK:
|
||||
if (sharedPreferences.getBoolean(key, false)) {
|
||||
prepareNext();
|
||||
} else {
|
||||
|
@ -736,7 +736,7 @@ public class MusicService extends Service implements
|
|||
}
|
||||
}
|
||||
break;
|
||||
case ALBUM_ART_ON_LOCKSCREEN:
|
||||
case ALBUM_ART_ON_LOCK_SCREEN:
|
||||
case BLURRED_ALBUM_ART:
|
||||
updateMediaSessionMetaData();
|
||||
break;
|
||||
|
|
|
@ -243,7 +243,7 @@ object PreferenceUtil {
|
|||
|
||||
val isAlbumArtOnLockScreen
|
||||
get() = sharedPreferences.getBoolean(
|
||||
ALBUM_ART_ON_LOCKSCREEN, false
|
||||
ALBUM_ART_ON_LOCK_SCREEN, false
|
||||
)
|
||||
|
||||
val isAudioDucking
|
||||
|
@ -292,7 +292,7 @@ object PreferenceUtil {
|
|||
|
||||
val isGapLessPlayback
|
||||
get() = sharedPreferences.getBoolean(
|
||||
GAPLESS_PLAYBACK, false
|
||||
GAP_LESS_PLAYBACK, false
|
||||
)
|
||||
|
||||
val isAdaptiveColor
|
||||
|
@ -471,7 +471,7 @@ object PreferenceUtil {
|
|||
|
||||
var artistGridSizeLand
|
||||
get() = sharedPreferences.getInt(
|
||||
ALBUM_GRID_SIZE_LAND,
|
||||
ARTIST_GRID_SIZE_LAND,
|
||||
App.getContext().getIntRes(R.integer.default_grid_columns_land)
|
||||
)
|
||||
set(value) = sharedPreferences.edit {
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
android:orientation="vertical"
|
||||
android:paddingBottom="12dp">
|
||||
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/history"
|
||||
android:layout_width="0dp"
|
||||
|
|
Loading…
Reference in a new issue