mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-14 22:30:30 +05:30
Fix crash on opening deleted local playlist
Upadte playlist view on content change.
This commit is contained in:
parent
b0f863c747
commit
d534389c82
@ -40,6 +40,7 @@ class DeletePlaylistDialog(
|
|||||||
DatabaseHolder.Database.localPlaylistsDao().deletePlaylistById(playlistId)
|
DatabaseHolder.Database.localPlaylistsDao().deletePlaylistById(playlistId)
|
||||||
DatabaseHolder.Database.localPlaylistsDao().deletePlaylistItemsByPlaylistId(playlistId)
|
DatabaseHolder.Database.localPlaylistsDao().deletePlaylistItemsByPlaylistId(playlistId)
|
||||||
}
|
}
|
||||||
|
onSuccess.invoke()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -129,12 +129,14 @@ class LibraryFragment : BaseFragment() {
|
|||||||
// listen for playlists to become deleted
|
// listen for playlists to become deleted
|
||||||
playlistsAdapter.registerAdapterDataObserver(object :
|
playlistsAdapter.registerAdapterDataObserver(object :
|
||||||
RecyclerView.AdapterDataObserver() {
|
RecyclerView.AdapterDataObserver() {
|
||||||
override fun onChanged() {
|
override fun onItemRangeRemoved(positionStart: Int, itemCount: Int) {
|
||||||
binding.nothingHere.visibility = if (playlistsAdapter.itemCount == 0) View.VISIBLE else View.GONE
|
binding.nothingHere.visibility =
|
||||||
super.onChanged()
|
if (playlistsAdapter.itemCount == 0) View.VISIBLE else View.GONE
|
||||||
|
super.onItemRangeRemoved(positionStart, itemCount)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
binding.nothingHere.visibility = View.GONE
|
||||||
binding.playlistRecView.adapter = playlistsAdapter
|
binding.playlistRecView.adapter = playlistsAdapter
|
||||||
} else {
|
} else {
|
||||||
runOnUiThread {
|
runOnUiThread {
|
||||||
|
Loading…
Reference in New Issue
Block a user