check null items at getItemSelectionKey
This commit is contained in:
parent
d0058b8429
commit
cc68576106
3 changed files with 2 additions and 8 deletions
|
@ -61,7 +61,7 @@ class PlaylistsAdapter(activity: SimpleActivity, val playlists: ArrayList<Playli
|
|||
|
||||
override fun getItemKeyPosition(key: String) = playlists.indexOfFirst { it.id.toString() == key }
|
||||
|
||||
override fun getItemSelectionKey(position: Int) = playlists[position].id.toString()
|
||||
override fun getItemSelectionKey(position: Int) = playlists.getOrNull(position)?.id?.toString()
|
||||
|
||||
private fun askConfirmDelete() {
|
||||
RemovePlaylistDialog(activity) {
|
||||
|
|
|
@ -116,7 +116,7 @@ class SongAdapter(activity: SimpleActivity, var songs: ArrayList<Song>, val list
|
|||
|
||||
override fun getItemKeyPosition(key: String) = songs.indexOfFirst { it.path == key }
|
||||
|
||||
override fun getItemSelectionKey(position: Int) = songs[position].path
|
||||
override fun getItemSelectionKey(position: Int) = songs.getOrNull(position)?.path
|
||||
|
||||
fun searchOpened() {
|
||||
transparentViewHeight = transparentView.height
|
||||
|
|
|
@ -638,16 +638,10 @@ class MusicService : Service(), MediaPlayer.OnPreparedListener, MediaPlayer.OnEr
|
|||
return Pair(resultBitmap, true)
|
||||
}
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
}
|
||||
}
|
||||
|
||||
if (song != null) {
|
||||
try {
|
||||
val songParentDirectory = File(song.path).parent.trimEnd('/')
|
||||
val albumArtFiles = arrayListOf("folder.jpg", "albumart.jpg", "cover.jpg")
|
||||
albumArtFiles.forEach {
|
||||
|
||||
val albumArtFilePath = "$songParentDirectory/$it"
|
||||
if (getDoesFilePathExist(albumArtFilePath)) {
|
||||
val bitmap = BitmapFactory.decodeFile(albumArtFilePath)
|
||||
|
|
Loading…
Reference in a new issue