Make artist IDs unique
Fix an issue where the artist IDs would not be unique in the context of the other items.
This commit is contained in:
parent
0bbcff35eb
commit
ab2da7a5a4
4 changed files with 12 additions and 6 deletions
|
@ -2,6 +2,7 @@ package org.oxycblt.auxio.music.processing
|
||||||
|
|
||||||
import org.oxycblt.auxio.music.Album
|
import org.oxycblt.auxio.music.Album
|
||||||
import org.oxycblt.auxio.music.Artist
|
import org.oxycblt.auxio.music.Artist
|
||||||
|
import org.oxycblt.auxio.music.Genre
|
||||||
import org.oxycblt.auxio.music.Song
|
import org.oxycblt.auxio.music.Song
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -9,7 +10,7 @@ import org.oxycblt.auxio.music.Song
|
||||||
*/
|
*/
|
||||||
class MusicSorter(
|
class MusicSorter(
|
||||||
val songs: MutableList<Song>,
|
val songs: MutableList<Song>,
|
||||||
val albums: MutableList<Album>
|
val albums: MutableList<Album>,
|
||||||
) {
|
) {
|
||||||
val artists = mutableListOf<Artist>()
|
val artists = mutableListOf<Artist>()
|
||||||
|
|
||||||
|
@ -30,7 +31,14 @@ class MusicSorter(
|
||||||
|
|
||||||
groupedAlbums.forEach {
|
groupedAlbums.forEach {
|
||||||
artists.add(
|
artists.add(
|
||||||
Artist(id = artists.size.toLong(), name = it.key, albums = it.value)
|
// Min value is deliberately used to prevent conflicts with the MediaStore
|
||||||
|
// album & artist IDs. Shouldnt conflict with other negative IDs unless there
|
||||||
|
// are ~2.147 billion artists.
|
||||||
|
Artist(
|
||||||
|
id = (artists.size + Int.MIN_VALUE).toLong(),
|
||||||
|
name = it.key,
|
||||||
|
albums = it.value
|
||||||
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -232,9 +232,6 @@ class PlaybackStateManager private constructor() {
|
||||||
|
|
||||||
resetLoopMode()
|
resetLoopMode()
|
||||||
setShuffling(shuffled, keepSong = false)
|
setShuffling(shuffled, keepSong = false)
|
||||||
|
|
||||||
logD(mQueue[0].name)
|
|
||||||
|
|
||||||
updatePlayback(mQueue[0])
|
updatePlayback(mQueue[0])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -125,6 +125,8 @@ class SearchFragment : Fragment() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logD("Fragment created.")
|
||||||
|
|
||||||
return binding.root
|
return binding.root
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,6 @@ import androidx.appcompat.widget.PopupMenu
|
||||||
import androidx.lifecycle.ViewModelProvider
|
import androidx.lifecycle.ViewModelProvider
|
||||||
import org.oxycblt.auxio.R
|
import org.oxycblt.auxio.R
|
||||||
import org.oxycblt.auxio.detail.DetailViewModel
|
import org.oxycblt.auxio.detail.DetailViewModel
|
||||||
import org.oxycblt.auxio.logD
|
|
||||||
import org.oxycblt.auxio.music.Album
|
import org.oxycblt.auxio.music.Album
|
||||||
import org.oxycblt.auxio.music.Artist
|
import org.oxycblt.auxio.music.Artist
|
||||||
import org.oxycblt.auxio.music.BaseModel
|
import org.oxycblt.auxio.music.BaseModel
|
||||||
|
|
Loading…
Reference in a new issue