/** * 构造不带时间的新闻 * * @param storiesEntity 消息实体类 * @param holder View控件 */ public void bindSimpleItem( LatestNewsEntity.StoriesEntity storiesEntity, RecyclerView.ViewHolder holder) { ((SimpleItemHolder) holder).getTextView_title().setText(storiesEntity.getTitle()); ((SimpleItemHolder) holder).itemView.setTag(storiesEntity.getId()); ((SimpleItemHolder) holder).getImageView_image().setImageResource(R.drawable.image_start); if (lruCache.get(storiesEntity.getImages().get(0)) != null) { ((SimpleItemHolder) holder) .getImageView_image() .setImageBitmap(lruCache.get(storiesEntity.getImages().get(0))); } else if (aCache.getAsBitmap(storiesEntity.getImages().get(0)) != null) { ((SimpleItemHolder) holder) .getImageView_image() .setImageBitmap(aCache.getAsBitmap(storiesEntity.getImages().get(0))); } else { new DownloadImageTask(((SimpleItemHolder) holder).getImageView_image()) .execute(storiesEntity.getImages().get(0)); } }
/** * 构建带时间的新闻 * * @param storiesEntity 消息实体类 * @param holder View控件 */ public void bingGroupItem( LatestNewsEntity.StoriesEntity storiesEntity, RecyclerView.ViewHolder holder) { ((GroupItemHolder) holder).getTextView_time().setText(storiesEntity.getDate()); bindSimpleItem(storiesEntity, holder); ((GroupItemHolder) holder).itemView.setTag(storiesEntity.getId()); }