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

View File

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

View File

@ -125,7 +125,7 @@
<!-- Feed Groups dimensions--> <!-- Feed Groups dimensions-->
<dimen name="feed_group_carousel_start_end_margin">12dp</dimen> <dimen name="feed_group_carousel_start_end_margin">12dp</dimen>
<dimen name="feed_group_carousel_top_bottom_margin">12dp</dimen> <dimen name="feed_group_carousel_top_bottom_margin">6dp</dimen>
<dimen name="feed_group_carousel_between_items_margin">4dp</dimen> <dimen name="feed_group_carousel_between_items_margin">4dp</dimen>
<dimen name="search_suggestion_text_size">16sp</dimen> <dimen name="search_suggestion_text_size">16sp</dimen>