Skip to content

Commit 353618e

Browse files
committed
animate column count changes
1 parent d767098 commit 353618e

File tree

1 file changed

+6
-3
lines changed
  • app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments

1 file changed

+6
-3
lines changed

app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/ItemsFragment.kt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,7 @@ class ItemsFragment : Fragment(), ItemOperationsListener, Breadcrumbs.Breadcrumb
506506
}
507507
}
508508

509-
private fun calculateContentHeight(items: ArrayList<ListItem>) {
509+
private fun calculateContentHeight(items: MutableList<ListItem>) {
510510
val layoutManager = mView.items_list.layoutManager as MyGridLayoutManager
511511
val thumbnailHeight = layoutManager.getChildAt(0)?.height ?: 0
512512
val fullHeight = ((items.size - 1) / layoutManager.spanCount + 1) * thumbnailHeight
@@ -525,8 +525,11 @@ class ItemsFragment : Fragment(), ItemOperationsListener, Breadcrumbs.Breadcrumb
525525
}
526526

527527
private fun columnCountChanged() {
528-
mView.items_list.adapter?.notifyDataSetChanged()
529-
calculateContentHeight(storedItems)
528+
activity?.invalidateOptionsMenu()
529+
getRecyclerAdapter()?.apply {
530+
notifyItemRangeChanged(0, listItems.size)
531+
calculateContentHeight(listItems)
532+
}
530533
}
531534

532535
fun toggleFilenameVisibility() {

0 commit comments

Comments
 (0)