mirror of
https://github.com/SimpleMobileTools/Simple-Launcher.git
synced 2025-04-22 22:07:19 +02:00
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>> {
|
fun getItemsGridCenters(): List<Triple<Int, Int, Int>> {
|
||||||
val count = getItems().count()
|
val count = getItems().count()
|
||||||
|
if (count == 0) {
|
||||||
|
return emptyList()
|
||||||
|
}
|
||||||
|
|
||||||
val columnsCount = ceil(sqrt(count.toDouble())).roundToInt()
|
val columnsCount = ceil(sqrt(count.toDouble())).roundToInt()
|
||||||
val rowsCount = ceil(count.toFloat() / columnsCount).roundToInt()
|
val rowsCount = ceil(count.toFloat() / columnsCount).roundToInt()
|
||||||
val folderItemsRect = getItemsDrawingRect()
|
val folderItemsRect = getItemsDrawingRect()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user