Fix wrongly calculated channel groups span count

This commit is contained in:
Stypox 2022-11-05 20:05:59 +01:00
parent fc061599f8
commit 49c12a31e9
No known key found for this signature in database
GPG Key ID: 4BDF1B40A49FDD23
1 changed files with 2 additions and 5 deletions

View File

@ -10,7 +10,7 @@ import com.xwray.groupie.viewbinding.GroupieViewHolder
import org.schabi.newpipe.R import org.schabi.newpipe.R
import org.schabi.newpipe.databinding.FeedItemCarouselBinding import org.schabi.newpipe.databinding.FeedItemCarouselBinding
import org.schabi.newpipe.util.DeviceUtils import org.schabi.newpipe.util.DeviceUtils
import java.lang.Integer.max import org.schabi.newpipe.util.ThemeHelper.getGridSpanCount
class FeedGroupCarouselItem( class FeedGroupCarouselItem(
private val carouselAdapter: GroupAdapter<GroupieViewHolder<FeedItemCarouselBinding>>, private val carouselAdapter: GroupAdapter<GroupieViewHolder<FeedItemCarouselBinding>>,
@ -71,10 +71,7 @@ class FeedGroupCarouselItem(
carouselLayoutManager = if (listViewMode) { carouselLayoutManager = if (listViewMode) {
LinearLayoutManager(context) LinearLayoutManager(context)
} else { } else {
GridLayoutManager( GridLayoutManager(context, getGridSpanCount(context, DeviceUtils.dpToPx(112, context)))
context,
max(1, viewBinding.recyclerView.width / DeviceUtils.dpToPx(112, context))
)
} }
viewBinding.recyclerView.apply { viewBinding.recyclerView.apply {