Added onDeleted function to Static widget (#797)

This commit is contained in:
Krisjanis Lejejs 2020-08-21 16:05:09 +03:00 committed by GitHub
parent 631b9d1cf5
commit 1fdb9e062a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -197,4 +197,11 @@ class StaticWidget : AppWidgetProvider() {
throw Exception("Application Context passed is not of our application!")
}
}
override fun onDeleted(context: Context, appWidgetIds: IntArray) {
staticWidgetDao = AppDatabase.getInstance(context).staticWidgetDao()
appWidgetIds.forEach { appWidgetId ->
staticWidgetDao.delete(appWidgetId)
}
}
}