本文整理匯總了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;
}