use of android.appwidget.AppWidgetHostView in project robolectric by robolectric.
the class ShadowAppWidgetHostTest method createView_shouldSetHostViewsHost.
@Test
public void createView_shouldSetHostViewsHost() throws Exception {
AppWidgetHostView hostView = appWidgetHost.createView(context, 0, null);
assertThat(shadowOf(hostView).getHost()).isSameAs(appWidgetHost);
}
use of android.appwidget.AppWidgetHostView in project robolectric by robolectric.
the class ShadowAppWidgetHostTest method createView_shouldSetViewsAppWidgetId.
@Test
public void createView_shouldSetViewsAppWidgetId() throws Exception {
AppWidgetHostView hostView = appWidgetHost.createView(context, 765, null);
assertThat(hostView.getAppWidgetId()).isEqualTo(765);
}
use of android.appwidget.AppWidgetHostView in project robolectric by robolectric.
the class ShadowAppWidgetHostTest method createView_shouldSetViewsAppWidgetInfo.
@Test
public void createView_shouldSetViewsAppWidgetInfo() throws Exception {
AppWidgetProviderInfo info = new AppWidgetProviderInfo();
AppWidgetHostView hostView = appWidgetHost.createView(context, 0, info);
assertThat(hostView.getAppWidgetInfo()).isSameAs(info);
}
use of android.appwidget.AppWidgetHostView in project platform_frameworks_base by android.
the class AppWidgetHostActivity method onCreate.
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
mAppWidgetManager = AppWidgetManager.getInstance(this);
setContentView(R.layout.appwidget_host);
mHost = new AppWidgetHost(this, HOST_ID) {
protected AppWidgetHostView onCreateView(Context context, int appWidgetId, AppWidgetProviderInfo appWidget) {
return new MyAppWidgetView(appWidgetId);
}
};
findViewById(R.id.add_appwidget).setOnClickListener(mOnClickListener);
mAppWidgetContainer = (AppWidgetContainerView) findViewById(R.id.appwidget_container);
if (false) {
if (false) {
mHost.deleteHost();
} else {
AppWidgetHost.deleteAllHosts();
}
}
}
use of android.appwidget.AppWidgetHostView in project platform_frameworks_base by android.
the class AppWidgetHostActivity method addAppWidgetView.
void addAppWidgetView(int appWidgetId, AppWidgetProviderInfo appWidget) {
// Inflate the AppWidget's RemoteViews
AppWidgetHostView view = mHost.createView(this, appWidgetId, appWidget);
// Add it to the list
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
mAppWidgetContainer.addView(view, layoutParams);
registerForContextMenu(view);
}
Aggregations