public View render(View convertView, final Context context, FeedView feedView) { // Set up the view holder if (convertView == null) { convertView = super.render(convertView, context, feedView); holder = new ViewHolder(); holder.achievementIconView = (ImageView) convertView.findViewById(Rzap.id("achievement_icon")); holder.achievementNameView = (TextView) convertView.findViewById(Rzap.id("achievement_name")); holder.achievementDescriptionView = (TextView) convertView.findViewById(Rzap.id("achievement_description")); holder.achievementNewBadgeView = (ImageView) convertView.findViewById(Rzap.id("new_badge_icon")); ; convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } holder.feedlette = this; holder.achievementIconView.setImageResource(Rzap.drawable("icon_default_badge")); // Fill in the views String iconUrl = achievement.getIconUrl(); if (iconUrl != null && !iconUrl.equals("") && !iconUrl.equals("null")) { if (!downloadingAchievementImage) { downloadingAchievementImage = true; new DownloadImageTask( new DownloadImageListener() { @Override public void onImageDownloaded(Bitmap bitmap) { downloadedAchievementImage = bitmap; if (holder.feedlette == AchievementFeedlette.this) { holder.achievementIconView.setImageBitmap(downloadedAchievementImage); } } }) .execute(iconUrl); } if (downloadedAchievementImage != null) { holder.achievementIconView.setImageBitmap(downloadedAchievementImage); } else { holder.achievementIconView.setImageDrawable(null); } } else { holder.achievementIconView.setImageDrawable(null); } if (achievement.hasJustUnlocked()) { holder.achievementNewBadgeView.setVisibility(View.VISIBLE); } else { holder.achievementNewBadgeView.setVisibility(View.GONE); } if (achievement.hasUnlocked()) { holder.achievementNameView.setTextColor(0xff000000); } else { holder.achievementNameView.setTextColor(0xff999999); } holder.achievementNameView.setText(achievement.getName()); holder.achievementDescriptionView.setText(achievement.getDescription()); return convertView; }
@Override public String toString() { return achievement.getName(); }