use of android.appwidget.AppWidgetManager in project Fairphone by Kwamecorp.
the class PeaceOfMindBroadCastReceiver method updateWidget.
private void updateWidget(Context context) {
AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context);
int[] appWidgetIds = appWidgetManager.getAppWidgetIds(new ComponentName(context, WidgetProvider.class));
if (appWidgetIds.length > 0) {
new WidgetProvider().onUpdate(context, appWidgetManager, appWidgetIds);
}
}
use of android.appwidget.AppWidgetManager in project Etar-Calendar by Etar-Group.
the class CalendarAppWidgetProvider method onReceive.
/**
* {@inheritDoc}
*/
@Override
public void onReceive(Context context, Intent intent) {
// Handle calendar-specific updates ourselves because they might be
// coming in without extras, which AppWidgetProvider then blocks.
final String action = intent.getAction();
if (LOGD)
Log.d(TAG, "AppWidgetProvider got the intent: " + intent.toString());
if (Utils.getWidgetUpdateAction(context).equals(action)) {
AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context);
performUpdate(context, appWidgetManager, appWidgetManager.getAppWidgetIds(getComponentName(context)), null);
} else if (action.equals(Intent.ACTION_PROVIDER_CHANGED) || action.equals(Intent.ACTION_TIME_CHANGED) || action.equals(Intent.ACTION_TIMEZONE_CHANGED) || action.equals(Intent.ACTION_DATE_CHANGED) || action.equals(Utils.getWidgetScheduledUpdateAction(context))) {
Intent service = new Intent(context, CalendarAppWidgetService.class);
context.startService(service);
} else {
super.onReceive(context, intent);
}
}
use of android.appwidget.AppWidgetManager in project android_frameworks_base by DirtyUnicorns.
the class TestAppWidgetProvider method onReceive.
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
Log.d(TAG, "intent=" + intent);
if (AppWidgetManager.ACTION_APPWIDGET_ENABLED.equals(action)) {
Log.d(TAG, "ENABLED");
} else if (AppWidgetManager.ACTION_APPWIDGET_DISABLED.equals(action)) {
Log.d(TAG, "DISABLED");
} else if (AppWidgetManager.ACTION_APPWIDGET_UPDATE.equals(action)) {
if (true)
return;
Log.d(TAG, "UPDATE");
Bundle extras = intent.getExtras();
int[] appWidgetIds = extras.getIntArray(AppWidgetManager.EXTRA_APPWIDGET_IDS);
AppWidgetManager gm = AppWidgetManager.getInstance(context);
RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.test_appwidget);
views.setTextViewText(R.id.oh_hai_text, "hai: " + SystemClock.elapsedRealtime());
if (false) {
gm.updateAppWidget(appWidgetIds, views);
} else {
gm.updateAppWidget(new ComponentName("com.android.tests.appwidgetprovider", "com.android.tests.appwidgetprovider.TestAppWidgetProvider"), views);
}
}
}
use of android.appwidget.AppWidgetManager in project WordPress-Android by wordpress-mobile.
the class StatsWidgetProvider method refreshAllWidgets.
public static void refreshAllWidgets(Context context, SiteStore siteStore) {
AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context);
ComponentName thisWidget = new ComponentName(context, StatsWidgetProvider.class);
int[] allWidgetIds = appWidgetManager.getAppWidgetIds(thisWidget);
refreshWidgets(context, allWidgetIds, siteStore);
}
use of android.appwidget.AppWidgetManager in project newsrob by marianokamp.
the class UnreadWidgetProvider method requestWidgetsUpdate.
public static void requestWidgetsUpdate(Context ctx) {
AppWidgetManager awm = AppWidgetManager.getInstance(ctx);
int[] appWidgetIds = awm.getAppWidgetIds(new ComponentName(ctx, UnreadWidgetProvider.class));
Timing t = new Timing(TAG + " requestWidgetsUpdate for " + appWidgetIds.length + " widget(s)", ctx);
for (int appWidgetId : appWidgetIds) {
PL.log("UnreadWidgetProvider.requestWidgetsUpdate, about to call UWP.buildUpdate for widget id " + appWidgetId + ".", ctx);
awm.updateAppWidget(appWidgetId, UnreadWidgetProvider.buildUpdate(ctx, appWidgetId));
}
t.stop();
}
Aggregations