Prevent drawing empty folders
This commit is contained in:
parent
81dff807b4
commit
a7ffb6328a
1 changed files with 5 additions and 2 deletions
|
@ -1536,8 +1536,11 @@ class HomeScreenGrid(context: Context, attrs: AttributeSet, defStyle: Int) : Rel
|
|||
|
||||
private fun HomeScreenGridItem.getFolderRect(): RectF {
|
||||
val count = getFolderItems().count()
|
||||
val columnsCount = ceil(sqrt(count.toDouble())).roundToInt()
|
||||
val rowsCount = ceil(count.toFloat() / columnsCount).roundToInt()
|
||||
if (count == 0) {
|
||||
return RectF(0f, 0f, 0f, 0f)
|
||||
}
|
||||
val columnsCount = ceil(sqrt(count.toDouble())).toInt()
|
||||
val rowsCount = ceil(count.toFloat() / columnsCount).toInt()
|
||||
val centerX = cellXCoords[left] + cellWidth / 2 + sideMargins.left
|
||||
val centerY = cellYCoords[top] + cellHeight / 2 + sideMargins.top
|
||||
val folderDialogWidth = (columnsCount * cellWidth + 2 * folderPadding)
|
||||
|
|
Loading…
Reference in a new issue