From 23dfea83e6b2309543004b534380359cdb37b92a Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 20 Jan 2021 12:28:02 +0100 Subject: [PATCH] improve the scrollbar height calculation, take spacing into consideration --- .../gallery/pro/activities/MediaActivity.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MediaActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MediaActivity.kt index ed1e71546..6f4b09cb1 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MediaActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MediaActivity.kt @@ -707,7 +707,8 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener { private fun calculateContentWidth(media: ArrayList) { val layoutManager = media_grid.layoutManager as MyGridLayoutManager val thumbnailWidth = layoutManager.getChildAt(0)?.width ?: 0 - val fullWidth = ((media.size - 1) / layoutManager.spanCount + 1) * thumbnailWidth + val spacing = config.thumbnailSpacing + val fullWidth = ((media.size - 1) / layoutManager.spanCount + 1) * (thumbnailWidth + spacing) - spacing media_horizontal_fastscroller.setContentWidth(fullWidth) media_horizontal_fastscroller.setScrollToX(media_grid.computeHorizontalScrollOffset()) } @@ -734,7 +735,8 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener { } } - fullHeight += ((curSectionItems - 1) / layoutManager.spanCount + 1) * thumbnailHeight + val spacing = config.thumbnailSpacing + fullHeight += ((curSectionItems - 1) / layoutManager.spanCount + 1) * (thumbnailHeight + spacing) - spacing media_vertical_fastscroller.setContentHeight(fullHeight) media_vertical_fastscroller.setScrollToY(media_grid.computeVerticalScrollOffset()) }