From 9bd5aa3832b1de09149b0ea8ee8858b7a6e5d359 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 27 Nov 2021 11:12:35 +0100 Subject: [PATCH] make list widget updating more reliable --- .../com/simplemobiletools/calendar/pro/extensions/Context.kt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/extensions/Context.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/extensions/Context.kt index 323916f7b..bbfd5556d 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/extensions/Context.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/extensions/Context.kt @@ -64,6 +64,7 @@ fun Context.updateWidgets() { fun Context.updateListWidget() { val widgetIDs = AppWidgetManager.getInstance(applicationContext)?.getAppWidgetIds(ComponentName(applicationContext, MyWidgetListProvider::class.java)) ?: return + if (widgetIDs.isNotEmpty()) { Intent(applicationContext, MyWidgetListProvider::class.java).apply { action = AppWidgetManager.ACTION_APPWIDGET_UPDATE @@ -71,6 +72,7 @@ fun Context.updateListWidget() { sendBroadcast(this) } } + AppWidgetManager.getInstance(applicationContext)?.notifyAppWidgetViewDataChanged(widgetIDs, R.id.widget_event_list) } fun Context.updateDateWidget() {