[Android] Fix item size on TV

Nicolas Pomepuy git at videolan.org
Thu Jun 13 14:44:58 CEST 2019


vlc-android | branch: master | Nicolas Pomepuy <nicolas.pomepuy at gmail.com> | Wed Jun 12 10:17:51 2019 +0200| [8a658134708f16a2303d1e2972d86d87a3146622] | committer: Geoffrey Métais

Fix item size on TV

> https://code.videolan.org/videolan/vlc-android/commit/8a658134708f16a2303d1e2972d86d87a3146622
---

 .../src/org/videolan/vlc/gui/tv/browser/BaseBrowserTvFragment.kt      | 4 ++--
 .../org/videolan/vlc/gui/view/RecyclerSectionItemGridDecoration.kt    | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/tv/browser/BaseBrowserTvFragment.kt b/vlc-android/src/org/videolan/vlc/gui/tv/browser/BaseBrowserTvFragment.kt
index f592c78eb..298138c38 100644
--- a/vlc-android/src/org/videolan/vlc/gui/tv/browser/BaseBrowserTvFragment.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/tv/browser/BaseBrowserTvFragment.kt
@@ -136,10 +136,10 @@ abstract class BaseBrowserTvFragment : Fragment(), BrowserFragmentInterface, IEv
             override fun requestChildRectangleOnScreen(parent: RecyclerView, child: View, rect: Rect, immediate: Boolean, focusedChildVisible: Boolean) = false
         }
 
-        spacing = resources.getDimensionPixelSize(R.dimen.kl_small)
+        spacing = resources.getDimensionPixelSize(R.dimen.kl_half)
 
         //size of an item
-        val itemSize = RecyclerSectionItemGridDecoration.getItemSize(requireActivity().getScreenWidth() - list.paddingLeft - list.paddingRight, viewModel.nbColumns, spacing)
+        val itemSize = RecyclerSectionItemGridDecoration.getItemSize(requireActivity().getScreenWidth(), viewModel.nbColumns, spacing)
 
         gridLayoutManager.spanSizeLookup = object : GridLayoutManager.SpanSizeLookup() {
             override fun getSpanSize(position: Int): Int {
diff --git a/vlc-android/src/org/videolan/vlc/gui/view/RecyclerSectionItemGridDecoration.kt b/vlc-android/src/org/videolan/vlc/gui/view/RecyclerSectionItemGridDecoration.kt
index 246cd0533..e833d841c 100644
--- a/vlc-android/src/org/videolan/vlc/gui/view/RecyclerSectionItemGridDecoration.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/view/RecyclerSectionItemGridDecoration.kt
@@ -128,6 +128,6 @@ class RecyclerSectionItemGridDecoration(private val headerOffset: Int, private v
     }
 
     companion object {
-        fun getItemSize(screenWidth: Int, nbColumns: Int, spacing: Int) = (screenWidth - spacing * 2) / nbColumns - spacing * nbColumns
+        fun getItemSize(screenWidth: Int, nbColumns: Int, spacing: Int) = ((screenWidth - spacing * 2) / nbColumns) - (spacing * nbColumns)
     }
 }



More information about the Android mailing list