Java Code Examples for android.support.v17.leanback.widget.Presenter#ViewHolder
The following examples show how to use
android.support.v17.leanback.widget.Presenter#ViewHolder .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CardPresenter.java From leanback-extensions with Apache License 2.0 | 6 votes |
@Override public void onBindViewHolder(Presenter.ViewHolder viewHolder, Object item) { Movie movie = (Movie) item; ImageCardView cardView = (ImageCardView) viewHolder.view; Log.d(TAG, "onBindViewHolder"); if (movie.getCardImageUrl() != null) { cardView.setTitleText(movie.getTitle()); cardView.setContentText(movie.getStudio()); cardView.setMainImageDimensions(CARD_WIDTH, CARD_HEIGHT); Glide.with(viewHolder.view.getContext()) .load(movie.getCardImageUrl()) .centerCrop() .error(mDefaultCardImage) .into(cardView.getMainImageView()); } }
Example 2
Source File: OptionsCardPresenter.java From CumulusTV with MIT License | 5 votes |
@Override public void onBindViewHolder(Presenter.ViewHolder viewHolder, Object item) { final Option option = (Option) item; final ImageCardView cardView = (ImageCardView) viewHolder.view; if (DEFAULT_BANNER) { cardView.setMainImage(contextThemeWrapper.getDrawable(R.drawable.c_banner_3_2)); } else { cardView.setMainImage(option.getDrawable()); } cardView.setTitleText(option.getText()); cardView.setMainImageDimensions(CARD_WIDTH, CARD_HEIGHT); cardView.getMainImageView().setScaleType(ImageView.ScaleType.FIT_CENTER); cardView.findViewById(R.id.info_field).setBackgroundColor( ContextCompat.getColor(contextThemeWrapper, R.color.colorPrimaryDark)); }
Example 3
Source File: CardPresenter.java From leanback-homescreen-channels with Apache License 2.0 | 5 votes |
@Override public void onUnbindViewHolder(Presenter.ViewHolder viewHolder) { ImageCardView cardView = (ImageCardView) viewHolder.view; // Remove references to images so that the garbage collector can free up memory cardView.setBadgeImage(null); cardView.setMainImage(null); }
Example 4
Source File: CardPresenter.java From leanback-extensions with Apache License 2.0 | 5 votes |
@Override public void onUnbindViewHolder(Presenter.ViewHolder viewHolder) { Log.d(TAG, "onUnbindViewHolder"); ImageCardView cardView = (ImageCardView) viewHolder.view; // Remove references to images so that the garbage collector can free up memory cardView.setBadgeImage(null); cardView.setMainImage(null); }
Example 5
Source File: DetailViewExampleWithVideoBackgroundFragment.java From leanback-showcase with Apache License 2.0 | 5 votes |
@Override public void onItemSelected(Presenter.ViewHolder itemViewHolder, Object item, RowPresenter.ViewHolder rowViewHolder, Row row) { if (mRowsAdapter.indexOf(row) > 0) { int backgroundColor = getResources().getColor(R.color.detail_view_related_background); getView().setBackgroundColor(backgroundColor); } else { getView().setBackground(null); } }
Example 6
Source File: DetailViewExampleFragment.java From leanback-showcase with Apache License 2.0 | 5 votes |
@Override public void onItemSelected(Presenter.ViewHolder itemViewHolder, Object item, RowPresenter.ViewHolder rowViewHolder, Row row) { if (mRowsAdapter.indexOf(row) > 0) { int backgroundColor = getResources().getColor(R.color.detail_view_related_background); getView().setBackgroundColor(backgroundColor); } else { getView().setBackground(null); } }
Example 7
Source File: LeanbackBrowseFragment.java From android-tv-leanback with Apache License 2.0 | 5 votes |
protected OnItemViewClickedListener getDefaultItemViewClickedListener() { return new OnItemViewClickedListener() { @Override public void onItemClicked(Presenter.ViewHolder viewHolder, Object o, RowPresenter.ViewHolder viewHolder2, Row row) { Intent intent = new Intent(getActivity(), VideoDetailsActivity.class); intent.putExtra(Video.INTENT_EXTRA_VIDEO, (Serializable) o); startActivity(intent); } }; }
Example 8
Source File: MainFragment.java From leanback-assistant with Apache License 2.0 | 5 votes |
@Override public void onItemClicked( Presenter.ViewHolder itemViewHolder, Object item, RowPresenter.ViewHolder rowViewHolder, Row row) { Movie movie = (Movie) item; startActivity(VideoDetailsActivity.createIntent(getContext(), movie)); }
Example 9
Source File: OptionsCardPresenter.java From TvAppRepo with Apache License 2.0 | 5 votes |
@Override public void onBindViewHolder(Presenter.ViewHolder viewHolder, Object item) { final SettingOption option = (SettingOption) item; final ImageCardView cardView = (ImageCardView) viewHolder.view; cardView.setMainImage(option.getDrawable()); cardView.setTitleText(option.getText()); cardView.setMainImageDimensions(CARD_WIDTH, CARD_HEIGHT); cardView.getMainImageView().setScaleType(ImageView.ScaleType.FIT_CENTER); }
Example 10
Source File: CardPresenter.java From android-tv-leanback with Apache License 2.0 | 5 votes |
@Override public void onBindViewHolder(Presenter.ViewHolder viewHolder, Object o) { Video video = (Video) o; ((ViewHolder) viewHolder).mCardView.setTitleText(video.getTitle()); ((ViewHolder) viewHolder).mCardView.setContentText(video.getDescription()); ((ViewHolder) viewHolder).mCardView.setMainImageDimensions(CARD_WIDTH * 2, CARD_HEIGHT * 2); ((ViewHolder) viewHolder).updateCardViewImage(video.getThumbUrl()); }
Example 11
Source File: OksusuRowSupportFragment.java From alltv with MIT License | 5 votes |
@Override public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item, RowPresenter.ViewHolder rowViewHolder, Row row) { if (item instanceof ChannelData) { String authKey = ((ChannelData) item).getAuthkey();; if (authKey == null || authKey.length() < 10) { Utils.showToast(getContext(), getStringById(R.string.nologin_error)); return; } playVideo(mChannels.get(mType).indexOf(item)); } }
Example 12
Source File: FavoriteRowSupportFragment.java From alltv with MIT License | 5 votes |
@Override public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item, RowPresenter.ViewHolder rowViewHolder, Row row) { if (item instanceof ChannelData) { String authKey = ((ChannelData) item).getAuthkey();; if (authKey == null || authKey.length() < 10) { Utils.showToast(getContext(), getStringById(R.string.nologin_error)); return; } playVideo(mChannels.get(mType).indexOf(item)); } }
Example 13
Source File: LeanbackBrowseFragment.java From android-tv-leanback with Apache License 2.0 | 5 votes |
protected OnItemViewSelectedListener getDefaultItemSelectedListener() { return new OnItemViewSelectedListener() { public void onItemSelected(Presenter.ViewHolder itemViewHolder, Object item, RowPresenter.ViewHolder rowViewHolder, Row row) { if (item instanceof Video) { bgHelper.setBackgroundUrl(((Video) item).getThumbUrl()); bgHelper.startBackgroundTimer(); } } }; }
Example 14
Source File: DynamicRowsFragment.java From leanback-showcase with Apache License 2.0 | 5 votes |
@Override public void onItemSelected(Presenter.ViewHolder itemViewHolder, Object item, RowPresenter.ViewHolder rowViewHolder, Row row) { if (item instanceof VideoContent) { mBackgroundURI = ((VideoContent) item).getBackgroundImageURI(); startBackgroundTimer(); } else { /** * make sure the background of other items are removed so the setting icon can be * seen clearly */ mHandler.removeCallbacks(mBackgroudUpdateRunnable); mBackgroundManager.setDrawable(null); } }
Example 15
Source File: CardPresenter.java From TvAppRepo with Apache License 2.0 | 5 votes |
@Override public void onUnbindViewHolder(Presenter.ViewHolder viewHolder) { ImageCardView cardView = (ImageCardView) viewHolder.view; // Remove references to images so that the garbage collector can free up memory cardView.setBadgeImage(null); cardView.setMainImage(null); }
Example 16
Source File: CardPresenter.java From android-tv-leanback with Apache License 2.0 | 5 votes |
@Override public void onBindViewHolder(Presenter.ViewHolder viewHolder, Object o) { Video video = (Video) o; ((ViewHolder) viewHolder).mCardView.setTitleText(video.getTitle()); ((ViewHolder) viewHolder).mCardView.setContentText(video.getDescription()); ((ViewHolder) viewHolder).mCardView.setMainImageDimensions(CARD_WIDTH * 2, CARD_HEIGHT * 2); ((ViewHolder) viewHolder).updateCardViewImage(video.getThumbUrl()); }
Example 17
Source File: SettingsRowPresenter.java From citra_android with GNU General Public License v3.0 | 4 votes |
public void onUnbindViewHolder(Presenter.ViewHolder viewHolder) { // no op }
Example 18
Source File: ImagePresenter.java From TuentiTV with Apache License 2.0 | 4 votes |
@Override public void onViewAttachedToWindow(Presenter.ViewHolder viewHolder) { //Empty }
Example 19
Source File: CardPresenter.java From alltv with MIT License | 4 votes |
@Override public void onBindViewHolder(Presenter.ViewHolder viewHolder, Object item) { ChannelData tvCh = (ChannelData) item; ImageCardView cardView = (ImageCardView) viewHolder.view; //Log.d(TAG, "onBindViewHolder"); if (tvCh.getStillImageUrl() != null) { ArrayList<EPGData> epgData = tvCh.getEPG(); Date date = new Date(); Boolean isAdultContent = false; for(int i=0; i<epgData.size(); i++) { if(date.compareTo(epgData.get(i).getEndTime()) < 0) { tvCh.setProgramName(epgData.get(i).getProgramName()); isAdultContent = epgData.get(i).isAdultContent(); break; } } if(tvCh.getProgramName().equals("") || isAdultContent) cardView.setTitleText(tvCh.getTitle()); else cardView.setTitleText(tvCh.getTitle() + " - " + tvCh.getProgramName()); cardView.setMainImageDimensions(CARD_WIDTH, CARD_HEIGHT); int ret = tvCh.getFavorite(); if(ret == 0) cardView.setBadgeImage(null); else if(ret == 1) cardView.setBadgeImage(cardView.getResources().getDrawable(R.drawable.star_icon, null)); else if(ret == 2) cardView.setBadgeImage(cardView.getResources().getDrawable(R.drawable.wavve_icon_24, null)); else if(ret == 3) cardView.setBadgeImage(cardView.getResources().getDrawable(R.drawable.tving_icon_24, null)); else if(ret == 4) cardView.setBadgeImage(cardView.getResources().getDrawable(R.drawable.oksusu_icon_24, null)); Picasso.get().load(tvCh.getStillImageUrl()) .memoryPolicy(MemoryPolicy.NO_CACHE, MemoryPolicy.NO_STORE) .into(cardView.getMainImageView()); } }
Example 20
Source File: AddChannelPresenter.java From leanback-homescreen-channels with Apache License 2.0 | 2 votes |
@Override public void onUnbindViewHolder(Presenter.ViewHolder viewHolder) { }