From f7e10eb094c841e427638c86bff37a8200d5b146 Mon Sep 17 00:00:00 2001 From: Samuel Wu Date: Wed, 26 Oct 2022 21:05:55 +1100 Subject: [PATCH] Fully working card and list view --- .../newpipe/local/subscription/SubscriptionFragment.kt | 4 ++-- .../local/subscription/item/FeedGroupCarouselItem.kt | 6 ++++-- app/src/main/res/values/dimens.xml | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/local/subscription/SubscriptionFragment.kt b/app/src/main/java/org/schabi/newpipe/local/subscription/SubscriptionFragment.kt index 348dd5897..0ee77b4ee 100644 --- a/app/src/main/java/org/schabi/newpipe/local/subscription/SubscriptionFragment.kt +++ b/app/src/main/java/org/schabi/newpipe/local/subscription/SubscriptionFragment.kt @@ -276,7 +276,7 @@ class SubscriptionFragment : BaseStateFragment() { 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() { 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), diff --git a/app/src/main/java/org/schabi/newpipe/local/subscription/item/FeedGroupCarouselItem.kt b/app/src/main/java/org/schabi/newpipe/local/subscription/item/FeedGroupCarouselItem.kt index 01f058913..e53693cc8 100644 --- a/app/src/main/java/org/schabi/newpipe/local/subscription/item/FeedGroupCarouselItem.kt +++ b/app/src/main/java/org/schabi/newpipe/local/subscription/item/FeedGroupCarouselItem.kt @@ -15,7 +15,8 @@ import org.schabi.newpipe.local.subscription.decoration.FeedGroupCarouselDecorat class FeedGroupCarouselItem( context: Context, private val carouselAdapter: GroupAdapter>, - private var listView: Int + private var listView: Int, + private var isGridLayout: Boolean ) : BindableItem() { 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 } diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml index ad0e029dd..9f7e50c19 100644 --- a/app/src/main/res/values/dimens.xml +++ b/app/src/main/res/values/dimens.xml @@ -125,7 +125,7 @@ 12dp - 12dp + 6dp 4dp 16sp