List of usage examples for android.widget RemoteViews setRemoteAdapter
@UnsupportedAppUsage public void setRemoteAdapter(int viewId, ArrayList<RemoteViews> list, int viewTypeCount)
From source file:Main.java
@SuppressWarnings("deprecation") public static final void setRemoteViewsAdapter(RemoteViews views, int appWidgetId, int viewId, Intent intent) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH) { views.setRemoteAdapter(appWidgetId, viewId, intent); } else {/*from w w w.j a va 2s.c o m*/ views.setRemoteAdapter(viewId, intent); } }
From source file:com.android.mms.widget.MmsWidgetProvider.java
/** * Update the widget appWidgetId//from w w w .j av a 2 s . c o m */ private static void updateWidget(Context context, int appWidgetId) { if (Log.isLoggable(LogTag.WIDGET, Log.VERBOSE)) { Log.v(TAG, "updateWidget appWidgetId: " + appWidgetId); } RemoteViews remoteViews = new RemoteViews(context.getPackageName(), R.layout.widget); PendingIntent clickIntent; // Launch an intent to avoid ANRs final Intent intent = new Intent(context, MmsWidgetService.class); intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId); intent.setData(Uri.parse(intent.toUri(Intent.URI_INTENT_SCHEME))); remoteViews.setRemoteAdapter(appWidgetId, R.id.conversation_list, intent); remoteViews.setTextViewText(R.id.widget_label, context.getString(R.string.sms_app_label)); // Open Mms's app conversation list when click on header final Intent convIntent = new Intent(context, ConversationList.class); clickIntent = PendingIntent.getActivity(context, 0, convIntent, PendingIntent.FLAG_UPDATE_CURRENT); remoteViews.setOnClickPendingIntent(R.id.widget_header, clickIntent); // On click intent for Compose final Intent composeIntent = new Intent(context, ComposeMessageActivity.class); composeIntent.setAction(Intent.ACTION_SENDTO); clickIntent = PendingIntent.getActivity(context, 0, composeIntent, PendingIntent.FLAG_UPDATE_CURRENT); remoteViews.setOnClickPendingIntent(R.id.widget_compose, clickIntent); // On click intent for Conversation TaskStackBuilder taskStackBuilder = TaskStackBuilder.create(context); taskStackBuilder.addParentStack(ComposeMessageActivity.class); Intent msgIntent = new Intent(Intent.ACTION_VIEW); msgIntent.setType("vnd.android-dir/mms-sms"); taskStackBuilder.addNextIntent(msgIntent); remoteViews.setPendingIntentTemplate(R.id.conversation_list, taskStackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT)); AppWidgetManager.getInstance(context).updateAppWidget(appWidgetId, remoteViews); }
From source file:com.concentriclivers.mms.com.android.mms.widget.MmsWidgetProvider.java
/** * Update the widget appWidgetId/*from w ww . j a v a 2s . c o m*/ */ private static void updateWidget(Context context, int appWidgetId) { // if (Log.isLoggable(LogTag.WIDGET, Log.VERBOSE)) { Log.v(TAG, "updateWidget appWidgetId: " + appWidgetId); // } RemoteViews remoteViews = new RemoteViews(context.getPackageName(), R.layout.widget); PendingIntent clickIntent; // Launch an intent to avoid ANRs final Intent intent = new Intent(context, MmsWidgetService.class); intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId); intent.setData(Uri.parse(intent.toUri(Intent.URI_INTENT_SCHEME))); remoteViews.setRemoteAdapter(appWidgetId, R.id.conversation_list, intent); remoteViews.setTextViewText(R.id.widget_label, context.getString(R.string.app_label)); // Open Mms's app conversation list when click on header final Intent convIntent = new Intent(context, ConversationList.class); clickIntent = PendingIntent.getActivity(context, 0, convIntent, PendingIntent.FLAG_UPDATE_CURRENT); remoteViews.setOnClickPendingIntent(R.id.widget_header, clickIntent); // On click intent for Compose final Intent composeIntent = new Intent(context, ComposeMessageActivity.class); composeIntent.setAction(Intent.ACTION_SENDTO); clickIntent = PendingIntent.getActivity(context, 0, composeIntent, PendingIntent.FLAG_UPDATE_CURRENT); remoteViews.setOnClickPendingIntent(R.id.widget_compose, clickIntent); // On click intent for Conversation TaskStackBuilder taskStackBuilder = TaskStackBuilder.create(context); taskStackBuilder.addParentStack(ComposeMessageActivity.class); Intent msgIntent = new Intent(Intent.ACTION_VIEW); msgIntent.setType("vnd.android-dir/mms-sms"); taskStackBuilder.addNextIntent(msgIntent); remoteViews.setPendingIntentTemplate(R.id.conversation_list, taskStackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT)); AppWidgetManager.getInstance(context).updateAppWidget(appWidgetId, remoteViews); }
From source file:com.example.olivi.maphap.widget.DetailWidgetProvider.java
/** * Sets the remote adapter used to fill in the list items * * @param views RemoteViews to set the RemoteAdapter *//*from w w w . j av a 2 s . c o m*/ @SuppressWarnings("deprecation") private void setRemoteAdapterV11(Context context, @NonNull final RemoteViews views) { views.setRemoteAdapter(0, R.id.widget_list, new Intent(context, DetailWidgetRemoteViewsService.class)); }
From source file:com.xengar.android.stocktracker.widget.ListWidgetProvider.java
/** * Sets the remote adapter used to fill in the list items. * * @param views RemoteViews to set the RemoteAdapter *///from w w w . j a v a 2s . c o m @SuppressWarnings("deprecation") private void setRemoteAdapterV11(Context context, @NonNull final RemoteViews views) { views.setRemoteAdapter(0, R.id.widget_list, new Intent(context, ListWidgetRemoteViewsService.class)); }
From source file:barqsoft.footballscores.widget.WidgetListProvider.java
/** * Sets the remote adapter used to fill in the list items * @param views RemoteViews to set the RemoteAdapter *//*from w w w .ja v a 2s .c om*/ @SuppressWarnings("deprecation") private void setRemoteAdapterV11(Context context, @NonNull final RemoteViews views) { views.setRemoteAdapter(0, R.id.widget_list, new Intent(context, WidgetListRemoteViewsService.class)); }
From source file:co.carlosjimenez.android.currencyalerts.app.widget.DetailWidgetProvider.java
/** * Sets the remote adapter used to fill in the list items * * @param views RemoteViews to set the RemoteAdapter *///w ww. j a v a 2 s . c o m @SuppressWarnings("deprecation") private void setRemoteAdapterV11(Context context, @NonNull final RemoteViews views, int[] appWidgetIds) { views.setRemoteAdapter(0, R.id.widget_list, new Intent(context, DetailWidgetRemoteViewsService.class)); }