public void setData(NormalItemHolder holder, NewEpisode newEpisode) { holder.title.setText( context .getResources() .getString( R.string.new_episode_title, newEpisode.getEraString(), newEpisode.getTypeString(), newEpisode.getDramaTitle(), newEpisode.getEpisodeTitle(), newEpisode.getAlias())); holder.duration.setText( context.getResources().getString(R.string.new_episode_duration, newEpisode.getDuration())); holder.sc.setText(newEpisode.getSc()); if (newEpisode.isOriginal()) { holder.info.setText(newEpisode.getOriginalString()); } else { holder.info.setText(""); } if (newEpisode.getState() == 1) { holder.title.getPaint().setFakeBoldText(true); holder.title.setTextColor(context.getResources().getColor(R.color.bsTextInfo)); holder.sc.setTextColor(context.getResources().getColor(R.color.bsTextInfo)); holder.card.setBackgroundColor(context.getResources().getColor(R.color.bsColorInfo)); } else { holder.title.getPaint().setFakeBoldText(false); holder.title.setTextColor(context.getResources().getColor(R.color.textPrimary)); holder.sc.setTextColor(context.getResources().getColor(R.color.textPrimary)); holder.card.setBackgroundColor(Color.TRANSPARENT); } }
@Override public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { NewEpisode newEpisode = newEpisodes.get(position); if (holder instanceof GroupItemHolder) { GroupItemHolder groupItemHolder = (GroupItemHolder) holder; groupItemHolder.releaseDate.setText(newEpisode.getReleaseDateString()); setData(groupItemHolder, newEpisode); } else { NormalItemHolder normalItemHolder = (NormalItemHolder) holder; setData(normalItemHolder, newEpisode); } }