From bcabc231e2f9e4950a0d2496db27da436b2b9e7c Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 1 Nov 2020 22:20:02 +0100 Subject: [PATCH] calculate the scrollview height properly for the scrollbar --- .../simplemobiletools/gallery/pro/activities/MainActivity.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MainActivity.kt index 42ef17836..542c1f8fd 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MainActivity.kt @@ -668,8 +668,9 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener { private fun calculateContentHeight(directories: ArrayList) { val layoutManager = directories_grid.layoutManager as MyGridLayoutManager - val thumbnailHeight = layoutManager.getChildAt(0)?.height ?: 0 - val fullHeight = ((directories.size - 1) / layoutManager.spanCount + 1) * thumbnailHeight + val thumbnailHeight = (layoutManager.getChildAt(0)?.height ?: 0) + (resources.getDimension(R.dimen.medium_margin).toInt() * 2) + val rowCount = (directories.size - 1) / layoutManager.spanCount + 1 + val fullHeight = rowCount * thumbnailHeight directories_vertical_fastscroller.setContentHeight(fullHeight) directories_vertical_fastscroller.setScrollToY(directories_grid.computeVerticalScrollOffset()) }