mirror of
https://github.com/SimpleMobileTools/Simple-Launcher.git
synced 2025-03-04 11:17:46 +01:00
Add an error when widget is too big for home screen
This commit is contained in:
parent
3ed5119129
commit
ec45fc0a1f
@ -18,6 +18,7 @@ import com.simplemobiletools.commons.helpers.isRPlus
|
||||
import com.simplemobiletools.launcher.R
|
||||
import com.simplemobiletools.launcher.activities.MainActivity
|
||||
import com.simplemobiletools.launcher.adapters.WidgetsAdapter
|
||||
import com.simplemobiletools.launcher.extensions.config
|
||||
import com.simplemobiletools.launcher.extensions.getInitialCellSize
|
||||
import com.simplemobiletools.launcher.helpers.ITEM_TYPE_SHORTCUT
|
||||
import com.simplemobiletools.launcher.helpers.ITEM_TYPE_WIDGET
|
||||
@ -238,6 +239,11 @@ class WidgetsFragment(context: Context, attributeSet: AttributeSet) : MyFragment
|
||||
}
|
||||
|
||||
override fun onWidgetLongPressed(appWidget: AppWidget) {
|
||||
if (appWidget.heightCells > context.config.homeRowCount || appWidget.widthCells > context.config.homeColumnCount) {
|
||||
context.toast("Widget is too big for current home screen size")
|
||||
return
|
||||
}
|
||||
|
||||
val type = if (appWidget.isShortcut) {
|
||||
ITEM_TYPE_SHORTCUT
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user