mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-30 08:18:00 +01:00
improve the scrollbar height calculation, take spacing into consideration
This commit is contained in:
parent
8bd9ee1c95
commit
23dfea83e6
1 changed files with 4 additions and 2 deletions
|
@ -707,7 +707,8 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener {
|
||||||
private fun calculateContentWidth(media: ArrayList<ThumbnailItem>) {
|
private fun calculateContentWidth(media: ArrayList<ThumbnailItem>) {
|
||||||
val layoutManager = media_grid.layoutManager as MyGridLayoutManager
|
val layoutManager = media_grid.layoutManager as MyGridLayoutManager
|
||||||
val thumbnailWidth = layoutManager.getChildAt(0)?.width ?: 0
|
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.setContentWidth(fullWidth)
|
||||||
media_horizontal_fastscroller.setScrollToX(media_grid.computeHorizontalScrollOffset())
|
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.setContentHeight(fullHeight)
|
||||||
media_vertical_fastscroller.setScrollToY(media_grid.computeVerticalScrollOffset())
|
media_vertical_fastscroller.setScrollToY(media_grid.computeVerticalScrollOffset())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue