Remove widgets that are out of bounds if they are blocking dropped icon

This commit is contained in:
Ensar Sarajčić 2023-09-22 13:27:26 +02:00
parent 2349fa019c
commit 200109e527
1 changed files with 12 additions and 1 deletions

View File

@ -532,7 +532,18 @@ class HomeScreenGrid(context: Context, attrs: AttributeSet, defStyle: Int) : Rel
if (item.type != ITEM_TYPE_WIDGET && !item.docked) {
potentialParent = item
} else {
isDroppingPositionValid = false
if (item.type == ITEM_TYPE_WIDGET && item.outOfBounds()) {
ensureBackgroundThread {
removeItemFromHomeScreen(item)
post {
removeView(widgetViews.firstOrNull { it.tag == item.widgetId })
widgetViews.removeIf { it.tag == item.widgetId }
}
gridItems.removeIf { it.id == item.id }
}
} else {
isDroppingPositionValid = false
}
}
return@forEach
}