mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-28 16:00:31 +05:30
Merge pull request #1955 from Bnyro/master
fix crash when deleting from watch history
This commit is contained in:
commit
8f3af55f8a
@ -6,6 +6,7 @@ import androidx.recyclerview.widget.RecyclerView
|
||||
import com.github.libretube.databinding.WatchHistoryRowBinding
|
||||
import com.github.libretube.db.DatabaseHolder
|
||||
import com.github.libretube.db.obj.WatchHistoryItem
|
||||
import com.github.libretube.extensions.query
|
||||
import com.github.libretube.ui.base.BaseActivity
|
||||
import com.github.libretube.ui.extensions.setFormattedDuration
|
||||
import com.github.libretube.ui.extensions.setWatchProgressLength
|
||||
@ -20,7 +21,9 @@ class WatchHistoryAdapter(
|
||||
RecyclerView.Adapter<WatchHistoryViewHolder>() {
|
||||
|
||||
fun removeFromWatchHistory(position: Int) {
|
||||
query {
|
||||
DatabaseHolder.Database.watchHistoryDao().delete(watchHistory[position])
|
||||
}
|
||||
watchHistory.removeAt(position)
|
||||
notifyItemRemoved(position)
|
||||
notifyItemRangeChanged(position, itemCount)
|
||||
|
Loading…
x
Reference in New Issue
Block a user