當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。