Search in sources :

Example 11 with AppWidgetHostView

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);
}
Also used : AppWidgetHostView(android.appwidget.AppWidgetHostView) Test(org.junit.Test)

Example 12 with AppWidgetHostView

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);
}
Also used : AppWidgetHostView(android.appwidget.AppWidgetHostView) Test(org.junit.Test)

Example 13 with AppWidgetHostView

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);
}
Also used : AppWidgetHostView(android.appwidget.AppWidgetHostView) AppWidgetProviderInfo(android.appwidget.AppWidgetProviderInfo) Test(org.junit.Test)

Example 14 with AppWidgetHostView

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();
        }
    }
}
Also used : Context(android.content.Context) AppWidgetHostView(android.appwidget.AppWidgetHostView) AppWidgetHost(android.appwidget.AppWidgetHost) AppWidgetProviderInfo(android.appwidget.AppWidgetProviderInfo)

Example 15 with AppWidgetHostView

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);
}
Also used : AppWidgetHostView(android.appwidget.AppWidgetHostView) LinearLayout(android.widget.LinearLayout)

Aggregations

AppWidgetHostView (android.appwidget.AppWidgetHostView)45 AppWidgetProviderInfo (android.appwidget.AppWidgetProviderInfo)18 Point (android.graphics.Point)11 View (android.view.View)10 Context (android.content.Context)6 Intent (android.content.Intent)6 Bundle (android.os.Bundle)6 ImageView (android.widget.ImageView)6 TextView (android.widget.TextView)6 AppWidgetHost (android.appwidget.AppWidgetHost)5 LinearLayout (android.widget.LinearLayout)5 Test (org.junit.Test)5 Rect (android.graphics.Rect)4 Resources (android.content.res.Resources)3 Bitmap (android.graphics.Bitmap)3 RecognizerIntent (android.speech.RecognizerIntent)3 LauncherIntent (mobi.intuitit.android.content.LauncherIntent)3 SuppressLint (android.annotation.SuppressLint)2 NameNotFoundException (android.content.pm.PackageManager.NameNotFoundException)1 Paint (android.graphics.Paint)1