use of cx.ring.tv.cards.contactrequests.ContactRequestCardPresenter in project ring-client-android by savoirfairelinux.
the class CardPresenterSelector method getPresenter.
@Override
public Presenter getPresenter(Object item) {
if (!(item instanceof Card))
throw new RuntimeException(String.format("The PresenterSelector only supports data items of type '%s'", Card.class.getName()));
Card card = (Card) item;
Presenter presenter = presenters.get(card.getType());
if (presenter == null) {
switch(card.getType()) {
case ABOUT_VERSION:
case ABOUT_CONTRIBUTOR:
case ABOUT_LICENCES:
case ACCOUNT_ADD_DEVICE:
case ACCOUNT_EDIT_PROFILE:
case ACCOUNT_SETTINGS:
presenter = new IconCardPresenter(mContext);
break;
case SEARCH_RESULT:
presenter = new ContactCardPresenter(mContext, R.style.SearchCardTheme);
break;
case CONTACT:
presenter = new ContactCardPresenter(mContext, R.style.ContactCardTheme);
break;
case CONTACT_ONLINE:
presenter = new ContactCardPresenter(mContext, R.style.ContactCardOnlineTheme);
break;
case CONTACT_WITH_USERNAME:
presenter = new ContactCardPresenter(mContext, R.style.ContactCompleteCardTheme);
break;
case CONTACT_WITH_USERNAME_ONLINE:
presenter = new ContactCardPresenter(mContext, R.style.ContactCompleteCardOnlineTheme);
break;
case CONTACT_REQUEST:
presenter = new ContactRequestCardPresenter(mContext, R.style.ContactCardTheme);
break;
case CONTACT_REQUEST_WITH_USERNAME:
presenter = new ContactRequestCardPresenter(mContext, R.style.ContactCompleteCardTheme);
break;
default:
throw new InvalidParameterException("Uncatched card type");
}
}
presenters.put(card.getType(), presenter);
return presenter;
}
Aggregations