mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-14 14:20:30 +05:30
cleanup
This commit is contained in:
parent
ed35a28346
commit
cd52e382e9
@ -15,7 +15,7 @@ import com.github.libretube.obj.Comment
|
||||
import com.squareup.picasso.Picasso
|
||||
|
||||
class CommentsAdapter(private val comments: MutableList<Comment>) :
|
||||
RecyclerView.Adapter<ViewHolder>() {
|
||||
RecyclerView.Adapter<CommentsViewHolder>() {
|
||||
|
||||
fun updateItems(newItems: List<Comment>) {
|
||||
var commentsSize = comments.size
|
||||
@ -23,13 +23,13 @@ class CommentsAdapter(private val comments: MutableList<Comment>) :
|
||||
notifyItemRangeInserted(commentsSize, newItems.size)
|
||||
}
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): CommentsViewHolder {
|
||||
var commentsView =
|
||||
LayoutInflater.from(parent.context).inflate(R.layout.comments_row, parent, false)
|
||||
return ViewHolder(commentsView)
|
||||
return CommentsViewHolder(commentsView)
|
||||
}
|
||||
|
||||
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
||||
override fun onBindViewHolder(holder: CommentsViewHolder, position: Int) {
|
||||
holder.v.findViewById<TextView>(R.id.comment_infos).text =
|
||||
comments[position].author.toString() +
|
||||
" • " + comments[position].commentedTime.toString()
|
||||
@ -68,7 +68,7 @@ class CommentsAdapter(private val comments: MutableList<Comment>) :
|
||||
}
|
||||
}
|
||||
|
||||
class ViewHolder(val v: View) : RecyclerView.ViewHolder(v) {
|
||||
class CommentsViewHolder(val v: View) : RecyclerView.ViewHolder(v) {
|
||||
init {
|
||||
}
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ class SearchAdapter(
|
||||
private val searchItems: MutableList<SearchItem>,
|
||||
private val childFragmentManager: FragmentManager
|
||||
) :
|
||||
RecyclerView.Adapter<CustomViewHolder1>() {
|
||||
RecyclerView.Adapter<SearchViewHolder>() {
|
||||
|
||||
fun updateItems(newItems: List<SearchItem>) {
|
||||
var searchItemsSize = searchItems.size
|
||||
@ -35,7 +35,7 @@ class SearchAdapter(
|
||||
return searchItems.size
|
||||
}
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): CustomViewHolder1 {
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): SearchViewHolder {
|
||||
val layout = when (viewType) {
|
||||
0 -> R.layout.video_search_row
|
||||
1 -> R.layout.channel_search_row
|
||||
@ -44,10 +44,10 @@ class SearchAdapter(
|
||||
}
|
||||
val layoutInflater = LayoutInflater.from(parent.context)
|
||||
val cell = layoutInflater.inflate(layout, parent, false)
|
||||
return CustomViewHolder1(cell, childFragmentManager)
|
||||
return SearchViewHolder(cell, childFragmentManager)
|
||||
}
|
||||
|
||||
override fun onBindViewHolder(holder: CustomViewHolder1, position: Int) {
|
||||
override fun onBindViewHolder(holder: SearchViewHolder, position: Int) {
|
||||
holder.bind(searchItems[position])
|
||||
}
|
||||
|
||||
@ -61,7 +61,7 @@ class SearchAdapter(
|
||||
}
|
||||
}
|
||||
|
||||
class CustomViewHolder1(
|
||||
class SearchViewHolder(
|
||||
private val v: View,
|
||||
private val childFragmentManager: FragmentManager
|
||||
) : RecyclerView.ViewHolder(v) {
|
||||
|
@ -23,18 +23,18 @@ import com.squareup.picasso.Picasso
|
||||
class TrendingAdapter(
|
||||
private val videoFeed: List<StreamItem>,
|
||||
private val childFragmentManager: FragmentManager
|
||||
) : RecyclerView.Adapter<CustomViewHolder>() {
|
||||
) : RecyclerView.Adapter<TrendingViewHolder>() {
|
||||
override fun getItemCount(): Int {
|
||||
return videoFeed.size
|
||||
}
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): CustomViewHolder {
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): TrendingViewHolder {
|
||||
val layoutInflater = LayoutInflater.from(parent.context)
|
||||
val cell = layoutInflater.inflate(R.layout.trending_row, parent, false)
|
||||
return CustomViewHolder(cell)
|
||||
return TrendingViewHolder(cell)
|
||||
}
|
||||
|
||||
override fun onBindViewHolder(holder: CustomViewHolder, position: Int) {
|
||||
override fun onBindViewHolder(holder: TrendingViewHolder, position: Int) {
|
||||
val trending = videoFeed[position]
|
||||
holder.v.findViewById<TextView>(R.id.textView_title).text = trending.title
|
||||
holder.v.findViewById<TextView>(R.id.textView_channel).text =
|
||||
@ -89,7 +89,7 @@ class TrendingAdapter(
|
||||
}
|
||||
}
|
||||
|
||||
class CustomViewHolder(val v: View) : RecyclerView.ViewHolder(v) {
|
||||
class TrendingViewHolder(val v: View) : RecyclerView.ViewHolder(v) {
|
||||
init {
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user