@Override
  public void onBindViewHolder(Presenter.ViewHolder viewHolder, Object item) {
    if (!(item instanceof GridButton)) return;
    GridButton gridItem = (GridButton) item;

    ((ViewHolder) viewHolder).setItem(gridItem);

    // Log.d(TAG, "onBindViewHolder");
    ((ViewHolder) viewHolder).mCardView.setTitleText(gridItem.getText());
    ((ViewHolder) viewHolder).updateCardViewImage(gridItem.getImageIndex());
  }
예제 #2
0
  public String getFullName() {
    switch (type) {
      case BaseItem:
      case LiveTvProgram:
      case LiveTvRecording:
        return Utils.GetFullName(baseItem);
      case Person:
        return person.getName();
      case Chapter:
        return chapterInfo.getName();
      case Server:
        return serverInfo.getName();
      case User:
        return user.getName();
      case LiveTvChannel:
        return channelInfo.getName();
      case GridButton:
        return gridButton.getText();
      case SearchHint:
        return (searchHint.getSeries() != null ? searchHint.getSeries() + " - " : "")
            + searchHint.getName();
    }

    return TvApp.getApplication().getString(R.string.lbl_bracket_unknown);
  }
예제 #3
0
 public String getPrimaryImageUrl(int maxHeight) {
   switch (type) {
     case BaseItem:
     case LiveTvProgram:
     case LiveTvRecording:
       return Utils.getPrimaryImageUrl(
           baseItem, TvApp.getApplication().getApiClient(), true, preferParentThumb, maxHeight);
     case Person:
       return Utils.getPrimaryImageUrl(person, TvApp.getApplication().getApiClient(), maxHeight);
     case User:
       return Utils.getPrimaryImageUrl(user, TvApp.getApplication().getLoginApiClient());
     case Chapter:
       return chapterInfo.getImagePath();
     case LiveTvChannel:
       return Utils.getPrimaryImageUrl(channelInfo, TvApp.getApplication().getApiClient());
     case Server:
       return "android.resource://tv.emby.embyatv/" + R.drawable.server;
     case GridButton:
       return "android.resource://tv.emby.embyatv/" + gridButton.getImageIndex();
     case SearchHint:
       return !Utils.IsEmpty(searchHint.getPrimaryImageTag())
           ? Utils.getImageUrl(
               searchHint.getItemId(),
               ImageType.Primary,
               searchHint.getPrimaryImageTag(),
               TvApp.getApplication().getApiClient())
           : !Utils.IsEmpty(searchHint.getThumbImageItemId())
               ? Utils.getImageUrl(
                   searchHint.getThumbImageItemId(),
                   ImageType.Thumb,
                   searchHint.getThumbImageTag(),
                   TvApp.getApplication().getApiClient())
               : null;
   }
   return null;
 }