Merge branch 'room-playlist' of https://github.com/h4h13/RetroMusicPlayer into room-playlist

main
Hemanth S 2020-09-05 21:25:00 +05:30
commit 45f5c18725
28 changed files with 133 additions and 144 deletions

View File

@ -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"

View File

@ -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)

View File

@ -60,7 +60,7 @@ class SearchAdapter(
holder.title?.text = album.title
holder.text?.text = album.artistName
AlbumGlideRequest.Builder.from(Glide.with(activity), album.safeGetFirstSong())
.checkIgnoreMediaStore(activity).build().into(holder.image)
.checkIgnoreMediaStore().build().into(holder.image)
}
ARTIST -> {
val artist = dataSet.get(position) as Artist

View File

@ -101,11 +101,10 @@ open class AlbumAdapter(
}
AlbumGlideRequest.Builder.from(Glide.with(activity), album.safeGetFirstSong())
.checkIgnoreMediaStore(activity)
.checkIgnoreMediaStore()
.generatePalette(activity)
.build()
.into(object : RetroMusicColoredTarget(holder.image!!) {
override fun onColorReady(colors: MediaNotificationProcessor) {
setColors(colors, holder)
}

View File

@ -36,7 +36,7 @@ class HorizontalAlbumAdapter(
override fun loadAlbumCover(album: Album, holder: ViewHolder) {
if (holder.image == null) return
AlbumGlideRequest.Builder.from(Glide.with(activity), album.safeGetFirstSong())
.checkIgnoreMediaStore(activity)
.checkIgnoreMediaStore()
.generatePalette(activity)
.build()
.into(object : RetroMusicColoredTarget(holder.image!!) {

View File

@ -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])

View File

@ -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()
}
}

View File

@ -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),

View File

@ -79,7 +79,7 @@ class AlbumDetailsFragment : AbsMainActivityFragment(R.layout.fragment_album_det
toolbar.title = null
postponeEnterTransition()
detailsViewModel.getAlbum2().observe(viewLifecycleOwner, Observer {
detailsViewModel.getAlbum().observe(viewLifecycleOwner, Observer {
startPostponedEnterTransition()
showAlbum(it)
})
@ -149,8 +149,7 @@ class AlbumDetailsFragment : AbsMainActivityFragment(R.layout.fragment_album_det
this.album = album
albumTitle.text = album.title
val songText =
resources.getQuantityString(
val songText = resources.getQuantityString(
R.plurals.albumSongs,
album.songCount,
album.songCount
@ -171,7 +170,7 @@ class AlbumDetailsFragment : AbsMainActivityFragment(R.layout.fragment_album_det
MusicUtil.getReadableDurationString(MusicUtil.getTotalDuration(album.songs))
)
}
loadAlbumCover()
loadAlbumCover(album)
simpleSongAdapter.swapDataSet(album.songs)
detailsViewModel.loadArtist(album.artistId)
detailsViewModel.loadAlbumInfo(album)
@ -216,6 +215,7 @@ class AlbumDetailsFragment : AbsMainActivityFragment(R.layout.fragment_album_det
private fun loadArtistImage(artist: Artist) {
ArtistGlideRequest.Builder.from(Glide.with(requireContext()), artist)
.forceDownload(PreferenceUtil.isAllowedToDownloadMetadata())
.generatePalette(requireContext())
.build()
.dontAnimate()
@ -226,14 +226,11 @@ class AlbumDetailsFragment : AbsMainActivityFragment(R.layout.fragment_album_det
})
}
private fun loadAlbumCover() {
private fun loadAlbumCover(album: Album) {
AlbumGlideRequest.Builder.from(Glide.with(requireContext()), album.safeGetFirstSong())
.checkIgnoreMediaStore(requireContext())
.ignoreMediaStore(PreferenceUtil.isIgnoreMediaStoreArtwork)
.checkIgnoreMediaStore()
.generatePalette(requireContext())
.build()
.dontAnimate()
.dontTransform()
.into(object : SingleColorTarget(image) {
override fun onColorReady(color: Int) {
setColors(color)
@ -287,7 +284,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")

View File

@ -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

View File

@ -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")

View File

@ -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

View File

@ -74,7 +74,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")

View File

@ -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

View File

@ -16,6 +16,9 @@ package code.name.monkey.retromusic.fragments.home
import android.app.ActivityOptions
import android.os.Bundle
import android.view.Menu
import android.view.MenuInflater
import android.view.MenuItem.SHOW_AS_ACTION_IF_ROOM
import android.view.View
import androidx.core.os.bundleOf
import androidx.lifecycle.Observer
@ -96,7 +99,7 @@ class HomeFragment :
adapter = homeAdapter
}
libraryViewModel.homeLiveData.observe(viewLifecycleOwner, Observer {
libraryViewModel.getHome().observe(viewLifecycleOwner, Observer {
homeAdapter.swapData(it)
})
@ -116,6 +119,14 @@ class HomeFragment :
).build().into(userImage)
}
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
super.onCreateOptionsMenu(menu, inflater)
menu.removeItem(R.id.action_grid_size)
menu.removeItem(R.id.action_layout_type)
menu.removeItem(R.id.action_sort_order)
menu.findItem(R.id.action_settings).setShowAsAction(SHOW_AS_ACTION_IF_ROOM)
}
companion object {
const val TAG: String = "BannerHomeFragment"

View File

@ -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

View File

@ -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

View File

@ -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)
}
}
}

View File

@ -69,7 +69,7 @@ public class AlbumGlideRequest {
}
@NonNull
public Builder checkIgnoreMediaStore(@NonNull Context context) {
public Builder checkIgnoreMediaStore() {
return ignoreMediaStore(PreferenceUtil.INSTANCE.isIgnoreMediaStoreArtwork());
}

View File

@ -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")

View File

@ -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")

View File

@ -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")

View File

@ -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")

View File

@ -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()

View File

@ -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)

View File

@ -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;

View File

@ -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 {

View File

@ -6,7 +6,6 @@
android:orientation="vertical"
android:paddingBottom="12dp">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/history"
android:layout_width="0dp"