package com.marshalchen.common.uimodule.cardsSwiped.view;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.marshalchen.common.uimodule.R;
import com.marshalchen.common.uimodule.cardsSwiped.model.CardModel;
public final class SimpleCardStackAdapter extends CardStackAdapter {
public SimpleCardStackAdapter(Context mContext) {
super(mContext);
}
@Override
public View getCardView(int position, CardModel model, View convertView, ViewGroup parent) {
if(convertView == null) {
LayoutInflater inflater = LayoutInflater.from(getContext());
convertView = inflater.inflate(R.layout.card_swiped_std_card_inner, parent, false);
assert convertView != null;
}
((ImageView) convertView.findViewById(R.id.image)).setImageDrawable(model.getCardImageDrawable());
((TextView) convertView.findViewById(R.id.title)).setText(model.getTitle());
((TextView) convertView.findViewById(R.id.description)).setText(model.getDescription());
return convertView;
}
}