@Implements(value=android.appwidget.AppWidgetManager.class) public class ShadowAppWidgetManager extends Object
AppWidgetManager.| 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) |
boolean |
bindAppWidgetIdIfAllowed(int appWidgetId,
android.content.ComponentName provider) |
int |
createWidget(Class<? extends android.appwidget.AppWidgetProvider> appWidgetProviderClass,
int widgetLayoutId)
Creates a widget by inflating its layout.
|
int[] |
createWidgets(Class<? extends android.appwidget.AppWidgetProvider> appWidgetProviderClass,
int widgetLayoutId,
int howManyToCreate)
Creates a bunch of widgets by inflating the same layout multiple times.
|
boolean |
getAlwaysRecreateViewsDuringUpdate()
Non-Android accessor.
|
int[] |
getAppWidgetIds(android.content.ComponentName provider) |
android.appwidget.AppWidgetProviderInfo |
getAppWidgetInfo(int appWidgetId) |
android.appwidget.AppWidgetProvider |
getAppWidgetProviderFor(int widgetId)
Non-Android accessor.
|
List<android.appwidget.AppWidgetProviderInfo> |
getInstalledProviders() |
static android.appwidget.AppWidgetManager |
getInstance(android.content.Context context)
Finds or creates an
AppWidgetManager for the given context |
android.view.View |
getViewFor(int widgetId)
Non-Android accessor.
|
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)
Non-Android mechanism that enables testing of widget behavior when all of the views are recreated on every
update.
|
void |
setValidWidgetProviderComponentName(boolean validWidgetProviderComponentName) |
void |
updateAppWidget(int[] appWidgetIds,
android.widget.RemoteViews views) |
void |
updateAppWidget(int appWidgetId,
android.widget.RemoteViews views)
Simulates updating an
AppWidget with a new set of views |
@Implementation public static android.appwidget.AppWidgetManager getInstance(android.content.Context context)
AppWidgetManager for the given contextcontext - the context for which to produce an assoicated AppWidgetManagerAppWidgetManager associated with the given context@Implementation
public void updateAppWidget(int[] appWidgetIds,
android.widget.RemoteViews views)
@Implementation
public void updateAppWidget(int appWidgetId,
android.widget.RemoteViews views)
AppWidget with a new set of viewsappWidgetId - id of widgetviews - views to update@Implementation public int[] getAppWidgetIds(android.content.ComponentName provider)
@Implementation public 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 public android.appwidget.AppWidgetProviderInfo getAppWidgetInfo(int appWidgetId)
@HiddenApi
@Implementation
public void bindAppWidgetId(int appWidgetId,
android.content.ComponentName provider)
@Implementation
public boolean bindAppWidgetIdIfAllowed(int appWidgetId,
android.content.ComponentName provider)
public void reconstructWidgetViewAsIfPhoneWasRotated(int appWidgetId)
appWidgetId - the ID of the widget to be affectedpublic int createWidget(Class<? extends android.appwidget.AppWidgetProvider> appWidgetProviderClass, int widgetLayoutId)
appWidgetProviderClass - the app widget provider classwidgetLayoutId - id of the layout to inflatepublic int[] createWidgets(Class<? extends android.appwidget.AppWidgetProvider> appWidgetProviderClass, int widgetLayoutId, int howManyToCreate)
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 widgetwidgetIdpublic android.appwidget.AppWidgetProvider getAppWidgetProviderFor(int widgetId)
widgetId - id of the widget whose provider is to be returnedAppWidgetProvider associated with widgetIdpublic 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)
Copyright © 2015. All rights reserved.