@Test public void testGetCardViewNullViewCheck(){ CardModel cardModel=initializeCardModel(); SimpleCardStackAdapter simpleCardStackAdapter=initializeSimpleCardStackAdapter(); View view=initializeView(); ViewGroup parent=mock(ViewGroup.class); initializeInflater(parent,view); View cardView=simpleCardStackAdapter.getCardView(1, cardModel, null, parent); assertEquals("view instances must be equal", view, cardView); }
@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.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; }
SimpleCardStackAdapter extends CardStackAdapter { @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.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; } }
SimpleCardStackAdapter extends CardStackAdapter { @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.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; } SimpleCardStackAdapter(Context context); }
SimpleCardStackAdapter extends CardStackAdapter { @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.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; } SimpleCardStackAdapter(Context context); @Override View getCardView(int position, CardModel model, View convertView, ViewGroup parent); }
SimpleCardStackAdapter extends CardStackAdapter { @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.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; } SimpleCardStackAdapter(Context context); @Override View getCardView(int position, CardModel model, View convertView, ViewGroup parent);  }