public BaseRowItem( int index, BaseItemDto item, boolean preferParentThumb, boolean staticHeight, SelectAction selectAction) { this.index = index; this.baseItem = item; type = item.getType().equals("Program") ? ItemType.LiveTvProgram : item.getType().equals("Recording") ? ItemType.LiveTvRecording : ItemType.BaseItem; this.preferParentThumb = preferParentThumb; this.staticHeight = staticHeight; this.selectAction = selectAction; }
@Override public void onResponse(BaseItemDto item) { if (item == null) return; Intent intent; if (item.getType().equalsIgnoreCase("musicartist")) { intent = new Intent(SearchResultsActivity.this, ArtistActivity.class); intent.putExtra("ArtistId", item.getId()); } else if (item.getType().equalsIgnoreCase("musicalbum")) { intent = new Intent(SearchResultsActivity.this, MusicAlbumActivity.class); intent.putExtra("AlbumId", item.getId()); } else { // It's a song MainApplication.getInstance() .API .GetItemAsync( item.getParentId(), MainApplication.getInstance().API.getCurrentUserId(), getAlbumResponse); return; } startActivity(intent); SearchResultsActivity.this.finish(); }
public Drawable getBadgeImage() { switch (type) { case BaseItem: if (baseItem.getType().equals("Movie") && baseItem.getCriticRating() != null) { return baseItem.getCriticRating() > 59 ? TvApp.getApplication().getDrawableCompat(R.drawable.fresh) : TvApp.getApplication().getDrawableCompat(R.drawable.rotten); } break; case Person: break; case Server: break; case User: if (user.getHasPassword()) { return TvApp.getApplication().getDrawableCompat(R.drawable.lock); } break; case Chapter: break; } return TvApp.getApplication().getDrawableCompat(R.drawable.blank10x10); }
public String getType() { switch (type) { case BaseItem: case LiveTvRecording: case LiveTvProgram: return baseItem.getType(); case Person: return person.getType(); case Server: break; case User: break; case Chapter: break; case SearchHint: return searchHint.getType(); case LiveTvChannel: return channelInfo.getType(); case GridButton: return "GridButton"; } return ""; }