Search in sources :

Example 1 with AppWidgetHost

use of android.appwidget.AppWidgetHost in project android_frameworks_base by ParanoidAndroid.

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 2 with AppWidgetHost

use of android.appwidget.AppWidgetHost in project robolectric by robolectric.

the class ShadowAppWidgetHostTest method setup.

@Before
public void setup() throws Exception {
    context = RuntimeEnvironment.application;
    appWidgetHost = new AppWidgetHost(context, 404);
    shadowAppWidgetHost = shadowOf(appWidgetHost);
}
Also used : AppWidgetHost(android.appwidget.AppWidgetHost) Before(org.junit.Before)

Example 3 with AppWidgetHost

use of android.appwidget.AppWidgetHost in project robolectric by robolectric.

the class ShadowAppWidgetHostViewTest method shouldBeAbleToHaveHostSet.

@Test
public void shouldBeAbleToHaveHostSet() throws Exception {
    AppWidgetHost host = new AppWidgetHost(RuntimeEnvironment.application, 0);
    shadowAppWidgetHostView.setHost(host);
    assertThat(shadowAppWidgetHostView.getHost()).isSameAs(host);
}
Also used : AppWidgetHost(android.appwidget.AppWidgetHost) Test(org.junit.Test)

Example 4 with AppWidgetHost

use of android.appwidget.AppWidgetHost 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 5 with AppWidgetHost

use of android.appwidget.AppWidgetHost in project android_frameworks_base by ResurrectionRemix.

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)

Aggregations

AppWidgetHost (android.appwidget.AppWidgetHost)7 AppWidgetHostView (android.appwidget.AppWidgetHostView)5 AppWidgetProviderInfo (android.appwidget.AppWidgetProviderInfo)5 Context (android.content.Context)5 Before (org.junit.Before)1 Test (org.junit.Test)1