public override void OnAppWidgetOptionsChanged(Context context, AppWidgetManager appWidgetManager, int appWidgetId, Bundle newOptions) { base.OnAppWidgetOptionsChanged(context, appWidgetManager, appWidgetId, newOptions); var dimensions = WidgetDimensions.FromBundle(newOptions); updateWidget(context, appWidgetManager, appWidgetId, dimensions); }
public static ISuggestionsWidgetFormFactor Create(WidgetDimensions dimensions) { if (!WidgetsServiceAndroid.IsLoggedIn) { return(new SuggestionsWidgetNotLoggedInFormFactor(dimensions.ColumnsCount)); } return(new SuggestionsWidgetListFormFactor()); }
public override void OnUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { base.OnUpdate(context, appWidgetManager, appWidgetIds); foreach (var appWidgetId in appWidgetIds) { var options = appWidgetManager.GetAppWidgetOptions(appWidgetId); var dimensions = WidgetDimensions.FromBundle(options); updateWidget(context, appWidgetManager, appWidgetId, dimensions); } }
public static ITimeEntryWidgetFormFactor Create(WidgetDimensions widgetDimensions) { var dimensions = widgetDimensions ?? WidgetDimensions.Default; if (!WidgetsServiceAndroid.IsLoggedIn) { return(new TimeEntryWidgetNotLoggedInFormFactor(dimensions.ColumnsCount)); } if (dimensions.ColumnsCount == 1) { return(new TimeEntryWidgetButtonOnlyFormFactor()); } return(new TimeEntryWidgetDefaultFormFactor()); }
private static void updateWidget(Context context, AppWidgetManager appWidgetManager, int appWidgetId, WidgetDimensions dimensions) { var widgetFormFactor = SuggestionsWidgetFactory.Create(dimensions); var view = widgetFormFactor.Setup(context, appWidgetId); if (widgetFormFactor.ContainsListView) { appWidgetManager.NotifyAppWidgetViewDataChanged(appWidgetId, Resource.Id.SuggestionsList); } appWidgetManager.UpdateAppWidget(appWidgetId, view); }
private void updateWidget(Context context, AppWidgetManager appWidgetManager, int appWidgetId, WidgetDimensions dimensions) { var widgetInfo = TimeEntryWidgetInfo.FromSharedPreferences(); var remoteViews = TimeEntryWidgetFactory.Create(dimensions).Setup(context, widgetInfo); appWidgetManager.UpdateAppWidget(appWidgetId, remoteViews); }