Merge pull request #1499 from Bnyro/master

fix crashes when removing recview items
This commit is contained in:
Bnyro 2022-10-05 21:56:16 +02:00 committed by GitHub
commit bdfc8ccf6c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 5 additions and 2 deletions

View File

@ -66,6 +66,7 @@ class DownloadsAdapter(
files.removeAt(position)
notifyItemRemoved(position)
notifyItemRangeChanged(position, itemCount)
}
}
}

View File

@ -104,6 +104,7 @@ class PlaylistsAdapter(
playlists.removeAt(position)
activity.runOnUiThread {
notifyItemRemoved(position)
notifyItemRangeChanged(position, itemCount)
}
}
} catch (e: Exception) {

View File

@ -32,14 +32,14 @@ class SearchHistoryAdapter(
historyText.text = historyQuery
deleteHistory.setOnClickListener {
val itemIndex = historyList.indexOf(historyQuery)
historyList -= historyQuery
query {
Database.searchHistoryDao().delete(
SearchHistoryItem(query = historyQuery)
)
}
notifyItemRemoved(itemIndex)
notifyItemRemoved(position)
notifyItemRangeChanged(position, itemCount)
}
root.setOnClickListener {

View File

@ -24,6 +24,7 @@ class WatchHistoryAdapter(
DatabaseHelper.removeFromWatchHistory(position)
watchHistory.removeAt(position)
notifyItemRemoved(position)
notifyItemRangeChanged(position, itemCount)
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): WatchHistoryViewHolder {