Prevent resizing widgets over bottom row

This commit is contained in:
Ensar Sarajčić 2023-07-17 13:09:04 +02:00
parent 209c74e99b
commit 1c114f782e
1 changed files with 6 additions and 2 deletions

View File

@ -218,10 +218,14 @@ class HomeScreenGrid(context: Context, attrs: AttributeSet, defStyle: Int) : Rel
item.left = cellsRect.left item.left = cellsRect.left
item.top = cellsRect.top item.top = cellsRect.top
item.right = cellsRect.right item.right = cellsRect.right
item.bottom = cellsRect.bottom item.bottom = if (cellsRect.bottom > rowCount - 2) {
rowCount - 2
} else {
cellsRect.bottom
}
updateWidgetPositionAndSize(widgetView, item) updateWidgetPositionAndSize(widgetView, item)
ensureBackgroundThread { ensureBackgroundThread {
context.homeScreenGridItemsDB.updateItemPosition(cellsRect.left, cellsRect.top, cellsRect.right, cellsRect.bottom, item.id!!) context.homeScreenGridItemsDB.updateItemPosition(item.left, item.top, item.right, item.bottom, item.id!!)
} }
} }