Minimum working prototype
This commit is contained in:
parent
0069253043
commit
bbd1853e78
6 changed files with 33 additions and 4 deletions
|
@ -123,6 +123,7 @@ const val AUTO_DOWNLOAD_IMAGES_POLICY = "auto_download_images_policy"
|
|||
const val START_DIRECTORY = "start_directory"
|
||||
const val RECENTLY_PLAYED_CUTOFF = "recently_played_interval"
|
||||
const val LOCK_SCREEN = "lock_screen"
|
||||
const val ALBUM_ARTISTS_ONLY = "album_artists_only"
|
||||
const val ALBUM_DETAIL_SONG_SORT_ORDER = "album_detail_song_sort_order"
|
||||
const val LYRICS_OPTIONS = "lyrics_tab_position"
|
||||
const val CHOOSE_EQUALIZER = "choose_equalizer"
|
||||
|
|
|
@ -12,6 +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 code.name.monkey.retromusic.util.PreferenceUtil
|
||||
import kotlinx.coroutines.Dispatchers.IO
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
|
@ -91,10 +92,16 @@ class LibraryViewModel(
|
|||
}
|
||||
|
||||
private fun fetchArtists() {
|
||||
if (PreferenceUtil.albumArtistsOnly) {
|
||||
viewModelScope.launch(IO) {
|
||||
artists.postValue(repository.albumArtists())
|
||||
}
|
||||
} else {
|
||||
viewModelScope.launch(IO) {
|
||||
artists.postValue(repository.fetchArtists())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun fetchPlaylists() {
|
||||
viewModelScope.launch(IO) {
|
||||
|
|
|
@ -69,7 +69,10 @@ class RealArtistRepository(
|
|||
getSongLoaderSortOrder()
|
||||
)
|
||||
)
|
||||
return splitIntoAlbumArtists(albumRepository.splitIntoAlbums(songs))
|
||||
|
||||
val sortString = if (PreferenceUtil.artistSortOrder.contains("DESC")) String.CASE_INSENSITIVE_ORDER.reversed() else String.CASE_INSENSITIVE_ORDER
|
||||
|
||||
return splitIntoAlbumArtists(albumRepository.splitIntoAlbums(songs)).sortedWith(compareBy(sortString) { it.name })
|
||||
}
|
||||
|
||||
private fun splitIntoAlbumArtists(albums: List<Album>): List<Artist> {
|
||||
|
|
|
@ -122,6 +122,13 @@ object PreferenceUtil {
|
|||
"only_wifi"
|
||||
)
|
||||
|
||||
var albumArtistsOnly
|
||||
get() = sharedPreferences.getBoolean(
|
||||
ALBUM_ARTISTS_ONLY,
|
||||
false
|
||||
)
|
||||
set(value) = sharedPreferences.edit { putBoolean(ALBUM_ARTISTS_ONLY, value) }
|
||||
|
||||
var albumDetailSongSortOrder
|
||||
get() = sharedPreferences.getStringOrDefault(
|
||||
ALBUM_DETAIL_SONG_SORT_ORDER,
|
||||
|
@ -150,7 +157,7 @@ object PreferenceUtil {
|
|||
var artistSortOrder
|
||||
get() = sharedPreferences.getStringOrDefault(
|
||||
ARTIST_SORT_ORDER,
|
||||
AlbumSortOrder.ALBUM_A_Z
|
||||
ArtistSortOrder.ARTIST_A_Z
|
||||
)
|
||||
set(value) = sharedPreferences.edit {
|
||||
putString(ARTIST_SORT_ORDER, value)
|
||||
|
|
|
@ -69,6 +69,8 @@
|
|||
|
||||
<string name="action_sort_order">Sort order</string>
|
||||
|
||||
<string name="action_album_artists_only">Album artists only</string>
|
||||
|
||||
<string name="action_tag_editor">Tag editor</string>
|
||||
|
||||
<string name="action_toggle_favorite">Toggle favorite</string>
|
||||
|
@ -517,6 +519,7 @@
|
|||
|
||||
<string name="pref_snow_fall_title">Snow fall effect</string>
|
||||
|
||||
<string name="pref_summary_album_artists_only">Show Album Artists in the Artist category</string>
|
||||
<string name="pref_summary_album_art_on_lockscreen">Use the currently playing song album cover as the lockscreen wallpaper</string>
|
||||
<string name="pref_summary_audio_ducking">Lower the volume when a system sound is played or a notification is received</string>
|
||||
<string name="pref_summary_blacklist">The content of blacklisted folders is hidden from your library.</string>
|
||||
|
@ -546,6 +549,7 @@
|
|||
<string name="pref_summary_toggle_shuffle">Shuffle mode will turn off when playing a new list of songs</string>
|
||||
<string name="pref_summary_toggle_volume">If enough space is available, show volume controls in the now playing screen</string>
|
||||
|
||||
<string name="pref_title_album_artists_only">Navigate by Album Artist</string>
|
||||
<string name="pref_title_album_art_on_lockscreen">Show album cover</string>
|
||||
<string name="pref_title_album_cover_style">Album cover theme</string>
|
||||
<string name="pref_title_album_cover_transform">Album cover skip</string>
|
||||
|
|
|
@ -45,6 +45,13 @@
|
|||
android:negativeButtonText="@null"
|
||||
android:positiveButtonText="@null"
|
||||
android:title="@string/pref_title_tab_text_mode" />
|
||||
|
||||
<code.name.monkey.appthemehelper.common.prefs.supportv7.ATESwitchPreference
|
||||
android:defaultValue="false"
|
||||
android:key="album_artists_only"
|
||||
android:layout="@layout/list_item_view_switch"
|
||||
android:summary="@string/pref_summary_album_artists_only"
|
||||
android:title="@string/pref_title_album_artists_only" />
|
||||
</code.name.monkey.appthemehelper.common.prefs.supportv7.ATEPreferenceCategory>
|
||||
|
||||
<code.name.monkey.appthemehelper.common.prefs.supportv7.ATEPreferenceCategory
|
||||
|
|
Loading…
Reference in a new issue