/** * Triggers a reapplication of the most recent set of actions against the widget, which is what happens when the * phone is rotated. Does not attempt to simulate a change in screen geometry. * * @param appWidgetId the ID of the widget to be affected */ public void reconstructWidgetViewAsIfPhoneWasRotated(int appWidgetId) { WidgetInfo widgetInfo = widgetInfos.get(appWidgetId); widgetInfo.view = createWidgetView(widgetInfo.layoutId); widgetInfo.lastRemoteViews.reapply(context, widgetInfo.view); }
/** * Simulates updating an {@code AppWidget} with a new set of views * * @param appWidgetId id of widget * @param views views to update */ @Implementation protected void updateAppWidget(int appWidgetId, RemoteViews views) { WidgetInfo widgetInfo = widgetInfos.get(appWidgetId); int layoutId = views.getLayoutId(); if (widgetInfo.layoutId != layoutId || alwaysRecreateViewsDuringUpdate) { widgetInfo.view = createWidgetView(layoutId); widgetInfo.layoutId = layoutId; } widgetInfo.lastRemoteViews = views; views.reapply(context, widgetInfo.view); }
/** * Creates a bunch of widgets by inflating the same layout multiple times. * * @param appWidgetProviderClass the app widget provider class * @param widgetLayoutId id of the layout to inflate * @param howManyToCreate number of new widgets to create * @return the IDs of the new widgets */ public int[] createWidgets(Class<? extends AppWidgetProvider> appWidgetProviderClass, int widgetLayoutId, int howManyToCreate) { AppWidgetProvider appWidgetProvider = ReflectionHelpers.callConstructor(appWidgetProviderClass); int[] newWidgetIds = new int[howManyToCreate]; for (int i = 0; i < howManyToCreate; i++) { View widgetView = createWidgetView(widgetLayoutId); int myWidgetId = nextWidgetId++; widgetInfos.put(myWidgetId, new WidgetInfo(widgetView, widgetLayoutId, appWidgetProvider)); newWidgetIds[i] = myWidgetId; } appWidgetProvider.onUpdate(context, realAppWidgetManager, newWidgetIds); return newWidgetIds; }
/** * Triggers a reapplication of the most recent set of actions against the widget, which is what happens when the * phone is rotated. Does not attempt to simulate a change in screen geometry. * * @param appWidgetId the ID of the widget to be affected */ public void reconstructWidgetViewAsIfPhoneWasRotated(int appWidgetId) { WidgetInfo widgetInfo = widgetInfos.get(appWidgetId); widgetInfo.view = createWidgetView(widgetInfo.layoutId); widgetInfo.lastRemoteViews.reapply(context, widgetInfo.view); }
/** * Triggers a reapplication of the most recent set of actions against the widget, which is what happens when the * phone is rotated. Does not attempt to simulate a change in screen geometry. * * @param appWidgetId the ID of the widget to be affected */ public void reconstructWidgetViewAsIfPhoneWasRotated(int appWidgetId) { WidgetInfo widgetInfo = widgetInfos.get(appWidgetId); widgetInfo.view = createWidgetView(widgetInfo.layoutId); widgetInfo.lastRemoteViews.reapply(context, widgetInfo.view); }
/** * Triggers a reapplication of the most recent set of actions against the widget, which is what happens when the * phone is rotated. Does not attempt to simulate a change in screen geometry. * * @param appWidgetId the ID of the widget to be affected */ public void reconstructWidgetViewAsIfPhoneWasRotated(int appWidgetId) { WidgetInfo widgetInfo = widgetInfos.get(appWidgetId); widgetInfo.view = createWidgetView(widgetInfo.layoutId); widgetInfo.lastRemoteViews.reapply(context, widgetInfo.view); }
/** * Triggers a reapplication of the most recent set of actions against the widget, which is what happens when the * phone is rotated. Does not attempt to simulate a change in screen geometry. * * @param appWidgetId the ID of the widget to be affected */ public void reconstructWidgetViewAsIfPhoneWasRotated(int appWidgetId) { WidgetInfo widgetInfo = widgetInfos.get(appWidgetId); widgetInfo.view = createWidgetView(widgetInfo.layoutId); widgetInfo.lastRemoteViews.reapply(context, widgetInfo.view); }
/** * Simulates updating an {@code AppWidget} with a new set of views * * @param appWidgetId id of widget * @param views views to update */ @Implementation public void updateAppWidget(int appWidgetId, RemoteViews views) { WidgetInfo widgetInfo = widgetInfos.get(appWidgetId); int layoutId = views.getLayoutId(); if (widgetInfo.layoutId != layoutId || alwaysRecreateViewsDuringUpdate) { widgetInfo.view = createWidgetView(layoutId); widgetInfo.layoutId = layoutId; } widgetInfo.lastRemoteViews = views; views.reapply(context, widgetInfo.view); }
/** * Simulates updating an {@code AppWidget} with a new set of views * * @param appWidgetId id of widget * @param views views to update */ @Implementation public void updateAppWidget(int appWidgetId, RemoteViews views) { WidgetInfo widgetInfo = widgetInfos.get(appWidgetId); int layoutId = views.getLayoutId(); if (widgetInfo.layoutId != layoutId || alwaysRecreateViewsDuringUpdate) { widgetInfo.view = createWidgetView(layoutId); widgetInfo.layoutId = layoutId; } widgetInfo.lastRemoteViews = views; views.reapply(context, widgetInfo.view); }
/** * Simulates updating an {@code AppWidget} with a new set of views * * @param appWidgetId id of widget * @param views views to update */ @Implementation public void updateAppWidget(int appWidgetId, RemoteViews views) { WidgetInfo widgetInfo = widgetInfos.get(appWidgetId); int layoutId = views.getLayoutId(); if (widgetInfo.layoutId != layoutId || alwaysRecreateViewsDuringUpdate) { widgetInfo.view = createWidgetView(layoutId); widgetInfo.layoutId = layoutId; } widgetInfo.lastRemoteViews = views; views.reapply(context, widgetInfo.view); }
/** * Simulates updating an {@code AppWidget} with a new set of views * * @param appWidgetId id of widget * @param views views to update */ @Implementation protected void updateAppWidget(int appWidgetId, RemoteViews views) { WidgetInfo widgetInfo = widgetInfos.get(appWidgetId); int layoutId = views.getLayoutId(); if (widgetInfo.layoutId != layoutId || alwaysRecreateViewsDuringUpdate) { widgetInfo.view = createWidgetView(layoutId); widgetInfo.layoutId = layoutId; } widgetInfo.lastRemoteViews = views; views.reapply(context, widgetInfo.view); }
/** * Creates a bunch of widgets by inflating the same layout multiple times. * * @param appWidgetProviderClass the app widget provider class * @param widgetLayoutId id of the layout to inflate * @param howManyToCreate number of new widgets to create * @return the IDs of the new widgets */ public int[] createWidgets(Class<? extends AppWidgetProvider> appWidgetProviderClass, int widgetLayoutId, int howManyToCreate) { AppWidgetProvider appWidgetProvider = ReflectionHelpers.callConstructor(appWidgetProviderClass); int[] newWidgetIds = new int[howManyToCreate]; for (int i = 0; i < howManyToCreate; i++) { View widgetView = createWidgetView(widgetLayoutId); int myWidgetId = nextWidgetId++; widgetInfos.put(myWidgetId, new WidgetInfo(widgetView, widgetLayoutId, appWidgetProvider)); newWidgetIds[i] = myWidgetId; } appWidgetProvider.onUpdate(context, realAppWidgetManager, newWidgetIds); return newWidgetIds; }
/** * Creates a bunch of widgets by inflating the same layout multiple times. * * @param appWidgetProviderClass the app widget provider class * @param widgetLayoutId id of the layout to inflate * @param howManyToCreate number of new widgets to create * @return the IDs of the new widgets */ public int[] createWidgets(Class<? extends AppWidgetProvider> appWidgetProviderClass, int widgetLayoutId, int howManyToCreate) { AppWidgetProvider appWidgetProvider = ReflectionHelpers.callConstructor(appWidgetProviderClass); int[] newWidgetIds = new int[howManyToCreate]; for (int i = 0; i < howManyToCreate; i++) { View widgetView = createWidgetView(widgetLayoutId); int myWidgetId = nextWidgetId++; widgetInfos.put(myWidgetId, new WidgetInfo(widgetView, widgetLayoutId, appWidgetProvider)); newWidgetIds[i] = myWidgetId; } appWidgetProvider.onUpdate(context, realAppWidgetManager, newWidgetIds); return newWidgetIds; }
/** * Creates a bunch of widgets by inflating the same layout multiple times. * * @param appWidgetProviderClass the app widget provider class * @param widgetLayoutId id of the layout to inflate * @param howManyToCreate number of new widgets to create * @return the IDs of the new widgets */ public int[] createWidgets(Class<? extends AppWidgetProvider> appWidgetProviderClass, int widgetLayoutId, int howManyToCreate) { AppWidgetProvider appWidgetProvider = ReflectionHelpers.callConstructor(appWidgetProviderClass); int[] newWidgetIds = new int[howManyToCreate]; for (int i = 0; i < howManyToCreate; i++) { View widgetView = createWidgetView(widgetLayoutId); int myWidgetId = nextWidgetId++; widgetInfos.put(myWidgetId, new WidgetInfo(widgetView, widgetLayoutId, appWidgetProvider)); newWidgetIds[i] = myWidgetId; } appWidgetProvider.onUpdate(context, realAppWidgetManager, newWidgetIds); return newWidgetIds; }
/** * Creates a bunch of widgets by inflating the same layout multiple times. * * @param appWidgetProviderClass the app widget provider class * @param widgetLayoutId id of the layout to inflate * @param howManyToCreate number of new widgets to create * @return the IDs of the new widgets */ public int[] createWidgets(Class<? extends AppWidgetProvider> appWidgetProviderClass, int widgetLayoutId, int howManyToCreate) { AppWidgetProvider appWidgetProvider = ReflectionHelpers.callConstructor(appWidgetProviderClass); int[] newWidgetIds = new int[howManyToCreate]; for (int i = 0; i < howManyToCreate; i++) { View widgetView = createWidgetView(widgetLayoutId); int myWidgetId = nextWidgetId++; widgetInfos.put(myWidgetId, new WidgetInfo(widgetView, widgetLayoutId, appWidgetProvider)); newWidgetIds[i] = myWidgetId; } appWidgetProvider.onUpdate(context, realAppWidgetManager, newWidgetIds); return newWidgetIds; }