[Android] Make the video grid at least 2 columns wide
Nicolas Pomepuy
git at videolan.org
Tue Apr 5 14:30:09 UTC 2022
vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Tue Apr 5 14:40:23 2022 +0200| [37d38232a3884b25a88b9bdf35e14b7f522a6b07] | committer: Nicolas Pomepuy
Make the video grid at least 2 columns wide
Fixes #2303
> https://code.videolan.org/videolan/vlc-android/commit/37d38232a3884b25a88b9bdf35e14b7f522a6b07
---
.../vlc-android/src/org/videolan/vlc/gui/view/AutoFitRecyclerView.kt | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/view/AutoFitRecyclerView.kt b/application/vlc-android/src/org/videolan/vlc/gui/view/AutoFitRecyclerView.kt
index cc3352cc1..23fa14824 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/view/AutoFitRecyclerView.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/view/AutoFitRecyclerView.kt
@@ -64,7 +64,7 @@ class AutoFitRecyclerView : RecyclerView {
super.onMeasure(widthSpec, heightSpec)
if (spanCount == -1 && columnWidth > 0) {
val ratio = measuredWidth / columnWidth
- val spanCount = Math.max(1, ratio)
+ val spanCount = 2.coerceAtLeast(ratio)
gridLayoutManager!!.spanCount = spanCount
} else
gridLayoutManager!!.spanCount = spanCount
@@ -79,7 +79,7 @@ class AutoFitRecyclerView : RecyclerView {
val remainingSpace = displayWidth % columnWidth
val ratio = displayWidth / columnWidth
- val spanCount = Math.max(1, ratio)
+ val spanCount = 2.coerceAtLeast(ratio)
return columnWidth + remainingSpace / spanCount
}
More information about the Android
mailing list