@Override public RemoteViews getViewAt(final int position) { if (position >= this.tasks.size()) { return null; } final Task task = this.tasks.get(position); // Get The Task final boolean isMinimalistic = WidgetHelper.isMinimalistic(this.mContext, this.widgetId); RemoteViews rv = new RemoteViews( this.mContext.getPackageName(), isMinimalistic ? R.layout.widget_row_minimal : R.layout.widget_row); // Set the Contents of the Row rv = WidgetHelper.configureItem( rv, task, this.mContext, this.list.getId(), isMinimalistic, this.widgetId); // Set the Click–Intent // We need to do so, because we can not start the Activity directly from // the Service final Bundle extras = new Bundle(); extras.putInt(MainWidgetProvider.EXTRA_TASKID, (int) task.getId()); final Intent fillInIntent = new Intent(MainWidgetProvider.CLICK_TASK); fillInIntent.putExtras(extras); rv.setOnClickFillInIntent(R.id.tasks_row, fillInIntent); return rv; }
@Override public RemoteViews getViewAt(int position) { RemoteViews row = new RemoteViews(context.getPackageName(), R.layout.widget_list_item); cursor.moveToPosition(position); Log.d(TAG, "view at " + position); row.setTextViewText( R.id.score_textview, Utilies.getScores( cursor.getInt(scoresAdapter.COL_HOME_GOALS), cursor.getInt(scoresAdapter.COL_AWAY_GOALS))); row.setTextViewText(R.id.home_name, cursor.getString(scoresAdapter.COL_HOME)); row.setTextViewText(R.id.away_name, cursor.getString(scoresAdapter.COL_AWAY)); row.setTextViewText(R.id.data_textview, cursor.getString(scoresAdapter.COL_MATCHTIME)); Intent fillInIntent = new Intent(); row.setOnClickFillInIntent(R.id.list_item, fillInIntent); row.setImageViewResource( R.id.home_crest, Utilies.getTeamCrestByTeamName(cursor.getString(scoresAdapter.COL_HOME))); row.setImageViewResource( R.id.away_crest, Utilies.getTeamCrestByTeamName(cursor.getString(scoresAdapter.COL_AWAY))); return row; }
@Override public RemoteViews getViewAt(int position) { RemoteViews row; Match match = data.get(position); if (match.getTitle() != null) { row = new RemoteViews(context.getPackageName(), R.layout.widget_scores_section); row.setTextViewText(R.id.title, match.getTitle()); } else { row = new RemoteViews(context.getPackageName(), R.layout.widget_scores_list_item); row.setTextViewText(R.id.home_name, match.getHome()); row.setTextViewText(R.id.away_name, match.getAway()); row.setImageViewResource(R.id.home_crest, match.getHomeCrest()); row.setImageViewResource(R.id.away_crest, match.getAwayCrest()); row.setTextViewText(R.id.data_textview, match.getMacthTime()); row.setTextViewText(R.id.score_textview, match.getScore()); } Intent fillInIntent = new Intent(); fillInIntent.putExtra("ROW_NUMBER", position); row.setOnClickFillInIntent(R.id.row, fillInIntent); ; return row; }
@Override public RemoteViews getViewAt(int position) { if (items == null || position < 0 || position >= items.size()) { return null; } else { // todo cache? final Resources r = context.getResources(); final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); final int todayDueDateColor = prefs.getInt(Preferences.DUE_TODAY_COLOR, r.getColor(R.color.today_due_date_color)); final int expiredDueDateColor = prefs.getInt(Preferences.OVERDUE_COLOR, r.getColor(R.color.expired_due_date_color)); final int completedColor = r.getColor(R.color.widget_completed); final int defaultColor = r.getColor(R.color.white); TodoItem item = items.get(position); RemoteViews rv = new RemoteViews(context.getPackageName(), R.layout.widget_item); rv.setTextViewText(R.id.widget_item, item.summary); rv.setTextColor( R.id.widget_item, getItemColor(defaultColor, completedColor, todayDueDateColor, expiredDueDateColor, item)); final Intent fillInIntent = new Intent(); final Bundle bundle = new Bundle(); bundle.putLong(KTodoWidgetProvider.ON_ITEM_CLICK_ITEM_ID_EXTRA, item.id); bundle.putLong(AppWidgetManager.EXTRA_APPWIDGET_ID, widgetId); fillInIntent.putExtras(bundle); rv.setOnClickFillInIntent(R.id.widget_item, fillInIntent); return rv; } }
public RemoteViews buildUpdate(int position) { try { Task task = getTask(position); String textContent; Resources r = context.getResources(); int textColor = r.getColor(dark ? R.color.widget_text_color_dark : R.color.widget_text_color_light); textContent = task.getTitle(); RemoteViews row = new RemoteViews(Constants.PACKAGE, R.layout.widget_row); if (task.isCompleted()) { textColor = r.getColor(R.color.task_list_done); row.setInt(R.id.text, "setPaintFlags", Paint.STRIKE_THRU_TEXT_FLAG | Paint.ANTI_ALIAS_FLAG); } else { row.setInt(R.id.text, "setPaintFlags", Paint.ANTI_ALIAS_FLAG); if (task.hasDueDate() && task.isOverdue()) { textColor = r.getColor(R.color.task_list_overdue); } } row.setTextViewText(R.id.text, textContent); row.setTextColor(R.id.text, textColor); row.setImageViewResource(R.id.completeBox, getCheckbox(task)); Intent editIntent = new Intent(); editIntent.setAction(TasksWidget.EDIT_TASK); editIntent.putExtra(TaskEditFragment.TOKEN_ID, task.getId()); editIntent.putExtra(TaskListActivity.OPEN_TASK, task.getId()); row.setOnClickFillInIntent(R.id.text, editIntent); Intent completeIntent = new Intent(); completeIntent.setAction(TasksWidget.COMPLETE_TASK); completeIntent.putExtra(TaskEditFragment.TOKEN_ID, task.getId()); row.setOnClickFillInIntent(R.id.completeBox, completeIntent); return row; } catch (Exception e) { // can happen if database is not ready Log.e("WIDGET-UPDATE", "Error updating widget", e); } return null; }
public void configureList(Context context, int widgetId, RemoteViews rv) { Intent intent = new Intent(context, EventWidgetService.class); intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, widgetId); intent.setData(Uri.parse(intent.toUri(Intent.URI_INTENT_SCHEME))); rv.setRemoteAdapter(R.id.event_list, intent); rv.setEmptyView(R.id.event_list, R.id.empty_event_list); rv.setPendingIntentTemplate(R.id.event_list, createOpenCalendarEventPendingIntent(context)); rv.setOnClickFillInIntent( R.id.empty_event_list, createOpenCalendarAtDayIntent(context, new DateTime())); }
/** * You can do heaving lifting in here, synchronously. For example, if you need to process an * image, fetch something from the network, etc., it is ok to do it here, synchronously. A loading * view will show up in lieu of the actual contents in the interim. */ public RemoteViews getViewAt(int position) { final RemoteViews rv = new RemoteViews(mContext.getPackageName(), R.layout.stackview_widget_item); if (mPhotos.size() == 0) { updatePhotos(); } /* Fetch the photo synchronously */ final Photo photo = mPhotos.get(position); Bitmap bitmap = null; try { bitmap = Picasso.with(mContext).load(photo.getSmallUrl()).get(); } catch (IOException e) { e.printStackTrace(); } rv.setImageViewBitmap(R.id.image_item, bitmap); /* Set the overlay views and owner info */ rv.setViewVisibility(R.id.imageOverlay, View.VISIBLE); String viewsText = String.format( "%s: %s", mContext.getString(R.string.views), String.valueOf(photo.getViews())); rv.setTextViewText(R.id.viewsText, viewsText); if (photo.getOwner() != null) { rv.setTextViewText(R.id.ownerText, photo.getOwner().getUsername()); } /* Show ribbon in corner if photo is new */ // TODO: create list of new photos to enable this // rv.setVisibility(R.id.imageNewRibbon, View.INVISIBLE); // if (mNewPhotos != null) { // for (Photo p : mNewPhotos) { // if (p.getId().equals(photo.getId())) { // holder.imageNewRibbon.setVisibility(View.VISIBLE); // } // } // } /* Next, we set a fill-intent which will be used to fill-in the pending * intent template which is set on the collection view in * StackWidgetProvider. */ Bundle extras = new Bundle(); extras.putInt(StackWidgetProvider.VIEW_INDEX, position); extras.putString(PhotoViewerActivity.KEY_PHOTO_LIST_FILE, PhotoViewerActivity.PHOTO_LIST_FILE); Intent fillInIntent = new Intent(); fillInIntent.putExtras(extras); rv.setOnClickFillInIntent(R.id.image_layout, fillInIntent); return rv; }
@Override public synchronized RemoteViews getViewAt(int position) { if (mSource == null) { // This instance has been destroyed, exit out return null; } Bitmap bitmap = mSource.getImage(position); if (bitmap == null) return getLoadingView(); RemoteViews views = new RemoteViews(mApp.getAndroidContext().getPackageName(), R.layout.appwidget_photo_item); views.setImageViewBitmap(R.id.appwidget_photo_item, bitmap); views.setOnClickFillInIntent( R.id.appwidget_photo_item, new Intent() .setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP) .setData(mSource.getContentUri(position))); return views; }
@Override public RemoteViews getViewAt(int position) { RemoteViews mView = new RemoteViews(mContext.getPackageName(), R.layout.widget_list_item); mView.setTextViewText(R.id.title, mCollections.get(position).getTitle()); mView.setImageViewResource(R.id.icon, mCollections.get(position).getIcon()); final Intent fillInIntent = new Intent(); fillInIntent.setAction(WidgetProvider.FRAG_START); int temp = position + TinkerActivity.FRAG_ARRAY_START; // position += TinkerActivity.FRAG_ARRAY_START; final Bundle bundle = new Bundle(); bundle.putInt(WidgetProvider.EXTRA_STRING, temp); fillInIntent.putExtras(bundle); mView.setOnClickFillInIntent(R.id.backgroundImage, fillInIntent); return mView; }
@Override public RemoteViews getViewAt(final int position) { synchronized (sWidgetLock) { final Phrase phrase = mPhrases.get(position); final RemoteViews itemView = new RemoteViews(mContext.getPackageName(), R.layout.list_item_appwidget_phrase); itemView.setTextViewText(R.id.text, phrase.getText()); final Bundle extras = new Bundle(); extras.putInt(AppWidgetManager.EXTRA_APPWIDGET_ID, mAppWidgetId); extras.putString(Intent.EXTRA_TEXT, phrase.getText()); final Intent clickIntent = new Intent(); clickIntent.putExtras(extras); itemView.setOnClickFillInIntent(R.id.phrase, clickIntent); return itemView; } }
public RemoteViews getViewAt(int position) { // position will always range from 0 to getCount() - 1. // We construct a remote views item based on our widget item xml file, // and set the // text based on the position. RemoteViews rv = new RemoteViews(mContext.getPackageName(), R.layout.widget_item); rv.setTextViewText(R.id.widget_name, mWidgetItems.get(position).getNameEn()); rv.setTextViewText(R.id.widget_date, mWidgetItems.get(position).getDates().get(0)); rv.setImageViewBitmap(R.id.widget_img, mWidgetItems.get(position).getPhoto()); rv.setTextViewText(R.id.widget_days, mWidgetItems.get(position).getDays() + " days"); rv.setTextViewText(R.id.widget_price, mWidgetItems.get(position).getPrice() + "$"); // Next, we set a fill-intent which will be used to fill-in the pending // intent template // which is set on the collection view in StackWidgetProvider. Bundle extras = new Bundle(); extras.putInt(StackWidgetProvider.EXTRA_ITEM, position); Intent fillInIntent = new Intent(); fillInIntent.putExtras(extras); rv.setOnClickFillInIntent(R.id.widget_name, fillInIntent); // You can do heaving lifting in here, synchronously. For example, if // you need to // process an image, fetch something from the network, etc., it is ok to // do it here, // synchronously. A loading view will show up in lieu of the actual // contents in the // interim. try { System.out.println("Loading view " + position); Thread.sleep(500); } catch (InterruptedException e) { e.printStackTrace(); } // Return the remote views object. return rv; }
@Override public RemoteViews getViewAt(int position) { RemoteViews mView = new RemoteViews(mContext.getPackageName(), R.layout.scores_list_item); if (cursor != null) { if (cursor.moveToPosition(position)) { String dir = cursor.getString(cursor.getColumnIndex("date")); mView.setTextViewText(R.id.home_name, "" + cursor.getString(COL_HOME)); mView.setTextViewText(R.id.away_name, "" + cursor.getString(COL_AWAY)); mView.setTextViewText(R.id.data_textview, "" + cursor.getString(COL_DATE)); mView.setTextViewText( R.id.score_textview, "" + Utilies.getScores(cursor.getInt(COL_HOME_GOALS), cursor.getInt(COL_AWAY_GOALS))); mView.setImageViewResource( R.id.home_crest, Utilies.getTeamCrestByTeamName(cursor.getString(COL_HOME))); mView.setImageViewResource( R.id.away_crest, Utilies.getTeamCrestByTeamName(cursor.getString(COL_AWAY))); } } final Intent fillInIntent = new Intent(); fillInIntent.setAction(WidgetProvider.ACTION_OPEN_ACTIVITY); final Bundle bundle = new Bundle(); bundle.putString(WidgetProvider.EXTRA_HOME_NAME, cursor.getString(COL_HOME)); bundle.putString(WidgetProvider.EXTRA_AWAY_NAME, cursor.getString(COL_AWAY)); bundle.putString( WidgetProvider.EXTRA_SCORE, Utilies.getScores(cursor.getInt(COL_HOME_GOALS), cursor.getInt(COL_AWAY_GOALS))); bundle.putString(WidgetProvider.EXTRA_DATE, cursor.getString(COL_DATE)); bundle.putInt(WidgetProvider.EXTRA_MATCH_DAY, cursor.getInt(COL_MATCH_DAY)); bundle.putInt(WidgetProvider.EXTRA_LEAGUE, cursor.getInt(COL_LEAGUE)); fillInIntent.putExtras(bundle); mView.setOnClickFillInIntent(R.id.widget_id, fillInIntent); return mView; }
@Override public RemoteViews getViewAt(int position) { RemoteViews v = new RemoteViews(mContext.getPackageName(), R.layout.widget_detail_list_item); String locationSetting = Utility.getPreferredLocation(mContext); String sort = COLUMN_DATE + " ASC"; Uri weatherForLocationUri = WeatherContract.WeatherEntry.buildWeatherLocationWithStartDate( locationSetting, System.currentTimeMillis()); Cursor c = mContext.getContentResolver().query(weatherForLocationUri, null, null, null, sort); int icon = 0; String date = ""; String descr = ""; String high = ""; String low = ""; Uri data = null; if (c != null && c.moveToPosition(position)) { icon = Utility.getArtResourceForWeatherCondition(c, mContext); date = Utility.getCalendarDate(c, mContext); descr = Utility.getDescription(c, mContext); high = Utility.formatTemperature(mContext, c.getDouble(c.getColumnIndex(COLUMN_MAX_TEMP))); low = Utility.formatTemperature(mContext, c.getDouble(c.getColumnIndex(COLUMN_MIN_TEMP))); data = WeatherContract.WeatherEntry.buildWeatherLocationWithDate( locationSetting, c.getLong(c.getColumnIndex(COLUMN_DATE))); c.close(); } v.setImageViewResource(R.id.widget_icon, icon); v.setTextViewText(R.id.widget_date, date); v.setTextViewText(R.id.widget_description, descr); v.setTextViewText(R.id.widget_temp_max, high); v.setTextViewText(R.id.widget_temp_min, low); v.setOnClickFillInIntent(R.id.widget_list_item, new Intent().setData(data)); return v; }
@Override public void setViewClickFillInIntent(int viewId, Intent fillIntent) { mRemoteViews.setOnClickFillInIntent(viewId, fillIntent); }
public RemoteViews getViewAt(int position) { RemoteViews rv; boolean isSectionHeader = mHeaderPositionMap.get(position); int offset = mPMap.get(position); Intent homeIntent = new Intent(mContext, HomeActivity.class); if (isSectionHeader) { rv = new RemoteViews(mContext.getPackageName(), R.layout.list_item_schedule_header); Section section = mSections.get(offset - 1); rv.setTextViewText(R.id.list_item_schedule_header_textview, section.getTitle()); } else { int cursorPosition = position - offset; mCursor.moveToPosition(cursorPosition); rv = new RemoteViews(mContext.getPackageName(), R.layout.list_item_schedule_block_widget); final String type = mCursor.getString(BlocksQuery.BLOCK_TYPE); final String blockId = mCursor.getString(BlocksQuery.BLOCK_ID); final String blockTitle = mCursor.getString(BlocksQuery.BLOCK_TITLE); final String blockType = mCursor.getString(BlocksQuery.BLOCK_TYPE); final String blockMeta = mCursor.getString(BlocksQuery.BLOCK_META); final long blockStart = mCursor.getLong(BlocksQuery.BLOCK_START); final long blockEnd = mCursor.getLong(BlocksQuery.BLOCK_END); final Resources res = mContext.getResources(); rv.setTextViewText(R.id.block_endtime, null); if (ScheduleContract.Blocks.BLOCK_TYPE_SESSION.equals(type) || ScheduleContract.Blocks.BLOCK_TYPE_CODELAB.equals(type) || ScheduleContract.Blocks.BLOCK_TYPE_OFFICE_HOURS.equals(blockType)) { final int numStarredSessions = mCursor.getInt(BlocksQuery.NUM_STARRED_SESSIONS); final String starredSessionId = mCursor.getString(BlocksQuery.STARRED_SESSION_ID); if (numStarredSessions == 0) { // No sessions starred rv.setTextViewText( R.id.block_title, mContext.getString( R.string.schedule_empty_slot_title_template, TextUtils.isEmpty(blockTitle) ? "" : (" " + blockTitle.toLowerCase()))); rv.setTextColor(R.id.block_title, res.getColor(R.color.body_text_1_positive)); rv.setTextViewText( R.id.block_subtitle, mContext.getString(R.string.schedule_empty_slot_subtitle)); rv.setViewVisibility(R.id.extra_button, View.GONE); Intent fillIntent = TaskStackBuilderProxyActivity.getFillIntent( homeIntent, new Intent( Intent.ACTION_VIEW, ScheduleContract.Blocks.buildSessionsUri(blockId))); rv.setOnClickFillInIntent(R.id.list_item_middle_container, fillIntent); } else if (numStarredSessions == 1) { // exactly 1 session starred final String starredSessionTitle = mCursor.getString(BlocksQuery.STARRED_SESSION_TITLE); String starredSessionSubtitle = mCursor.getString(BlocksQuery.STARRED_SESSION_ROOM_NAME); if (starredSessionSubtitle == null) { starredSessionSubtitle = mContext.getString(R.string.unknown_room); } // Determine if the session is in the past long currentTimeMillis = UIUtils.getCurrentTime(mContext); boolean conferenceEnded = currentTimeMillis > UIUtils.CONFERENCE_END_MILLIS; boolean blockEnded = currentTimeMillis > blockEnd; if (blockEnded && !conferenceEnded) { starredSessionSubtitle = mContext.getString(R.string.session_finished); } rv.setTextViewText(R.id.block_title, starredSessionTitle); rv.setTextColor(R.id.block_title, res.getColor(R.color.body_text_1)); rv.setTextViewText(R.id.block_subtitle, starredSessionSubtitle); rv.setViewVisibility(R.id.extra_button, View.VISIBLE); Intent fillIntent = TaskStackBuilderProxyActivity.getFillIntent( homeIntent, new Intent( Intent.ACTION_VIEW, ScheduleContract.Sessions.buildSessionUri(starredSessionId))); rv.setOnClickFillInIntent(R.id.list_item_middle_container, fillIntent); fillIntent = TaskStackBuilderProxyActivity.getFillIntent( homeIntent, new Intent( Intent.ACTION_VIEW, ScheduleContract.Blocks.buildSessionsUri(blockId))); rv.setOnClickFillInIntent(R.id.extra_button, fillIntent); } else { // 2 or more sessions starred rv.setTextViewText( R.id.block_title, mContext.getString(R.string.schedule_conflict_title, numStarredSessions)); rv.setTextColor(R.id.block_title, res.getColor(R.color.body_text_1)); rv.setTextViewText( R.id.block_subtitle, mContext.getString(R.string.schedule_conflict_subtitle)); rv.setViewVisibility(R.id.extra_button, View.VISIBLE); Intent fillIntent = TaskStackBuilderProxyActivity.getFillIntent( homeIntent, new Intent( Intent.ACTION_VIEW, ScheduleContract.Blocks.buildStarredSessionsUri(blockId))); rv.setOnClickFillInIntent(R.id.list_item_middle_container, fillIntent); fillIntent = TaskStackBuilderProxyActivity.getFillIntent( homeIntent, new Intent( Intent.ACTION_VIEW, ScheduleContract.Blocks.buildSessionsUri(blockId))); rv.setOnClickFillInIntent(R.id.extra_button, fillIntent); } rv.setTextColor(R.id.block_subtitle, res.getColor(R.color.body_text_2)); } else if (ScheduleContract.Blocks.BLOCK_TYPE_KEYNOTE.equals(type)) { long currentTimeMillis = UIUtils.getCurrentTime(mContext); boolean past = (currentTimeMillis > blockEnd && currentTimeMillis < UIUtils.CONFERENCE_END_MILLIS); boolean present = !past && (currentTimeMillis >= blockStart); boolean canViewStream = present && UIUtils.hasHoneycomb(); final String starredSessionId = mCursor.getString(BlocksQuery.STARRED_SESSION_ID); final String starredSessionTitle = mCursor.getString(BlocksQuery.STARRED_SESSION_TITLE); rv.setTextViewText(R.id.block_title, starredSessionTitle); rv.setTextViewText(R.id.block_subtitle, res.getString(R.string.keynote_room)); rv.setTextColor( R.id.block_title, canViewStream ? res.getColor(R.color.body_text_1) : res.getColor(R.color.body_text_disabled)); rv.setTextColor( R.id.block_subtitle, canViewStream ? res.getColor(R.color.body_text_2) : res.getColor(R.color.body_text_disabled)); rv.setViewVisibility(R.id.extra_button, View.GONE); rv.setOnClickFillInIntent(R.id.list_item_middle_container, new Intent()); } else { rv.setTextViewText(R.id.block_title, blockTitle); rv.setTextColor(R.id.block_title, res.getColor(R.color.body_text_disabled)); rv.setTextViewText(R.id.block_subtitle, blockMeta); rv.setTextColor(R.id.block_subtitle, res.getColor(R.color.body_text_disabled)); rv.setViewVisibility(R.id.extra_button, View.GONE); mBuffer.setLength(0); rv.setTextViewText( R.id.block_endtime, DateUtils.formatDateRange( mContext, mFormatter, blockEnd, blockEnd, DateUtils.FORMAT_SHOW_TIME, PrefUtils.getDisplayTimeZone(mContext).getID()) .toString()); rv.setOnClickFillInIntent(R.id.list_item_middle_container, new Intent()); } mBuffer.setLength(0); rv.setTextViewText( R.id.block_time, DateUtils.formatDateRange( mContext, mFormatter, blockStart, blockStart, DateUtils.FORMAT_SHOW_TIME, PrefUtils.getDisplayTimeZone(mContext).getID()) .toString()); } return rv; }
@Override public RemoteViews getViewAt(int position) { if (mCurrentFolder == null) { Log.w(TAG, "No current folder data available."); return null; } BookmarkNode bookmark = getBookmarkForPosition(position); if (bookmark == null) { Log.w(TAG, "Couldn't get bookmark for position " + position); return null; } if (bookmark == mCurrentFolder && bookmark.parent() == null) { Log.w(TAG, "Invalid bookmark data: loop detected."); return null; } String title = bookmark.name(); String url = bookmark.url(); long id = (bookmark == mCurrentFolder) ? bookmark.parent().id() : bookmark.id(); // Two layouts are needed because RemoteView does not supporting changing the scale type // of an ImageView: boomarks crop their thumbnails, while folders stretch their icon. RemoteViews views = !bookmark.isUrl() ? new RemoteViews( mContext.getPackageName(), R.layout.bookmark_thumbnail_widget_item_folder) : new RemoteViews(mContext.getPackageName(), R.layout.bookmark_thumbnail_widget_item); // Set the title of the bookmark. Use the url as a backup. views.setTextViewText(R.id.label, TextUtils.isEmpty(title) ? url : title); if (!bookmark.isUrl()) { int thumbId = (bookmark == mCurrentFolder) ? R.drawable.thumb_bookmark_widget_folder_back_holo : R.drawable.thumb_bookmark_widget_folder_holo; views.setImageViewResource(R.id.thumb, thumbId); views.setImageViewResource(R.id.favicon, R.drawable.ic_bookmark_widget_bookmark_holo_dark); } else { // RemoteViews require a valid bitmap config. Options options = new Options(); options.inPreferredConfig = Config.ARGB_8888; byte[] favicon = bookmark.favicon(); if (favicon != null && favicon.length > 0) { views.setImageViewBitmap( R.id.favicon, BitmapFactory.decodeByteArray(favicon, 0, favicon.length, options)); } else { views.setImageViewResource(R.id.favicon, org.chromium.chrome.R.drawable.globe_favicon); } byte[] thumbnail = bookmark.thumbnail(); if (thumbnail != null && thumbnail.length > 0) { views.setImageViewBitmap( R.id.thumb, BitmapFactory.decodeByteArray(thumbnail, 0, thumbnail.length, options)); } else { views.setImageViewResource(R.id.thumb, R.drawable.browser_thumbnail); } } Intent fillIn; if (!bookmark.isUrl()) { fillIn = new Intent(getChangeFolderAction(mContext)) .putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, mWidgetId) .putExtra(BookmarkColumns._ID, id); } else { fillIn = new Intent(Intent.ACTION_VIEW); if (!TextUtils.isEmpty(url)) { fillIn = fillIn.addCategory(Intent.CATEGORY_BROWSABLE).setData(Uri.parse(url)); } else { fillIn = fillIn.addCategory(Intent.CATEGORY_LAUNCHER); } } views.setOnClickFillInIntent(R.id.list_item, fillIn); return views; }