make list widget updating more reliable
This commit is contained in:
parent
897fa21ec4
commit
9bd5aa3832
|
@ -64,6 +64,7 @@ fun Context.updateWidgets() {
|
||||||
fun Context.updateListWidget() {
|
fun Context.updateListWidget() {
|
||||||
val widgetIDs = AppWidgetManager.getInstance(applicationContext)?.getAppWidgetIds(ComponentName(applicationContext, MyWidgetListProvider::class.java))
|
val widgetIDs = AppWidgetManager.getInstance(applicationContext)?.getAppWidgetIds(ComponentName(applicationContext, MyWidgetListProvider::class.java))
|
||||||
?: return
|
?: return
|
||||||
|
|
||||||
if (widgetIDs.isNotEmpty()) {
|
if (widgetIDs.isNotEmpty()) {
|
||||||
Intent(applicationContext, MyWidgetListProvider::class.java).apply {
|
Intent(applicationContext, MyWidgetListProvider::class.java).apply {
|
||||||
action = AppWidgetManager.ACTION_APPWIDGET_UPDATE
|
action = AppWidgetManager.ACTION_APPWIDGET_UPDATE
|
||||||
|
@ -71,6 +72,7 @@ fun Context.updateListWidget() {
|
||||||
sendBroadcast(this)
|
sendBroadcast(this)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
AppWidgetManager.getInstance(applicationContext)?.notifyAppWidgetViewDataChanged(widgetIDs, R.id.widget_event_list)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun Context.updateDateWidget() {
|
fun Context.updateDateWidget() {
|
||||||
|
|
Loading…
Reference in New Issue