mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-14 06:10:31 +05:30
remove bad performing notifydatasetchanged
This commit is contained in:
parent
8f5de822d1
commit
ba21ebb99e
@ -38,8 +38,9 @@ class PlaylistAdapter(
|
||||
}
|
||||
|
||||
fun updateItems(newItems: List<StreamItem>) {
|
||||
val oldSize = videoFeed.size
|
||||
videoFeed.addAll(newItems)
|
||||
notifyDataSetChanged()
|
||||
notifyItemRangeInserted(oldSize, videoFeed.size)
|
||||
}
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): PlaylistViewHolder {
|
||||
|
@ -34,8 +34,9 @@ class PlaylistsAdapter(
|
||||
}
|
||||
|
||||
fun updateItems(newItems: List<Playlists>) {
|
||||
val oldSize = playlists.size
|
||||
playlists.addAll(newItems)
|
||||
notifyDataSetChanged()
|
||||
notifyItemRangeInserted(oldSize, playlists.size)
|
||||
}
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): PlaylistsViewHolder {
|
||||
@ -102,7 +103,9 @@ class PlaylistsAdapter(
|
||||
try {
|
||||
if (response.message == "ok") {
|
||||
playlists.removeAt(position)
|
||||
activity.runOnUiThread { notifyDataSetChanged() }
|
||||
activity.runOnUiThread {
|
||||
notifyItemRemoved(position)
|
||||
}
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
Log.e(TAG(), e.toString())
|
||||
|
@ -30,13 +30,14 @@ class SearchHistoryAdapter(
|
||||
historyText.text = historyQuery
|
||||
|
||||
deleteHistory.setOnClickListener {
|
||||
val itemIndex = historyList.indexOf(historyQuery)
|
||||
historyList -= historyQuery
|
||||
Thread {
|
||||
Database.searchHistoryDao().delete(
|
||||
SearchHistoryItem(query = historyQuery)
|
||||
)
|
||||
}.start()
|
||||
notifyDataSetChanged()
|
||||
notifyItemRemoved(itemIndex)
|
||||
}
|
||||
|
||||
root.setOnClickListener {
|
||||
|
@ -34,8 +34,9 @@ class TrendingAdapter(
|
||||
}
|
||||
|
||||
fun updateItems() {
|
||||
val oldSize = index
|
||||
index += 10
|
||||
notifyDataSetChanged()
|
||||
notifyItemRangeInserted(oldSize, index)
|
||||
}
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): SubscriptionViewHolder {
|
||||
|
@ -22,7 +22,7 @@ class WatchHistoryAdapter(
|
||||
fun removeFromWatchHistory(position: Int) {
|
||||
DatabaseHelper.removeFromWatchHistory(position)
|
||||
watchHistory.removeAt(position)
|
||||
notifyDataSetChanged()
|
||||
notifyItemRemoved(position)
|
||||
}
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): WatchHistoryViewHolder {
|
||||
|
Loading…
Reference in New Issue
Block a user