Fix wrongly calculated channel groups span count
This commit is contained in:
parent
fc061599f8
commit
49c12a31e9
|
@ -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 {
|
||||||
|
|
Loading…
Reference in New Issue