recalculate the list height in some cases
This commit is contained in:
parent
af5862f045
commit
d14cf23803
|
@ -189,6 +189,7 @@ class ItemsFragment : Fragment(), ItemOperationsListener, Breadcrumbs.Breadcrumb
|
||||||
getRecyclerLayoutManager().onRestoreInstanceState(scrollStates[currentPath])
|
getRecyclerLayoutManager().onRestoreInstanceState(scrollStates[currentPath])
|
||||||
items_list.onGlobalLayout {
|
items_list.onGlobalLayout {
|
||||||
items_fastscroller.setScrollToY(items_list.computeVerticalScrollOffset())
|
items_fastscroller.setScrollToY(items_list.computeVerticalScrollOffset())
|
||||||
|
calculateContentHeight(storedItems)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -469,6 +470,14 @@ class ItemsFragment : Fragment(), ItemOperationsListener, Breadcrumbs.Breadcrumb
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun calculateContentHeight(items: ArrayList<ListItem>) {
|
||||||
|
val layoutManager = mView.items_list.layoutManager as MyGridLayoutManager
|
||||||
|
val thumbnailHeight = layoutManager.getChildAt(0)?.height ?: 0
|
||||||
|
val fullHeight = ((items.size - 1) / layoutManager.spanCount + 1) * thumbnailHeight
|
||||||
|
mView.items_fastscroller.setContentHeight(fullHeight)
|
||||||
|
mView.items_fastscroller.setScrollToY(mView.items_list.computeVerticalScrollOffset())
|
||||||
|
}
|
||||||
|
|
||||||
fun increaseColumnCount() {
|
fun increaseColumnCount() {
|
||||||
context?.config?.fileColumnCnt = ++(mView.items_list.layoutManager as MyGridLayoutManager).spanCount
|
context?.config?.fileColumnCnt = ++(mView.items_list.layoutManager as MyGridLayoutManager).spanCount
|
||||||
columnCountChanged()
|
columnCountChanged()
|
||||||
|
@ -481,6 +490,7 @@ class ItemsFragment : Fragment(), ItemOperationsListener, Breadcrumbs.Breadcrumb
|
||||||
|
|
||||||
private fun columnCountChanged() {
|
private fun columnCountChanged() {
|
||||||
mView.items_list.adapter?.notifyDataSetChanged()
|
mView.items_list.adapter?.notifyDataSetChanged()
|
||||||
|
calculateContentHeight(storedItems)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun breadcrumbClicked(id: Int) {
|
override fun breadcrumbClicked(id: Int) {
|
||||||
|
|
Loading…
Reference in New Issue