Search in sources :

Example 26 with AppWidgetProviderInfo

use of android.appwidget.AppWidgetProviderInfo 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 27 with AppWidgetProviderInfo

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

the class AppWidgetHostActivity method handleAppWidgetPickResult.

void handleAppWidgetPickResult(int resultCode, Intent intent) {
    // BEGIN_INCLUDE(getExtra_EXTRA_APPWIDGET_ID)
    Bundle extras = intent.getExtras();
    int appWidgetId = extras.getInt(AppWidgetManager.EXTRA_APPWIDGET_ID);
    // END_INCLUDE(getExtra_EXTRA_APPWIDGET_ID)
    if (resultCode == RESULT_OK) {
        AppWidgetProviderInfo appWidget = mAppWidgetManager.getAppWidgetInfo(appWidgetId);
        if (appWidget.configure != null) {
            // configure the AppWidget if we should
            configureAppWidget(CONFIGURE_APPWIDGET_REQUEST, appWidgetId, appWidget.configure);
        } else {
            // just add it as is
            addAppWidgetView(appWidgetId, appWidget);
        }
    } else {
        mHost.deleteAppWidgetId(appWidgetId);
    }
}
Also used : Bundle(android.os.Bundle) AppWidgetProviderInfo(android.appwidget.AppWidgetProviderInfo)

Example 28 with AppWidgetProviderInfo

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

the class AppWidgetServiceImpl method dumpProvider.

private static void dumpProvider(Provider provider, int index, PrintWriter pw) {
    AppWidgetProviderInfo info = provider.info;
    pw.print("  [");
    pw.print(index);
    pw.print("] provider ");
    pw.println(provider.id);
    pw.print("    min=(");
    pw.print(info.minWidth);
    pw.print("x");
    pw.print(info.minHeight);
    pw.print(")   minResize=(");
    pw.print(info.minResizeWidth);
    pw.print("x");
    pw.print(info.minResizeHeight);
    pw.print(") updatePeriodMillis=");
    pw.print(info.updatePeriodMillis);
    pw.print(" resizeMode=");
    pw.print(info.resizeMode);
    pw.print(" widgetCategory=");
    pw.print(info.widgetCategory);
    pw.print(" autoAdvanceViewId=");
    pw.print(info.autoAdvanceViewId);
    pw.print(" initialLayout=#");
    pw.print(Integer.toHexString(info.initialLayout));
    pw.print(" initialKeyguardLayout=#");
    pw.print(Integer.toHexString(info.initialKeyguardLayout));
    pw.print(" zombie=");
    pw.println(provider.zombie);
}
Also used : AppWidgetProviderInfo(android.appwidget.AppWidgetProviderInfo)

Example 29 with AppWidgetProviderInfo

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

the class AppWidgetHostActivity method handleAppWidgetConfigureResult.

void handleAppWidgetConfigureResult(int resultCode, Intent data) {
    int appWidgetId = getPreferences(0).getInt(PENDING_APPWIDGET_ID, -1);
    Log.d(TAG, "resultCode=" + resultCode + " appWidgetId=" + appWidgetId);
    if (appWidgetId < 0) {
        Log.w(TAG, "was no preference for PENDING_APPWIDGET_ID");
        return;
    }
    if (resultCode == RESULT_OK) {
        AppWidgetProviderInfo appWidget = mAppWidgetManager.getAppWidgetInfo(appWidgetId);
        addAppWidgetView(appWidgetId, appWidget);
    } else {
        mHost.deleteAppWidgetId(appWidgetId);
    }
}
Also used : AppWidgetProviderInfo(android.appwidget.AppWidgetProviderInfo)

Example 30 with AppWidgetProviderInfo

use of android.appwidget.AppWidgetProviderInfo 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

AppWidgetProviderInfo (android.appwidget.AppWidgetProviderInfo)91 Point (android.graphics.Point)24 ComponentName (android.content.ComponentName)21 AppWidgetHostView (android.appwidget.AppWidgetHostView)18 Bundle (android.os.Bundle)18 WidgetBackupProvider (com.android.server.WidgetBackupProvider)15 ActivityInfo (android.content.pm.ActivityInfo)14 ResolveInfo (android.content.pm.ResolveInfo)14 ArrayList (java.util.ArrayList)13 IOException (java.io.IOException)12 XmlPullParserException (org.xmlpull.v1.XmlPullParserException)12 Intent (android.content.Intent)10 PackageManager (android.content.pm.PackageManager)9 Resources (android.content.res.Resources)7 View (android.view.View)7 Context (android.content.Context)6 IPackageManager (android.content.pm.IPackageManager)6 NameNotFoundException (android.content.pm.PackageManager.NameNotFoundException)6 TypedArray (android.content.res.TypedArray)6 XmlResourceParser (android.content.res.XmlResourceParser)6