recalculate fastscroller position at measuring content

This commit is contained in:
tibbi 2018-06-24 18:31:31 +02:00
parent 8e4aa5b438
commit 185e4dcb6c

View file

@ -614,6 +614,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
fullHeight += ((curSectionItems - 1) / layoutManager.spanCount + 1) * mThumbnailHeight fullHeight += ((curSectionItems - 1) / layoutManager.spanCount + 1) * mThumbnailHeight
media_vertical_fastscroller.setContentHeight(fullHeight) media_vertical_fastscroller.setContentHeight(fullHeight)
media_vertical_fastscroller.setScrollTo(media_grid.computeVerticalScrollOffset())
} }
} }
@ -650,13 +651,15 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
private fun increaseColumnCount() { private fun increaseColumnCount() {
config.mediaColumnCnt = ++(media_grid.layoutManager as MyGridLayoutManager).spanCount config.mediaColumnCnt = ++(media_grid.layoutManager as MyGridLayoutManager).spanCount
invalidateOptionsMenu() columnCountChanged()
media_grid.adapter?.notifyDataSetChanged()
measureRecyclerViewContent(mMedia)
} }
private fun reduceColumnCount() { private fun reduceColumnCount() {
config.mediaColumnCnt = --(media_grid.layoutManager as MyGridLayoutManager).spanCount config.mediaColumnCnt = --(media_grid.layoutManager as MyGridLayoutManager).spanCount
columnCountChanged()
}
private fun columnCountChanged() {
invalidateOptionsMenu() invalidateOptionsMenu()
media_grid.adapter?.notifyDataSetChanged() media_grid.adapter?.notifyDataSetChanged()
measureRecyclerViewContent(mMedia) measureRecyclerViewContent(mMedia)