List of usage examples for android.appwidget AppWidgetManager notifyAppWidgetViewDataChanged
public void notifyAppWidgetViewDataChanged(int appWidgetId, int viewId)
From source file:com.xengar.android.stocktracker.widget.ListWidgetProvider.java
@Override public void onReceive(@NonNull Context context, @NonNull Intent intent) { super.onReceive(context, intent); if (QuoteSyncJob.ACTION_DATA_UPDATED.equals(intent.getAction())) { AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context); int[] appWidgetIds = appWidgetManager.getAppWidgetIds(new ComponentName(context, getClass())); appWidgetManager.notifyAppWidgetViewDataChanged(appWidgetIds, R.id.widget_list); }/*from ww w .ja v a 2 s . c o m*/ }
From source file:co.carlosjimenez.android.currencyalerts.app.widget.DetailWidgetProvider.java
@Override public void onReceive(@NonNull Context context, @NonNull Intent intent) { super.onReceive(context, intent); if (ForexSyncAdapter.ACTION_DATA_UPDATED.equals(intent.getAction())) { AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context); int[] appWidgetIds = appWidgetManager.getAppWidgetIds(new ComponentName(context, getClass())); appWidgetManager.notifyAppWidgetViewDataChanged(appWidgetIds, R.id.widget_list); }/*from w w w. j a v a2 s . co m*/ }
From source file:com.miz.service.TheTVDB.java
private void updateWidgets() { AppWidgetManager awm = AppWidgetManager.getInstance(this); awm.notifyAppWidgetViewDataChanged( awm.getAppWidgetIds(new ComponentName(this, ShowStackWidgetProvider.class)), R.id.stack_view); // Update stack view widget awm.notifyAppWidgetViewDataChanged(/*from www . ja v a 2s .c o m*/ awm.getAppWidgetIds(new ComponentName(this, ShowCoverWidgetProvider.class)), R.id.widget_grid); // Update grid view widget awm.notifyAppWidgetViewDataChanged( awm.getAppWidgetIds(new ComponentName(this, ShowBackdropWidgetProvider.class)), R.id.widget_grid); // Update grid view widget }
From source file:com.concentriclivers.mms.com.android.mms.widget.MmsWidgetProvider.java
@Override public void onReceive(Context context, Intent intent) { // if (Log.isLoggable(LogTag.WIDGET, Log.VERBOSE)) { Log.v(TAG, "onReceive intent: " + intent); // }//from ww w. ja v a 2s .c o m String action = intent.getAction(); // The base class AppWidgetProvider's onReceive handles the normal widget intents. Here // we're looking for an intent sent by the messaging app when it knows a message has // been sent or received (or a conversation has been read) and is telling the widget it // needs to update. if (ACTION_NOTIFY_DATASET_CHANGED.equals(action)) { AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context); int[] appWidgetIds = appWidgetManager .getAppWidgetIds(new ComponentName(context, MmsWidgetProvider.class)); if (appWidgetIds.length > 0) { appWidgetManager.notifyAppWidgetViewDataChanged(appWidgetIds[0], R.id.conversation_list); } } else { super.onReceive(context, intent); } }
From source file:com.battlelancer.seriesguide.appwidget.ListWidgetProvider.java
@Override public void onReceive(Context context, Intent intent) { super.onReceive(context, intent); // check if we received our update alarm if (UPDATE.equals(intent.getAction())) { // trigger refresh of list widgets AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context); int[] appWidgetIds = appWidgetManager .getAppWidgetIds(new ComponentName(context, ListWidgetProvider.class)); appWidgetManager.notifyAppWidgetViewDataChanged(appWidgetIds, R.id.list_view); }/*from ww w .j a va 2s . co m*/ }
From source file:com.android.mms.widget.MmsWidgetProvider.java
@Override public void onReceive(Context context, Intent intent) { if (Log.isLoggable(LogTag.WIDGET, Log.VERBOSE)) { Log.v(TAG, "onReceive intent: " + intent); }/*from ww w . ja va 2 s.c o m*/ String action = intent.getAction(); // The base class AppWidgetProvider's onReceive handles the normal widget intents. Here // we're looking for an intent sent by the messaging app when it knows a message has // been sent or received (or a conversation has been read) and is telling the widget it // needs to update. if (ACTION_NOTIFY_DATASET_CHANGED.equals(action)) { AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context); int[] appWidgetIds = appWidgetManager .getAppWidgetIds(new ComponentName(context, MmsWidgetProvider.class)); // We need to update all Mms appwidgets on the home screen. appWidgetManager.notifyAppWidgetViewDataChanged(appWidgetIds, R.id.conversation_list); } else { super.onReceive(context, intent); } }
From source file:barqsoft.footballscores.widget.WidgetListProvider.java
@Override public void onReceive(@NonNull Context context, @NonNull Intent intent) { super.onReceive(context, intent); if (ScoresSyncAdapter.ACTION_DATA_UPDATED.equals(intent.getAction())) { AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context); int[] appWidgetIds = appWidgetManager.getAppWidgetIds(new ComponentName(context, getClass())); //This method will trigger WidgetListRemoteViewsService RemoteViewsFactory // .onDataChanged() and update the widget UI appWidgetManager.notifyAppWidgetViewDataChanged(appWidgetIds, R.id.widget_list); }// w w w . ja v a 2 s .c o m }
From source file:com.todotxt.todotxttouch.widget.ListWidgetProvider.java
@Override public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { for (int i = 0; i < appWidgetIds.length; ++i) { RemoteViews layout = buildLayout(context, appWidgetIds[i], false); appWidgetManager.updateAppWidget(appWidgetIds[i], layout); }//from w ww . j a v a2 s . c om appWidgetManager.notifyAppWidgetViewDataChanged(appWidgetIds, R.id.widget_list); super.onUpdate(context, appWidgetManager, appWidgetIds); }
From source file:com.ravi.apps.android.newsbytes.widget.NewsWidgetProvider.java
@Override public void onReceive(Context context, Intent intent) { super.onReceive(context, intent); // Get the intent action. String action = intent.getAction(); Log.d(LOG_TAG, context.getString(R.string.log_on_receive) + action); // If the widget was enabled, start the sync adapter for immediate sync. if (AppWidgetManager.ACTION_APPWIDGET_ENABLED.equals(action)) { // Initialize the sync adapter and trigger an immediate sync. NewsSyncAdapter.initializeSyncAdapter(context); NewsSyncAdapter.syncImmediately(context); }//from www. j a va 2s .c om // If the underlying data has been updated, notify the widgets to refresh their views if (context.getString(R.string.action_data_updated).equals(action)) { // Get the app widget manager. AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context); // Get app widget ids from the app widget manager. int[] appWidgetIds = appWidgetManager.getAppWidgetIds(new ComponentName(context, getClass())); // Notify the app widget manager that the underlying widget data has changed. appWidgetManager.notifyAppWidgetViewDataChanged(appWidgetIds, R.id.widget_list_view); } }
From source file:de.hero.vertretungsplan.MainActivity.java
@SuppressLint("NewApi") public void updateWidget() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { AppWidgetManager appManager = AppWidgetManager.getInstance(this); ComponentName name = new ComponentName(this, WidgetProvider.class); appManager.notifyAppWidgetViewDataChanged(appManager.getAppWidgetIds(name), R.id.words); }//from w w w .j a va 2 s . co m }