Search in sources :

Example 6 with AppWidgetManager

use of android.appwidget.AppWidgetManager in project Fairphone by Kwamecorp.

the class LauncherTransitionable method updateAppSwitcherWidgets.

public void updateAppSwitcherWidgets() {
    AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(this);
    int[] appWidgetIds = appWidgetManager.getAppWidgetIds(new ComponentName(this, WidgetProvider.class));
    if (appWidgetIds.length > 0) {
        new WidgetProvider().onUpdate(this, appWidgetManager, appWidgetIds);
    }
}
Also used : WidgetProvider(org.fairphone.widgets.appswitcher.WidgetProvider) AppWidgetManager(android.appwidget.AppWidgetManager) ComponentName(android.content.ComponentName)

Example 7 with AppWidgetManager

use of android.appwidget.AppWidgetManager in project k-9 by k9mail.

the class MessageListWidgetProvider method triggerMessageListWidgetUpdate.

public static void triggerMessageListWidgetUpdate(Context context) {
    Context appContext = context.getApplicationContext();
    AppWidgetManager widgetManager = AppWidgetManager.getInstance(appContext);
    ComponentName widget = new ComponentName(appContext, MessageListWidgetProvider.class);
    int[] widgetIds = widgetManager.getAppWidgetIds(widget);
    Intent intent = new Intent(context, MessageListWidgetProvider.class);
    intent.setAction(ACTION_UPDATE_MESSAGE_LIST);
    intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, widgetIds);
    context.sendBroadcast(intent);
}
Also used : Context(android.content.Context) AppWidgetManager(android.appwidget.AppWidgetManager) ComponentName(android.content.ComponentName) Intent(android.content.Intent) PendingIntent(android.app.PendingIntent)

Example 8 with AppWidgetManager

use of android.appwidget.AppWidgetManager in project k-9 by k9mail.

the class MessageListWidgetProvider method onReceive.

@Override
public void onReceive(Context context, Intent intent) {
    super.onReceive(context, intent);
    String action = intent.getAction();
    if (action.equals(ACTION_UPDATE_MESSAGE_LIST)) {
        AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context);
        int[] appWidgetIds = intent.getIntArrayExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS);
        appWidgetManager.notifyAppWidgetViewDataChanged(appWidgetIds, R.id.listView);
    }
}
Also used : AppWidgetManager(android.appwidget.AppWidgetManager)

Example 9 with AppWidgetManager

use of android.appwidget.AppWidgetManager in project qksms by moezbhatti.

the class WidgetProvider method notifyThemeChanged.

public static void notifyThemeChanged(Context context) {
    if (context != null) {
        AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context);
        int[] appWidgetIds = appWidgetManager.getAppWidgetIds(new ComponentName(context, WidgetProvider.class));
        for (int appWidgetId : appWidgetIds) {
            updateWidget(context, appWidgetId, isSmallWidget(appWidgetManager, appWidgetId));
        }
    }
    notifyDatasetChanged(context);
}
Also used : AppWidgetProvider(android.appwidget.AppWidgetProvider) AppWidgetManager(android.appwidget.AppWidgetManager) ComponentName(android.content.ComponentName)

Example 10 with AppWidgetManager

use of android.appwidget.AppWidgetManager in project Timber by naman14.

the class BaseWidget method onReceive.

@Override
public void onReceive(Context context, Intent intent) {
    String action = intent.getAction();
    if (action != null && action.startsWith("com.naman14.timber.")) {
        AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context);
        ComponentName thisAppWidget = new ComponentName(context.getPackageName(), this.getClass().getName());
        int[] appWidgetIds = appWidgetManager.getAppWidgetIds(thisAppWidget);
        onUpdate(context, appWidgetManager, appWidgetIds);
    } else {
        super.onReceive(context, intent);
    }
}
Also used : AppWidgetManager(android.appwidget.AppWidgetManager) ComponentName(android.content.ComponentName)

Aggregations

AppWidgetManager (android.appwidget.AppWidgetManager)51 ComponentName (android.content.ComponentName)32 RemoteViews (android.widget.RemoteViews)25 Intent (android.content.Intent)20 PendingIntent (android.app.PendingIntent)12 Bundle (android.os.Bundle)12 SharedPreferences (android.content.SharedPreferences)7 Context (android.content.Context)5 View (android.view.View)4 Uri (android.net.Uri)3 AppWidgetProvider (android.appwidget.AppWidgetProvider)2 PackageManager (android.content.pm.PackageManager)2 Cursor (android.database.Cursor)2 Button (android.widget.Button)2 EditText (android.widget.EditText)2 TextView (android.widget.TextView)2 Account (android.accounts.Account)1 Service (android.app.Service)1 AppWidgetProviderInfo (android.appwidget.AppWidgetProviderInfo)1 ContentResolver (android.content.ContentResolver)1