You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] Bad grid mode after changing orientation #4884
Confirmed. Root cause: the grid column count is never recomputed on rotation.
spanCount for grid mode is set from ColumnQuantity.calculateNoOfColumns() only at init (MainFileListFragment.kt:394) and on the view-type toggle (MainFileListFragment.kt:1006).
onConfigurationChanged (MainFileListFragment.kt:332) calls updateConfigDependentSizes() (:337), which resizes only the space-header card and empty-state icon — it does not touch layoutManager.spanCount.
calculateNoOfColumns() is width-dependent (ColumnQuantity.kt:45, uses displayMetrics.widthPixels), so the count computed in landscape (wide → more columns) stays applied after rotating to portrait (narrow), overlapping items. Matches the repro (set grid in landscape, rotate to portrait).
Fix outline: recompute and reapply the grid span in updateConfigDependentSizes() when the current view type is grid, e.g. if (viewType == ViewType.VIEW_TYPE_GRID) layoutManager.spanCount = ColumnQuantity(requireContext(), R.layout.grid_item).calculateNoOfColumns(), then re-lay-out.
Aside: calculateNoOfColumns() at ColumnQuantity.kt:48 computes numberOfColumns.minus(1) but discards the result (not reassigned) — the intended column reduction is a no-op. Worth fixing alongside.
Steps to reproduce
Actual behaviour
Icons and thumbnails are overlapped like:
Expected behaviour
Correctly displayed like:
Xiaomi Redmi Note 13
Android 15