mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-14 14:20:30 +05:30
Merge pull request #2134 from Kruna1Pate1/fix/watch-history
Fix watch history deletion
This commit is contained in:
commit
494bd083d0
@ -21,8 +21,9 @@ class WatchHistoryAdapter(
|
||||
RecyclerView.Adapter<WatchHistoryViewHolder>() {
|
||||
|
||||
fun removeFromWatchHistory(position: Int) {
|
||||
val history = watchHistory[position]
|
||||
query {
|
||||
DatabaseHolder.Database.watchHistoryDao().delete(watchHistory[position])
|
||||
DatabaseHolder.Database.watchHistoryDao().delete(history)
|
||||
}
|
||||
watchHistory.removeAt(position)
|
||||
notifyItemRemoved(position)
|
||||
|
@ -89,7 +89,7 @@ class WatchHistoryFragment : BaseFragment() {
|
||||
// observe changes
|
||||
watchHistoryAdapter.registerAdapterDataObserver(object :
|
||||
RecyclerView.AdapterDataObserver() {
|
||||
override fun onChanged() {
|
||||
override fun onItemRangeRemoved(positionStart: Int, itemCount: Int) {
|
||||
if (watchHistoryAdapter.itemCount == 0) {
|
||||
binding.watchHistoryRecView.visibility = View.GONE
|
||||
binding.historyEmpty.visibility = View.VISIBLE
|
||||
|
Loading…
Reference in New Issue
Block a user