Prevent calculating folder centers when there are no items
This commit is contained in:
parent
28e0f2d59f
commit
0a239b1d06
1 changed files with 4 additions and 0 deletions
|
@ -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 a new issue