@Implements(value=android.appwidget.AppWidgetManager.class) public class ShadowAppWidgetManager extends java.lang.Object
Constructor and Description |
---|
ShadowAppWidgetManager() |
Modifier and Type | Method and Description |
---|---|
void |
addBoundWidget(int appWidgetId,
android.appwidget.AppWidgetProviderInfo providerInfo) |
void |
addInstalledProvider(android.appwidget.AppWidgetProviderInfo appWidgetProviderInfo) |
void |
bindAppWidgetId(int appWidgetId,
android.content.ComponentName provider) |
protected boolean |
bindAppWidgetIdIfAllowed(int appWidgetId,
android.content.ComponentName provider) |
int |
createWidget(java.lang.Class<? extends android.appwidget.AppWidgetProvider> appWidgetProviderClass,
int widgetLayoutId)
Creates a widget by inflating its layout.
|
int[] |
createWidgets(java.lang.Class<? extends android.appwidget.AppWidgetProvider> appWidgetProviderClass,
int widgetLayoutId,
int howManyToCreate)
Creates a bunch of widgets by inflating the same layout multiple times.
|
boolean |
getAlwaysRecreateViewsDuringUpdate() |
protected int[] |
getAppWidgetIds(android.content.ComponentName provider) |
protected android.appwidget.AppWidgetProviderInfo |
getAppWidgetInfo(int appWidgetId) |
android.appwidget.AppWidgetProvider |
getAppWidgetProviderFor(int widgetId) |
protected java.util.List<android.appwidget.AppWidgetProviderInfo> |
getInstalledProviders() |
protected static android.appwidget.AppWidgetManager |
getInstance(android.content.Context context)
Finds or creates an
AppWidgetManager for the given context |
android.view.View |
getViewFor(int widgetId) |
void |
putWidgetInfo(int appWidgetId,
android.appwidget.AppWidgetProviderInfo expectedWidgetInfo)
Deprecated.
|
void |
reconstructWidgetViewAsIfPhoneWasRotated(int appWidgetId)
Triggers a reapplication of the most recent set of actions against the widget, which is what happens when the phone is rotated.
|
void |
setAllowedToBindAppWidgets(boolean allowed) |
void |
setAlwaysRecreateViewsDuringUpdate(boolean alwaysRecreate)
Enables testing of widget behavior when all of the views are recreated on every update.
|
void |
setValidWidgetProviderComponentName(boolean validWidgetProviderComponentName) |
protected void |
updateAppWidget(int[] appWidgetIds,
android.widget.RemoteViews views) |
protected void |
updateAppWidget(int appWidgetId,
android.widget.RemoteViews views)
Simulates updating an
AppWidget with a new set of views |
@Implementation protected static android.appwidget.AppWidgetManager getInstance(android.content.Context context)
Finds or creates an AppWidgetManager
for the given context
context
- the context
for which to produce an assoicated AppWidgetManager
AppWidgetManager
associated with the given context
@Implementation protected void updateAppWidget(int[] appWidgetIds, android.widget.RemoteViews views)
@Implementation protected void updateAppWidget(int appWidgetId, android.widget.RemoteViews views)
Simulates updating an AppWidget
with a new set of views
appWidgetId
- id of widgetviews
- views to update@Implementation protected int[] getAppWidgetIds(android.content.ComponentName provider)
@Implementation protected java.util.List<android.appwidget.AppWidgetProviderInfo> getInstalledProviders()
public void addInstalledProvider(android.appwidget.AppWidgetProviderInfo appWidgetProviderInfo)
public void addBoundWidget(int appWidgetId, android.appwidget.AppWidgetProviderInfo providerInfo)
@Deprecated public void putWidgetInfo(int appWidgetId, android.appwidget.AppWidgetProviderInfo expectedWidgetInfo)
@Implementation protected android.appwidget.AppWidgetProviderInfo getAppWidgetInfo(int appWidgetId)
@HiddenApi @Implementation public void bindAppWidgetId(int appWidgetId, android.content.ComponentName provider)
@Implementation protected boolean bindAppWidgetIdIfAllowed(int appWidgetId, android.content.ComponentName provider)
public void reconstructWidgetViewAsIfPhoneWasRotated(int appWidgetId)
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.
appWidgetId
- the ID of the widget to be affectedpublic int createWidget(java.lang.Class<? extends android.appwidget.AppWidgetProvider> appWidgetProviderClass, int widgetLayoutId)
Creates a widget by inflating its layout.
appWidgetProviderClass
- the app widget provider classwidgetLayoutId
- id of the layout to inflatepublic int[] createWidgets(java.lang.Class<? extends android.appwidget.AppWidgetProvider> appWidgetProviderClass, int widgetLayoutId, int howManyToCreate)
Creates a bunch of widgets by inflating the same layout multiple times.
appWidgetProviderClass
- the app widget provider classwidgetLayoutId
- id of the layout to inflatehowManyToCreate
- number of new widgets to createpublic android.view.View getViewFor(int widgetId)
widgetId
- id of the desired widgetwidgetId
public android.appwidget.AppWidgetProvider getAppWidgetProviderFor(int widgetId)
widgetId
- id of the widget whose provider is to be returnedAppWidgetProvider
associated with widgetId
public void setAlwaysRecreateViewsDuringUpdate(boolean alwaysRecreate)
Enables testing of widget behavior when all of the views are recreated on every update. This is useful for ensuring that your widget will behave correctly even if it is restarted by the OS between events.
alwaysRecreate
- whether or not to always recreate the viewspublic boolean getAlwaysRecreateViewsDuringUpdate()
alwaysRecreateViewsDuringUpdate
flagpublic void setAllowedToBindAppWidgets(boolean allowed)
public void setValidWidgetProviderComponentName(boolean validWidgetProviderComponentName)