当前位置: 首页>>代码示例>>Java>>正文


Java Presenter.ViewHolder方法代码示例

本文整理汇总了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);
    }
}
 
开发者ID:nejtv,项目名称:androidtv-sample,代码行数:17,代码来源:PlaybackOverlayFragment.java

示例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());
    }
}
 
开发者ID:alphater,项目名称:garras,代码行数:18,代码来源:CardPresenter.java

示例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();
			}

		}
 
开发者ID:NiciDieNase,项目名称:chaosflix,代码行数:15,代码来源:EventsBrowseFragment.java

示例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();
    }
}
 
开发者ID:ad-on-is,项目名称:chilly,代码行数:14,代码来源:SearchFragment.java

示例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());
    }
}
 
开发者ID:googlesamples,项目名称:leanback-assistant,代码行数:12,代码来源:VideoDetailsFragment.java

示例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());
}
 
开发者ID:CrazyDude1994,项目名称:lostfilm-android-client,代码行数:11,代码来源:TvShowFragment.java

示例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);
}
 
开发者ID:archos-sa,项目名称:aos-Video,代码行数:13,代码来源:VideoViewClickedListener.java

示例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);
}
 
开发者ID:archos-sa,项目名称:aos-Video,代码行数:14,代码来源:ScraperImagePresenter.java

示例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);
}
 
开发者ID:NiciDieNase,项目名称:chaosflix,代码行数:8,代码来源:CardPresenter.java

示例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());
}
 
开发者ID:nejtv,项目名称:androidtv-sample,代码行数:14,代码来源:IconHeaderItemPresenter.java

示例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();
    }
}
 
开发者ID:ad-on-is,项目名称:chilly,代码行数:11,代码来源:VerticalGridFragment.java

示例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);
}
 
开发者ID:archos-sa,项目名称:aos-Video,代码行数:8,代码来源:TvshowDetailsDescriptionPresenter.java

示例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);
}
 
开发者ID:archos-sa,项目名称:aos-Video,代码行数:7,代码来源:VideoDetailsDescriptionPresenter.java

示例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);
    }
}
 
开发者ID:archos-sa,项目名称:aos-Video,代码行数:73,代码来源:MainFragment.java

示例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;
}
 
开发者ID:archos-sa,项目名称:aos-Video,代码行数:7,代码来源:ScraperBaseTagsPresenter.java


注:本文中的android.support.v17.leanback.widget.Presenter.ViewHolder方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。