properly clean up removed widgets from the database

This commit is contained in:
tibbi
2018-12-16 21:01:08 +01:00
parent af199908d9
commit 42c14576be
3 changed files with 13 additions and 1 deletions

View File

@ -48,4 +48,13 @@ class MyWidgetProvider : AppWidgetProvider() {
}
}.start()
}
override fun onDeleted(context: Context, appWidgetIds: IntArray) {
super.onDeleted(context, appWidgetIds)
Thread {
appWidgetIds.forEach {
context.widgetsDB.deleteWidgetId(it)
}
}.start()
}
}