mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-14 22:30:30 +05:30
Merge pull request #4379 from Bnyro/master
chore: simplify RecyclerView.Adapter#getItemCount where possible
This commit is contained in:
commit
18698b4b62
@ -35,7 +35,5 @@ class BottomSheetAdapter(
|
||||
}
|
||||
}
|
||||
|
||||
override fun getItemCount(): Int {
|
||||
return items.size
|
||||
}
|
||||
override fun getItemCount() = items.size
|
||||
}
|
||||
|
@ -134,7 +134,5 @@ class CommentsAdapter(
|
||||
}
|
||||
}
|
||||
|
||||
override fun getItemCount(): Int {
|
||||
return comments.size
|
||||
}
|
||||
override fun getItemCount() = comments.size
|
||||
}
|
||||
|
@ -141,7 +141,5 @@ class DownloadsAdapter(
|
||||
notifyItemInserted(position)
|
||||
}
|
||||
|
||||
override fun getItemCount(): Int {
|
||||
return downloads.size
|
||||
}
|
||||
override fun getItemCount() = downloads.size
|
||||
}
|
||||
|
@ -18,9 +18,7 @@ class IconsSheetAdapter : RecyclerView.Adapter<IconsSheetViewHolder>() {
|
||||
return IconsSheetViewHolder(binding)
|
||||
}
|
||||
|
||||
override fun getItemCount(): Int {
|
||||
return availableIcons.size
|
||||
}
|
||||
override fun getItemCount() = availableIcons.size
|
||||
|
||||
override fun onBindViewHolder(holder: IconsSheetViewHolder, position: Int) {
|
||||
val appIcon = availableIcons[position]
|
||||
|
@ -47,7 +47,5 @@ class LegacySubscriptionAdapter(
|
||||
}
|
||||
}
|
||||
|
||||
override fun getItemCount(): Int {
|
||||
return subscriptions.size
|
||||
}
|
||||
override fun getItemCount() = subscriptions.size
|
||||
}
|
||||
|
@ -22,9 +22,7 @@ class NavBarOptionsAdapter(
|
||||
return NavBarOptionsViewHolder(binding)
|
||||
}
|
||||
|
||||
override fun getItemCount(): Int {
|
||||
return items.size
|
||||
}
|
||||
override fun getItemCount() = items.size
|
||||
|
||||
override fun onBindViewHolder(holder: NavBarOptionsViewHolder, position: Int) {
|
||||
val item = items[position]
|
||||
|
@ -24,9 +24,7 @@ class PlayingQueueAdapter : RecyclerView.Adapter<PlayingQueueViewHolder>() {
|
||||
return PlayingQueueViewHolder(binding)
|
||||
}
|
||||
|
||||
override fun getItemCount(): Int {
|
||||
return PlayingQueue.size()
|
||||
}
|
||||
override fun getItemCount() = PlayingQueue.size()
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
override fun onBindViewHolder(holder: PlayingQueueViewHolder, position: Int) {
|
||||
|
@ -18,9 +18,7 @@ class PlaylistsAdapter(
|
||||
private val playlistType: PlaylistType
|
||||
) : RecyclerView.Adapter<PlaylistsViewHolder>() {
|
||||
|
||||
override fun getItemCount(): Int {
|
||||
return playlists.size
|
||||
}
|
||||
override fun getItemCount() = playlists.size
|
||||
|
||||
fun updateItems(newItems: List<Playlists>) {
|
||||
val oldSize = playlists.size
|
||||
|
@ -18,9 +18,7 @@ class SearchHistoryAdapter(
|
||||
) :
|
||||
RecyclerView.Adapter<SuggestionsViewHolder>() {
|
||||
|
||||
override fun getItemCount(): Int {
|
||||
return historyList.size
|
||||
}
|
||||
override fun getItemCount() = historyList.size
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): SuggestionsViewHolder {
|
||||
val layoutInflater = LayoutInflater.from(parent.context)
|
||||
|
@ -13,9 +13,7 @@ class SearchSuggestionsAdapter(
|
||||
) :
|
||||
RecyclerView.Adapter<SuggestionsViewHolder>() {
|
||||
|
||||
override fun getItemCount(): Int {
|
||||
return suggestionsList.size
|
||||
}
|
||||
override fun getItemCount() = suggestionsList.size
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): SuggestionsViewHolder {
|
||||
val layoutInflater = LayoutInflater.from(parent.context)
|
||||
|
@ -17,9 +17,7 @@ class SubscriptionChannelAdapter(
|
||||
private val subscriptions: MutableList<Subscription>
|
||||
) : RecyclerView.Adapter<SubscriptionChannelViewHolder>() {
|
||||
|
||||
override fun getItemCount(): Int {
|
||||
return subscriptions.size
|
||||
}
|
||||
override fun getItemCount() = subscriptions.size
|
||||
|
||||
override fun onCreateViewHolder(
|
||||
parent: ViewGroup,
|
||||
|
@ -24,7 +24,7 @@ class WatchHistoryAdapter(
|
||||
|
||||
private var visibleCount = minOf(10, watchHistory.size)
|
||||
|
||||
override fun getItemCount(): Int = visibleCount
|
||||
override fun getItemCount() = visibleCount
|
||||
|
||||
fun removeFromWatchHistory(position: Int) {
|
||||
val history = watchHistory[position]
|
||||
|
Loading…
Reference in New Issue
Block a user