Search in sources :

Example 1 with SportCardModel

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);
            }
        }
    });
}
Also used : SportCardModel(com.cleveroad.testrecycler.models.SportCardModel) CardView(android.support.v7.widget.CardView) CardView(android.support.v7.widget.CardView) ImageView(android.widget.ImageView) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) View(android.view.View)

Aggregations

CardView (android.support.v7.widget.CardView)1 RecyclerView (android.support.v7.widget.RecyclerView)1 View (android.view.View)1 ImageView (android.widget.ImageView)1 TextView (android.widget.TextView)1 SportCardModel (com.cleveroad.testrecycler.models.SportCardModel)1