@Implements(android.appwidget.AppWidgetManager.class) public class ShadowAppWidgetManager extends Object
Constructor | Description |
---|---|
ShadowAppWidgetManager() |
Modifier and Type | Method | Description |
---|---|---|
protected void |
__constructor__(Context context) |
|
protected void |
__constructor__(Context context,
com.android.internal.appwidget.IAppWidgetService service) |
|
void |
addBoundWidget(int appWidgetId,
AppWidgetProviderInfo providerInfo) |
|
void |
addInstalledProvider(AppWidgetProviderInfo appWidgetProviderInfo) |
|
void |
bindAppWidgetId(int appWidgetId,
ComponentName provider) |
|
protected boolean |
bindAppWidgetIdIfAllowed(int appWidgetId,
ComponentName provider) |
|
int |
createWidget(Class<? extends AppWidgetProvider> appWidgetProviderClass,
int widgetLayoutId) |
Creates a widget by inflating its layout.
|
int[] |
createWidgets(Class<? extends AppWidgetProvider> appWidgetProviderClass,
int widgetLayoutId,
int howManyToCreate) |
Creates a bunch of widgets by inflating the same layout multiple times.
|
boolean |
getAlwaysRecreateViewsDuringUpdate() |
|
protected int[] |
getAppWidgetIds(ComponentName provider) |
|
protected AppWidgetProviderInfo |
getAppWidgetInfo(int appWidgetId) |
|
AppWidgetProvider |
getAppWidgetProviderFor(int widgetId) |
|
protected List<AppWidgetProviderInfo> |
getInstalledProviders() |
|
View |
getViewFor(int widgetId) |
|
void |
putWidgetInfo(int appWidgetId,
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,
RemoteViews views) |
|
protected void |
updateAppWidget(int appWidgetId,
RemoteViews views) |
Simulates updating an
AppWidget with a new set of views |
@Implementation(maxSdk=19) protected void __constructor__(Context context)
@Implementation(minSdk=21) protected void __constructor__(Context context, com.android.internal.appwidget.IAppWidgetService service)
@Implementation protected void updateAppWidget(int[] appWidgetIds, RemoteViews views)
@Implementation protected void updateAppWidget(int appWidgetId, RemoteViews views)
AppWidget
with a new set of viewsappWidgetId
- id of widgetviews
- views to update@Implementation protected int[] getAppWidgetIds(ComponentName provider)
@Implementation protected List<AppWidgetProviderInfo> getInstalledProviders()
public void addInstalledProvider(AppWidgetProviderInfo appWidgetProviderInfo)
public void addBoundWidget(int appWidgetId, AppWidgetProviderInfo providerInfo)
@Deprecated public void putWidgetInfo(int appWidgetId, AppWidgetProviderInfo expectedWidgetInfo)
@Implementation protected AppWidgetProviderInfo getAppWidgetInfo(int appWidgetId)
@HiddenApi @Implementation public void bindAppWidgetId(int appWidgetId, ComponentName provider)
@Implementation protected boolean bindAppWidgetIdIfAllowed(int appWidgetId, ComponentName provider)
public void reconstructWidgetViewAsIfPhoneWasRotated(int appWidgetId)
appWidgetId
- the ID of the widget to be affectedpublic int createWidget(Class<? extends AppWidgetProvider> appWidgetProviderClass, int widgetLayoutId)
appWidgetProviderClass
- the app widget provider classwidgetLayoutId
- id of the layout to inflatepublic int[] createWidgets(Class<? extends AppWidgetProvider> appWidgetProviderClass, int widgetLayoutId, int howManyToCreate)
appWidgetProviderClass
- the app widget provider classwidgetLayoutId
- id of the layout to inflatehowManyToCreate
- number of new widgets to createpublic View getViewFor(int widgetId)
widgetId
- id of the desired widgetwidgetId
public AppWidgetProvider getAppWidgetProviderFor(int widgetId)
widgetId
- id of the widget whose provider is to be returnedAppWidgetProvider
associated with widgetId
public void setAlwaysRecreateViewsDuringUpdate(boolean alwaysRecreate)
alwaysRecreate
- whether or not to always recreate the viewspublic boolean getAlwaysRecreateViewsDuringUpdate()
alwaysRecreateViewsDuringUpdate
flagpublic void setAllowedToBindAppWidgets(boolean allowed)
public void setValidWidgetProviderComponentName(boolean validWidgetProviderComponentName)