From 49c12a31e9a5b87bcb6648577bfdbedb68ca0bd1 Mon Sep 17 00:00:00 2001 From: Stypox Date: Sat, 5 Nov 2022 20:05:59 +0100 Subject: [PATCH] Fix wrongly calculated channel groups span count --- .../local/subscription/item/FeedGroupCarouselItem.kt | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) 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 ad1e7e690..bf9f9072f 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 @@ -10,7 +10,7 @@ import com.xwray.groupie.viewbinding.GroupieViewHolder import org.schabi.newpipe.R import org.schabi.newpipe.databinding.FeedItemCarouselBinding import org.schabi.newpipe.util.DeviceUtils -import java.lang.Integer.max +import org.schabi.newpipe.util.ThemeHelper.getGridSpanCount class FeedGroupCarouselItem( private val carouselAdapter: GroupAdapter>, @@ -71,10 +71,7 @@ class FeedGroupCarouselItem( carouselLayoutManager = if (listViewMode) { LinearLayoutManager(context) } else { - GridLayoutManager( - context, - max(1, viewBinding.recyclerView.width / DeviceUtils.dpToPx(112, context)) - ) + GridLayoutManager(context, getGridSpanCount(context, DeviceUtils.dpToPx(112, context))) } viewBinding.recyclerView.apply {