Skip to content

Commit 200109e

Browse files
committed
Remove widgets that are out of bounds if they are blocking dropped icon
1 parent 2349fa0 commit 200109e

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

app/src/main/kotlin/com/simplemobiletools/launcher/views/HomeScreenGrid.kt

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,18 @@ class HomeScreenGrid(context: Context, attrs: AttributeSet, defStyle: Int) : Rel
532532
if (item.type != ITEM_TYPE_WIDGET && !item.docked) {
533533
potentialParent = item
534534
} else {
535-
isDroppingPositionValid = false
535+
if (item.type == ITEM_TYPE_WIDGET && item.outOfBounds()) {
536+
ensureBackgroundThread {
537+
removeItemFromHomeScreen(item)
538+
post {
539+
removeView(widgetViews.firstOrNull { it.tag == item.widgetId })
540+
widgetViews.removeIf { it.tag == item.widgetId }
541+
}
542+
gridItems.removeIf { it.id == item.id }
543+
}
544+
} else {
545+
isDroppingPositionValid = false
546+
}
536547
}
537548
return@forEach
538549
}

0 commit comments

Comments
 (0)