mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-01-06 01:20:29 +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>() {
|
RecyclerView.Adapter<WatchHistoryViewHolder>() {
|
||||||
|
|
||||||
fun removeFromWatchHistory(position: Int) {
|
fun removeFromWatchHistory(position: Int) {
|
||||||
|
val history = watchHistory[position]
|
||||||
query {
|
query {
|
||||||
DatabaseHolder.Database.watchHistoryDao().delete(watchHistory[position])
|
DatabaseHolder.Database.watchHistoryDao().delete(history)
|
||||||
}
|
}
|
||||||
watchHistory.removeAt(position)
|
watchHistory.removeAt(position)
|
||||||
notifyItemRemoved(position)
|
notifyItemRemoved(position)
|
||||||
|
@ -89,7 +89,7 @@ class WatchHistoryFragment : BaseFragment() {
|
|||||||
// observe changes
|
// observe changes
|
||||||
watchHistoryAdapter.registerAdapterDataObserver(object :
|
watchHistoryAdapter.registerAdapterDataObserver(object :
|
||||||
RecyclerView.AdapterDataObserver() {
|
RecyclerView.AdapterDataObserver() {
|
||||||
override fun onChanged() {
|
override fun onItemRangeRemoved(positionStart: Int, itemCount: Int) {
|
||||||
if (watchHistoryAdapter.itemCount == 0) {
|
if (watchHistoryAdapter.itemCount == 0) {
|
||||||
binding.watchHistoryRecView.visibility = View.GONE
|
binding.watchHistoryRecView.visibility = View.GONE
|
||||||
binding.historyEmpty.visibility = View.VISIBLE
|
binding.historyEmpty.visibility = View.VISIBLE
|
||||||
|
Loading…
Reference in New Issue
Block a user