File tree Expand file tree Collapse file tree
AnkiDroid/src/main/java/com/ichi2/widget Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -306,7 +306,18 @@ class CardAnalysisWidget : AnalyticsWidgetProvider() {
306306 }
307307 }
308308 AppWidgetManager .ACTION_APPWIDGET_OPTIONS_CHANGED -> {
309- // TODO: #17151 not yet handled. Exists to stop ACRA errors
309+ Timber .d(" ACTION_APPWIDGET_OPTIONS_CHANGED received from CardAnalysisWidget" )
310+ val appWidgetId = intent.getAppWidgetId()
311+ if (appWidgetId != INVALID_APPWIDGET_ID ) {
312+ Timber .d(" Handling resize for widget ID: $appWidgetId " )
313+ updateWidget(
314+ context,
315+ AppWidgetManager .getInstance(context),
316+ appWidgetId,
317+ )
318+ } else {
319+ Timber .e(" Invalid widget ID received in ACTION_APPWIDGET_OPTIONS_CHANGED" )
320+ }
310321 }
311322 AppWidgetManager .ACTION_APPWIDGET_DELETED -> {
312323 Timber .d(" ACTION_APPWIDGET_DELETED received" )
Original file line number Diff line number Diff line change @@ -343,7 +343,20 @@ class DeckPickerWidget : AnalyticsWidgetProvider() {
343343 }
344344 }
345345 AppWidgetManager .ACTION_APPWIDGET_OPTIONS_CHANGED -> {
346- // TODO: #17151: not yet handled. Exists to stop ACRA errors
346+ Timber .d(" ACTION_APPWIDGET_OPTIONS_CHANGED received from DeckPickerWidget" )
347+ val appWidgetId = intent.getAppWidgetId()
348+ if (appWidgetId != INVALID_APPWIDGET_ID ) {
349+ Timber .d(" Handling resize for widget ID: $appWidgetId " )
350+ val selectedDeckIds = widgetPreferences.getSelectedDeckIdsFromPreferences(appWidgetId)
351+ updateWidget(
352+ context,
353+ AppWidgetManager .getInstance(context),
354+ appWidgetId,
355+ selectedDeckIds,
356+ )
357+ } else {
358+ Timber .e(" Invalid widget ID received in ACTION_APPWIDGET_OPTIONS_CHANGED" )
359+ }
347360 }
348361 AppWidgetManager .ACTION_APPWIDGET_ENABLED -> {
349362 Timber .d(" Widget enabled" )
You can’t perform that action at this time.
0 commit comments