Ensure gridCenters are cleared when dimensions of grid change

This prevents an issue of items that can't be dropped onto the grid, because of missing center values
This commit is contained in:
Ensar Sarajčić 2023-07-19 10:02:20 +02:00
parent a429fba97f
commit 3a4f4b47a9

View file

@ -129,6 +129,7 @@ class HomeScreenGrid(context: Context, attrs: AttributeSet, defStyle: Int) : Rel
columnCount = newColumnCount columnCount = newColumnCount
cellXCoords = ArrayList(columnCount) cellXCoords = ArrayList(columnCount)
cellYCoords = ArrayList(rowCount) cellYCoords = ArrayList(rowCount)
gridCenters.clear()
iconMargin = (context.resources.getDimension(R.dimen.icon_side_margin) * 5 / columnCount).toInt() iconMargin = (context.resources.getDimension(R.dimen.icon_side_margin) * 5 / columnCount).toInt()
redrawWidgets = true redrawWidgets = true
redrawGrid() redrawGrid()