From cd52e382e9e3698b38b0eff9aa6d091f3a77aef6 Mon Sep 17 00:00:00 2001 From: Bnyro Date: Sat, 4 Jun 2022 19:17:36 +0200 Subject: [PATCH] cleanup --- .../com/github/libretube/adapters/CommentsAdapter.kt | 10 +++++----- .../com/github/libretube/adapters/SearchAdapter.kt | 10 +++++----- .../com/github/libretube/adapters/TrendingAdapter.kt | 10 +++++----- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/app/src/main/java/com/github/libretube/adapters/CommentsAdapter.kt b/app/src/main/java/com/github/libretube/adapters/CommentsAdapter.kt index 7721a00c1..f2d75cd99 100644 --- a/app/src/main/java/com/github/libretube/adapters/CommentsAdapter.kt +++ b/app/src/main/java/com/github/libretube/adapters/CommentsAdapter.kt @@ -15,7 +15,7 @@ import com.github.libretube.obj.Comment import com.squareup.picasso.Picasso class CommentsAdapter(private val comments: MutableList) : - RecyclerView.Adapter() { + RecyclerView.Adapter() { fun updateItems(newItems: List) { var commentsSize = comments.size @@ -23,13 +23,13 @@ class CommentsAdapter(private val comments: MutableList) : 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(R.id.comment_infos).text = comments[position].author.toString() + " • " + comments[position].commentedTime.toString() @@ -68,7 +68,7 @@ class CommentsAdapter(private val comments: MutableList) : } } -class ViewHolder(val v: View) : RecyclerView.ViewHolder(v) { +class CommentsViewHolder(val v: View) : RecyclerView.ViewHolder(v) { init { } } diff --git a/app/src/main/java/com/github/libretube/adapters/SearchAdapter.kt b/app/src/main/java/com/github/libretube/adapters/SearchAdapter.kt index ced50de1d..f37c09928 100644 --- a/app/src/main/java/com/github/libretube/adapters/SearchAdapter.kt +++ b/app/src/main/java/com/github/libretube/adapters/SearchAdapter.kt @@ -23,7 +23,7 @@ class SearchAdapter( private val searchItems: MutableList, private val childFragmentManager: FragmentManager ) : - RecyclerView.Adapter() { + RecyclerView.Adapter() { fun updateItems(newItems: List) { 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) { diff --git a/app/src/main/java/com/github/libretube/adapters/TrendingAdapter.kt b/app/src/main/java/com/github/libretube/adapters/TrendingAdapter.kt index 6845eeca5..7d317ba48 100644 --- a/app/src/main/java/com/github/libretube/adapters/TrendingAdapter.kt +++ b/app/src/main/java/com/github/libretube/adapters/TrendingAdapter.kt @@ -23,18 +23,18 @@ import com.squareup.picasso.Picasso class TrendingAdapter( private val videoFeed: List, private val childFragmentManager: FragmentManager -) : RecyclerView.Adapter() { +) : RecyclerView.Adapter() { 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(R.id.textView_title).text = trending.title holder.v.findViewById(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 { } }