mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2025-01-18 06:17:59 +01:00
calculate the scrollview height properly for the scrollbar
This commit is contained in:
parent
a7c1789a55
commit
bcabc231e2
1 changed files with 3 additions and 2 deletions
|
@ -668,8 +668,9 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
|
||||||
|
|
||||||
private fun calculateContentHeight(directories: ArrayList<Directory>) {
|
private fun calculateContentHeight(directories: ArrayList<Directory>) {
|
||||||
val layoutManager = directories_grid.layoutManager as MyGridLayoutManager
|
val layoutManager = directories_grid.layoutManager as MyGridLayoutManager
|
||||||
val thumbnailHeight = layoutManager.getChildAt(0)?.height ?: 0
|
val thumbnailHeight = (layoutManager.getChildAt(0)?.height ?: 0) + (resources.getDimension(R.dimen.medium_margin).toInt() * 2)
|
||||||
val fullHeight = ((directories.size - 1) / layoutManager.spanCount + 1) * thumbnailHeight
|
val rowCount = (directories.size - 1) / layoutManager.spanCount + 1
|
||||||
|
val fullHeight = rowCount * thumbnailHeight
|
||||||
directories_vertical_fastscroller.setContentHeight(fullHeight)
|
directories_vertical_fastscroller.setContentHeight(fullHeight)
|
||||||
directories_vertical_fastscroller.setScrollToY(directories_grid.computeVerticalScrollOffset())
|
directories_vertical_fastscroller.setScrollToY(directories_grid.computeVerticalScrollOffset())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue