update CardPresenter to handle Strings

This commit is contained in:
Felix 2017-04-21 01:17:23 +02:00
parent 78a75c7a1d
commit cc53340c8a

View file

@ -86,8 +86,7 @@ public class CardPresenter extends Presenter {
.error(mDefaultCardImage) .error(mDefaultCardImage)
.into(cardView.getMainImageView()); .into(cardView.getMainImageView());
} }
} } else if (item instanceof Event) {
if (item instanceof Event) {
cardView.setMainImageDimensions(CARD_WIDTH, CARD_HEIGHT_16); cardView.setMainImageDimensions(CARD_WIDTH, CARD_HEIGHT_16);
Event event = (Event) item; Event event = (Event) item;
cardView.setTitleText(event.getTitle()); cardView.setTitleText(event.getTitle());
@ -100,15 +99,13 @@ public class CardPresenter extends Presenter {
.error(mDefaultCardImage) .error(mDefaultCardImage)
.into(cardView.getMainImageView()); .into(cardView.getMainImageView());
} }
} } else if (item instanceof LiveConference) {
if (item instanceof LiveConference) {
cardView.setMainImageDimensions(CARD_WIDTH, CARD_HEIGHT_4); cardView.setMainImageDimensions(CARD_WIDTH, CARD_HEIGHT_4);
LiveConference con = (LiveConference) item; LiveConference con = (LiveConference) item;
cardView.setTitleText(con.getConference()); cardView.setTitleText(con.getConference());
cardView.setMainImage(mDefaultCardImage); cardView.setMainImage(mDefaultCardImage);
cardView.setContentText(con.getDescription()); cardView.setContentText(con.getDescription());
} } else if (item instanceof Room) {
if (item instanceof Room) {
cardView.setMainImageDimensions(CARD_WIDTH, CARD_HEIGHT_16); cardView.setMainImageDimensions(CARD_WIDTH, CARD_HEIGHT_16);
Room room = (Room) item; Room room = (Room) item;
cardView.setTitleText(room.getDisplay()); cardView.setTitleText(room.getDisplay());
@ -120,7 +117,14 @@ public class CardPresenter extends Presenter {
.error(mDefaultCardImage) .error(mDefaultCardImage)
.into(cardView.getMainImageView()); .into(cardView.getMainImageView());
} }
} else if(item instanceof String) {
cardView.setMainImageDimensions(CARD_WIDTH, CARD_HEIGHT_4);
cardView.setTitleText((String) item);
Glide.with(viewHolder.view.getContext())
.load(R.drawable.icon)
.into(cardView.getMainImageView());
} }
} }
@Override @Override