use of com.cleveroad.testrecycler.models.SportCardModel in project FanLayoutManager by Cleveroad.
the class SportCardsAdapter method onBindViewHolder.
@Override
public void onBindViewHolder(final SportCardViewHolder holder, int position) {
SportCardModel item = mItems.get(position);
holder.tvSportTitle.setText(item.getSportTitle());
holder.tvSportSubtitle.setText(item.getSportSubtitle());
holder.tvSportRound.setText(item.getSportRound());
holder.ivSportPreview.setImageResource(item.getImageResId());
holder.tvTime.setText(item.getTime());
holder.tvDayPart.setText(item.getDayPart());
((CardView) holder.itemView).setCardBackgroundColor(ContextCompat.getColor(mContext, item.getBackgroundColorResId()));
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
holder.ivSportPreview.setTransitionName("shared" + String.valueOf(position));
}
holder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (mOnItemClickListener != null) {
mOnItemClickListener.onItemClicked(holder.getAdapterPosition(), holder.ivSportPreview);
}
}
});
}
Aggregations