From 185e4dcb6cf45e2b36fe0ad94b3072156ea3116a Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 24 Jun 2018 18:31:31 +0200 Subject: [PATCH] recalculate fastscroller position at measuring content --- .../gallery/activities/MediaActivity.kt | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt index d28e528a3..61721dbca 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt @@ -614,6 +614,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { fullHeight += ((curSectionItems - 1) / layoutManager.spanCount + 1) * mThumbnailHeight media_vertical_fastscroller.setContentHeight(fullHeight) + media_vertical_fastscroller.setScrollTo(media_grid.computeVerticalScrollOffset()) } } @@ -650,13 +651,15 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { private fun increaseColumnCount() { config.mediaColumnCnt = ++(media_grid.layoutManager as MyGridLayoutManager).spanCount - invalidateOptionsMenu() - media_grid.adapter?.notifyDataSetChanged() - measureRecyclerViewContent(mMedia) + columnCountChanged() } private fun reduceColumnCount() { config.mediaColumnCnt = --(media_grid.layoutManager as MyGridLayoutManager).spanCount + columnCountChanged() + } + + private fun columnCountChanged() { invalidateOptionsMenu() media_grid.adapter?.notifyDataSetChanged() measureRecyclerViewContent(mMedia)