Fixed unshuffled songs when restoring the playing queue
This commit is contained in:
parent
ead8520333
commit
0c4cabc755
4 changed files with 10 additions and 5 deletions
|
@ -53,7 +53,7 @@ class ErrorActivity : AppCompatActivity() {
|
|||
)
|
||||
.setNeutralButton(
|
||||
R.string.customactivityoncrash_error_activity_error_details_share
|
||||
) { dialog, which ->
|
||||
) { _, _ ->
|
||||
|
||||
val bugReport = createFile(
|
||||
context = this,
|
||||
|
|
|
@ -25,7 +25,6 @@ import code.name.monkey.retromusic.extensions.surfaceColor
|
|||
import code.name.monkey.retromusic.fragments.GridStyle
|
||||
import code.name.monkey.retromusic.fragments.ReloadType
|
||||
import code.name.monkey.retromusic.fragments.base.AbsRecyclerViewCustomGridSizeFragment
|
||||
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
||||
import code.name.monkey.retromusic.helper.SortOrder.SongSortOrder
|
||||
import code.name.monkey.retromusic.interfaces.ICabCallback
|
||||
import code.name.monkey.retromusic.interfaces.ICabHolder
|
||||
|
@ -66,7 +65,7 @@ class SongsFragment : AbsRecyclerViewCustomGridSizeFragment<SongAdapter, GridLay
|
|||
get() = true
|
||||
|
||||
override fun onShuffleClicked() {
|
||||
libraryViewModel.getSongs().value?.let { MusicPlayerRemote.openAndShuffleQueue(it, true) }
|
||||
libraryViewModel.shuffleSongs()
|
||||
}
|
||||
|
||||
override fun createLayoutManager(): GridLayoutManager {
|
||||
|
|
|
@ -43,6 +43,8 @@ interface SongRepository {
|
|||
|
||||
fun songs(cursor: Cursor?): List<Song>
|
||||
|
||||
fun sortedSongs(cursor: Cursor?): List<Song>
|
||||
|
||||
fun songs(query: String): List<Song>
|
||||
|
||||
fun songsByFilePath(filePath: String, ignoreBlacklist: Boolean = false): List<Song>
|
||||
|
@ -57,7 +59,7 @@ interface SongRepository {
|
|||
class RealSongRepository(private val context: Context) : SongRepository {
|
||||
|
||||
override fun songs(): List<Song> {
|
||||
return songs(makeSongCursor(null, null))
|
||||
return sortedSongs(makeSongCursor(null, null))
|
||||
}
|
||||
|
||||
override fun songs(cursor: Cursor?): List<Song> {
|
||||
|
@ -68,7 +70,12 @@ class RealSongRepository(private val context: Context) : SongRepository {
|
|||
} while (cursor.moveToNext())
|
||||
}
|
||||
cursor?.close()
|
||||
return songs
|
||||
}
|
||||
|
||||
override fun sortedSongs(cursor: Cursor?): List<Song> {
|
||||
val collator = Collator.getInstance()
|
||||
val songs = songs(cursor)
|
||||
return when (PreferenceUtil.songSortOrder) {
|
||||
SortOrder.SongSortOrder.SONG_A_Z -> {
|
||||
songs.sortedWith{ s1, s2 -> collator.compare(s1.title, s2.title) }
|
||||
|
|
|
@ -181,7 +181,6 @@ class PlayingNotificationImpl24(
|
|||
onUpdate()
|
||||
}
|
||||
})
|
||||
updateFavorite(song, onUpdate)
|
||||
}
|
||||
|
||||
private fun buildPlayAction(isPlaying: Boolean): NotificationCompat.Action {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue