diff --git a/app/src/main/kotlin/com/simplemobiletools/musicplayer/adapters/SongAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/musicplayer/adapters/SongAdapter.kt index 0b6fd14f..259e9bbc 100644 --- a/app/src/main/kotlin/com/simplemobiletools/musicplayer/adapters/SongAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/musicplayer/adapters/SongAdapter.kt @@ -35,6 +35,7 @@ class SongAdapter(activity: SimpleActivity, var songs: ArrayList, recycler : MyRecyclerViewAdapter(activity, recyclerView, fastScroller, itemClick) { private var currentSongIndex = 0 + private var songsHashCode = songs.hashCode() var isThirdPartyIntent = false override fun getActionMenuId() = R.menu.cab @@ -171,9 +172,13 @@ class SongAdapter(activity: SimpleActivity, var songs: ArrayList, recycler } fun updateSongs(newSongs: ArrayList) { - songs = newSongs - currentSongIndex = -1 - notifyDataSetChanged() + val newHashCode = newSongs.hashCode() + if (newHashCode != songsHashCode) { + songsHashCode = newHashCode + songs = newSongs + currentSongIndex = -1 + notifyDataSetChanged() + } } fun updateCurrentSongIndex(index: Int) {