Prevent calculating folder centers when there are no items
This commit is contained in:
parent
28e0f2d59f
commit
0a239b1d06
|
@ -1588,6 +1588,10 @@ class HomeScreenGrid(context: Context, attrs: AttributeSet, defStyle: Int) : Rel
|
|||
|
||||
fun getItemsGridCenters(): List<Triple<Int, Int, Int>> {
|
||||
val count = getItems().count()
|
||||
if (count == 0) {
|
||||
return emptyList()
|
||||
}
|
||||
|
||||
val columnsCount = ceil(sqrt(count.toDouble())).roundToInt()
|
||||
val rowsCount = ceil(count.toFloat() / columnsCount).roundToInt()
|
||||
val folderItemsRect = getItemsDrawingRect()
|
||||
|
|
Loading…
Reference in New Issue