本文整理汇总了Java中android.support.v17.leanback.widget.Presenter.ViewHolder方法的典型用法代码示例。如果您正苦于以下问题:Java Presenter.ViewHolder方法的具体用法?Java Presenter.ViewHolder怎么用?Java Presenter.ViewHolder使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.v17.leanback.widget.Presenter
的用法示例。
在下文中一共展示了Presenter.ViewHolder方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onItemClicked
import android.support.v17.leanback.widget.Presenter; //导入方法依赖的package包/类
@Override
public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item,
RowPresenter.ViewHolder rowViewHolder, Row row) {
if (item instanceof Video) {
Video video = (Video) item;
Intent intent = new Intent(getActivity(), PlaybackOverlayActivity.class);
intent.putExtra(VideoDetailsActivity.VIDEO, video);
Bundle bundle = ActivityOptionsCompat.makeSceneTransitionAnimation(
getActivity(),
((ImageCardView) itemViewHolder.view).getMainImageView(),
VideoDetailsActivity.SHARED_ELEMENT_NAME).toBundle();
getActivity().startActivity(intent, bundle);
}
}
示例2: onBindViewHolder
import android.support.v17.leanback.widget.Presenter; //导入方法依赖的package包/类
@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());
}
}
示例3: onItemSelected
import android.support.v17.leanback.widget.Presenter; //导入方法依赖的package包/类
@Override
public void onItemSelected(Presenter.ViewHolder itemViewHolder, Object item,
RowPresenter.ViewHolder rowViewHolder, Row row) {
if (item instanceof Event) {
try {
mBackgroundURI = new URI(((Event) item).getPosterUrl());
} catch (URISyntaxException e) {
e.printStackTrace();
}
// TODO make configurable (enable/disable)
// startBackgroundTimer();
}
}
示例4: onItemClicked
import android.support.v17.leanback.widget.Presenter; //导入方法依赖的package包/类
@Override
public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item,
RowPresenter.ViewHolder rowViewHolder, Row row) {
if (item instanceof Video) {
Video video = (Video) item;
cardView = (ImageCardView) itemViewHolder.view;
new ChillyTasks.ImageLoaderTask(getActivity().getApplicationContext(), this, video).execute();
} else {
Toast.makeText(getActivity(), ((String) item), Toast.LENGTH_SHORT).show();
}
}
示例5: onBindViewHolder
import android.support.v17.leanback.widget.Presenter; //导入方法依赖的package包/类
@Override
public void onBindViewHolder(Presenter.ViewHolder viewHolder, Object item) {
DetailsOverviewRow row = (DetailsOverviewRow) item;
ImageView imageView = ((ImageView) viewHolder.view);
imageView.setImageDrawable(row.getImageDrawable());
if (isBoundToImage((ViewHolder) viewHolder, row)) {
MovieDetailsOverviewLogoPresenter.ViewHolder vh =
(MovieDetailsOverviewLogoPresenter.ViewHolder) viewHolder;
vh.getParentPresenter().notifyOnBindLogo(vh.getParentViewHolder());
}
}
示例6: onItemClicked
import android.support.v17.leanback.widget.Presenter; //导入方法依赖的package包/类
@Override
public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item, RowPresenter.ViewHolder rowViewHolder, Row row) {
Episode episode = (Episode) item;
Intent intent = new Intent(getActivity(), PlayerActivity.class);
intent.putExtra(PlayerActivity.EXTRA_EPISODE_ID, episode.getId());
intent.putExtra(PlayerActivity.EXTRA_SEASON_ID, episode.getSeason().getId());
intent.putExtra(PlayerActivity.EXTRA_TV_SHOW_ID, episode.getSeason().getTvShow().getId());
startActivity(intent, ActivityOptions.makeSceneTransitionAnimation(getActivity()).toBundle());
}
示例7: showTvshowDetails
import android.support.v17.leanback.widget.Presenter; //导入方法依赖的package包/类
public static void showTvshowDetails(Activity activity, Tvshow tvshow, Presenter.ViewHolder itemViewHolder) {
Intent intent = new Intent(activity, TvshowActivity.class);
intent.putExtra(TvshowFragment.EXTRA_TVSHOW, tvshow);
View sourceView = ((ImageCardView) itemViewHolder.view).getMainImageView();
Bundle bundle = ActivityOptionsCompat.makeSceneTransitionAnimation(
activity,
sourceView,
TvshowFragment.SHARED_ELEMENT_NAME).toBundle();
activity.startActivity(intent, bundle);
}
示例8: onBindViewHolder
import android.support.v17.leanback.widget.Presenter; //导入方法依赖的package包/类
@Override
public void onBindViewHolder(Presenter.ViewHolder viewHolder, Object item) {
ViewHolder vh = (ViewHolder)viewHolder;
Context c = vh.view.getContext();
ScraperImage image = (ScraperImage)item;
Picasso.get()
.load(getImageUrl(image))
.resize(getWidth(c), getHeight(c)) // better resize to card size, since backdrop files are pretty large
.centerCrop()
.error(R.drawable.filetype_new_image)
.into(vh.mImageViewTarget);
}
示例9: onUnbindViewHolder
import android.support.v17.leanback.widget.Presenter; //导入方法依赖的package包/类
@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);
}
示例10: onBindViewHolder
import android.support.v17.leanback.widget.Presenter; //导入方法依赖的package包/类
@Override
public void onBindViewHolder(Presenter.ViewHolder viewHolder, Object item) {
HeaderItem headerItem = ((ListRow) item).getHeaderItem();
View rootView = viewHolder.view;
rootView.setFocusable(true);
ImageView iconView = (ImageView) rootView.findViewById(R.id.header_icon);
Drawable icon = rootView.getResources().getDrawable(R.drawable.android_header, null);
iconView.setImageDrawable(icon);
TextView label = (TextView) rootView.findViewById(R.id.header_label);
label.setText(headerItem.getName());
}
示例11: onItemClicked
import android.support.v17.leanback.widget.Presenter; //导入方法依赖的package包/类
@Override
public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item,
RowPresenter.ViewHolder rowViewHolder, Row row) {
if (item instanceof Video) {
Video video = (Video) item;
cardView = (ImageCardView) itemViewHolder.view;
new ChillyTasks.ImageLoaderTask(getActivity().getApplicationContext(), this, video).execute();
}
}
示例12: onViewAttachedToWindow
import android.support.v17.leanback.widget.Presenter; //导入方法依赖的package包/类
@Override
public void onViewAttachedToWindow(Presenter.ViewHolder holder) {
// In case predraw listener was removed in detach, make sure
// we have the proper layout.
ViewHolder vh = (ViewHolder) holder;
super.onViewAttachedToWindow(holder);
}
示例13: onViewDetachedFromWindow
import android.support.v17.leanback.widget.Presenter; //导入方法依赖的package包/类
@Override
public void onViewDetachedFromWindow(Presenter.ViewHolder holder) {
ViewHolder vh = (ViewHolder) holder;
vh.removePreDrawListener();
super.onViewDetachedFromWindow(holder);
}
示例14: onItemClicked
import android.support.v17.leanback.widget.Presenter; //导入方法依赖的package包/类
@Override
public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item, RowPresenter.ViewHolder rowViewHolder, Row row) {
if (item instanceof Box) {
Box box = (Box)item;
switch (box.getBoxId()) {
case ALL_MOVIES:
mActivity.startActivity(new Intent(mActivity, AllMoviesGridActivity.class));
break;
case MOVIES_BY_GENRE:
mActivity.startActivity(new Intent(mActivity, MoviesByGenreActivity.class));
break;
case MOVIES_BY_YEAR:
mActivity.startActivity(new Intent(mActivity, MoviesByYearActivity.class));
break;
case VIDEOS_BY_LISTS:
mActivity.startActivity(new Intent(mActivity, VideosByListActivity.class));
break;
case FOLDERS:
mActivity.startActivity(new Intent(mActivity, LocalListingActivity.class));
break;
case SDCARD:
case USB:
case OTHER:
Intent i = new Intent(mActivity, ExtStorageListingActivity.class);
i.putExtra(ExtStorageListingActivity.MOUNT_POINT, box.getPath());
i.putExtra(ExtStorageListingActivity.STORAGE_NAME, box.getName());
mActivity.startActivity(i);
break;
case NETWORK:
mActivity.startActivity(new Intent(mActivity, NetworkRootActivity.class));
break;
case NON_SCRAPED_VIDEOS:
mActivity.startActivity(new Intent(mActivity, NonScrapedVideosActivity.class));
break;
}
}
else if (item instanceof Icon) {
Icon icon = (Icon)item;
switch (icon.getId()) {
case PREFERENCES:
if (mActivity instanceof MainActivityLeanback) {
((MainActivityLeanback)mActivity).startPreferencesActivity(); // I know this is ugly (and i'm ashamed...)
} else {
throw new IllegalStateException("Sorry developper, this ugly code can work with a MainActivityLeanback only for now!");
}
break;
case PRIVATE_MODE:
if (!PrivateMode.isActive() && PrivateMode.canShowDialog(getActivity())) {
PrivateMode.showDialog(getActivity());
}
PrivateMode.toggle();
updatePrivateMode(icon);
break;
case LEGACY_UI:
new DensityTweak(getActivity())
.temporaryRestoreDefaultDensity();
mActivity.startActivity(new Intent(mActivity, MainActivity.class));
break;
case HELP_FAQ:
Intent intent = new Intent(mActivity, WebViewActivity.class);
intent.setData(Uri.parse(getString(R.string.faq_url)));
mActivity.startActivity(intent);
break;
}
}
else {
super.onItemClicked(itemViewHolder, item, rowViewHolder, row);
}
}
示例15: onCreateViewHolder
import android.support.v17.leanback.widget.Presenter; //导入方法依赖的package包/类
@Override
public Presenter.ViewHolder onCreateViewHolder(ViewGroup parent) {
mContext = parent.getContext();
ViewHolder vh = new ViewHolder(parent.getContext());
return vh;
}