1
0
Fork 0
mirror of https://github.com/TeamNewPipe/NewPipe.git synced 2025-10-06 03:50:22 +02:00

Fully working card and list view

This commit is contained in:
Samuel Wu 2022-10-26 21:05:55 +11:00
parent c607089cbb
commit f7e10eb094
3 changed files with 7 additions and 5 deletions

View file

@ -276,7 +276,7 @@ class SubscriptionFragment : BaseStateFragment<SubscriptionState>() {
return@setOnItemLongClickListener true
}
feedGroupsCarousel = FeedGroupCarouselItem(requireContext(), carouselAdapter, RecyclerView.HORIZONTAL)
feedGroupsCarousel = FeedGroupCarouselItem(requireContext(), carouselAdapter, RecyclerView.HORIZONTAL, true)
feedGroupsSortMenuItem = HeaderWithMenuItem(
getString(R.string.feed_groups_header_title),
@ -326,7 +326,7 @@ class SubscriptionFragment : BaseStateFragment<SubscriptionState>() {
listenerFeedVerticalGroups.held(item)
return@setOnItemLongClickListener true
}
feedGroupsCarousel = FeedGroupCarouselItem(requireContext(), carouselAdapter, RecyclerView.VERTICAL)
feedGroupsCarousel = FeedGroupCarouselItem(requireContext(), carouselAdapter, RecyclerView.VERTICAL, false)
feedGroupsSortMenuItem = HeaderWithMenuItem(
getString(R.string.feed_groups_header_title),

View file

@ -15,7 +15,8 @@ import org.schabi.newpipe.local.subscription.decoration.FeedGroupCarouselDecorat
class FeedGroupCarouselItem(
context: Context,
private val carouselAdapter: GroupAdapter<GroupieViewHolder<FeedItemCarouselBinding>>,
private var listView: Int
private var listView: Int,
private var isGridLayout: Boolean
) : BindableItem<FeedItemCarouselBinding>() {
private val feedGroupCarouselDecoration = FeedGroupCarouselDecoration(context)
@ -44,7 +45,8 @@ class FeedGroupCarouselItem(
adapter = carouselAdapter
addItemDecoration(feedGroupCarouselDecoration)
}
viewHolder.recyclerView.setLayoutManager(GridLayoutManager(view.context, 3))
if (isGridLayout)
viewHolder.recyclerView.setLayoutManager(GridLayoutManager(view.context, 3))
return viewHolder
}