From 78547b4fa464cac863e63e07f30529528703dad7 Mon Sep 17 00:00:00 2001 From: Samuel Wu Date: Mon, 24 Oct 2022 18:55:08 +1100 Subject: [PATCH] Created a list view for channel group. --- .../decoration/FeedGroupCarouselDecoration.kt | 2 +- .../subscription/item/FeedGroupCardItem.kt | 2 +- .../item/FeedGroupCarouselItem.kt | 2 +- .../main/res/layout/feed_group_list_item.xml | 43 +++++++++++++++++++ 4 files changed, 46 insertions(+), 3 deletions(-) create mode 100644 app/src/main/res/layout/feed_group_list_item.xml diff --git a/app/src/main/java/org/schabi/newpipe/local/subscription/decoration/FeedGroupCarouselDecoration.kt b/app/src/main/java/org/schabi/newpipe/local/subscription/decoration/FeedGroupCarouselDecoration.kt index 7b7490eaa..a113a8b41 100644 --- a/app/src/main/java/org/schabi/newpipe/local/subscription/decoration/FeedGroupCarouselDecoration.kt +++ b/app/src/main/java/org/schabi/newpipe/local/subscription/decoration/FeedGroupCarouselDecoration.kt @@ -26,7 +26,7 @@ class FeedGroupCarouselDecoration(context: Context) : RecyclerView.ItemDecoratio outRect.set(marginBetweenItems, marginTopBottom, 0, marginTopBottom) - if (childAdapterPosition == 0) { + if (childAdapterPosition >= 0) { outRect.left = marginStartEnd } else if (childAdapterPosition == childAdapterCount - 1) { outRect.right = marginStartEnd diff --git a/app/src/main/java/org/schabi/newpipe/local/subscription/item/FeedGroupCardItem.kt b/app/src/main/java/org/schabi/newpipe/local/subscription/item/FeedGroupCardItem.kt index 7b78b3d95..fd8a75da1 100644 --- a/app/src/main/java/org/schabi/newpipe/local/subscription/item/FeedGroupCardItem.kt +++ b/app/src/main/java/org/schabi/newpipe/local/subscription/item/FeedGroupCardItem.kt @@ -21,7 +21,7 @@ data class FeedGroupCardItem( } } - override fun getLayout(): Int = R.layout.feed_group_card_item + override fun getLayout(): Int = R.layout.feed_group_list_item override fun bind(viewBinding: FeedGroupCardItemBinding, position: Int) { viewBinding.title.text = name 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 44af16280..031eb9b18 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 @@ -36,7 +36,7 @@ class FeedGroupCarouselItem( override fun initializeViewBinding(view: View): FeedItemCarouselBinding { val viewHolder = FeedItemCarouselBinding.bind(view) - linearLayoutManager = LinearLayoutManager(view.context, RecyclerView.HORIZONTAL, false) + linearLayoutManager = LinearLayoutManager(view.context, RecyclerView.VERTICAL, false) viewHolder.recyclerView.apply { layoutManager = linearLayoutManager diff --git a/app/src/main/res/layout/feed_group_list_item.xml b/app/src/main/res/layout/feed_group_list_item.xml new file mode 100644 index 000000000..c49da1eab --- /dev/null +++ b/app/src/main/res/layout/feed_group_list_item.xml @@ -0,0 +1,43 @@ + + + + + + + + + +