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


Java ImageCardView类代码示例

本文整理汇总了Java中android.support.v17.leanback.widget.ImageCardView的典型用法代码示例。如果您正苦于以下问题:Java ImageCardView类的具体用法?Java ImageCardView怎么用?Java ImageCardView使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ImageCardView类属于android.support.v17.leanback.widget包,在下文中一共展示了ImageCardView类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onBindViewHolder

import android.support.v17.leanback.widget.ImageCardView; //导入依赖的package包/类
@Override
public void onBindViewHolder(ViewHolder viewHolder, Object item) {
    TvShow tvShow = (TvShow) item;
    ImageCardView cardView = (ImageCardView) viewHolder.view;
    ((ImageCardView) viewHolder.view).setTitleText(tvShow.getTitle());

    // Set card size from dimension resources.
    Resources res = cardView.getResources();
    int width = res.getDimensionPixelSize(R.dimen.card_width);
    int height = res.getDimensionPixelSize(R.dimen.card_height);
    cardView.setMainImageDimensions(width, height);

    Glide.with(cardView.getContext())
            .load(tvShow.getImage())
            .crossFade()
            .placeholder(R.color.color_primary)
            .error(R.color.color_primary)
            .into(cardView.getMainImageView());
}
 
开发者ID:CrazyDude1994,项目名称:lostfilm-android-client,代码行数:20,代码来源:TvShowPresenter.java

示例2: onCreateViewHolder

import android.support.v17.leanback.widget.ImageCardView; //导入依赖的package包/类
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent) {
    Log.d(TAG, "onCreateViewHolder");

    sDefaultBackgroundColor = parent.getResources().getColor(R.color.default_background);
    sSelectedBackgroundColor = parent.getResources().getColor(R.color.selected_background);
    mDefaultCardImage = parent.getResources().getDrawable(R.drawable.movie);

    ImageCardView cardView = new ImageCardView(parent.getContext()) {
        @Override
        public void setSelected(boolean selected) {
            updateCardBackgroundColor(this, selected);
            super.setSelected(selected);
        }
    };

    cardView.setFocusable(true);
    cardView.setFocusableInTouchMode(true);
    updateCardBackgroundColor(cardView, false);
    return new ViewHolder(cardView);
}
 
开发者ID:bassaer,项目名称:HelloTV,代码行数:22,代码来源:CardPresenter.java

示例3: onBindViewHolder

import android.support.v17.leanback.widget.ImageCardView; //导入依赖的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:bassaer,项目名称:HelloTV,代码行数:18,代码来源:CardPresenter.java

示例4: onItemClicked

import android.support.v17.leanback.widget.ImageCardView; //导入依赖的package包/类
@Override
public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item,
                          RowPresenter.ViewHolder rowViewHolder, Row row) {

    if (item instanceof Movie) {
        Movie movie = (Movie) item;
        Log.d(TAG, "Item: " + item.toString());
        Intent intent = new Intent(getActivity(), DetailsActivity.class);
        intent.putExtra(getResources().getString(R.string.movie), mSelectedMovie);
        intent.putExtra(getResources().getString(R.string.should_start), true);
        startActivity(intent);


        Bundle bundle = ActivityOptionsCompat.makeSceneTransitionAnimation(
                getActivity(),
                ((ImageCardView) itemViewHolder.view).getMainImageView(),
                DetailsActivity.SHARED_ELEMENT_NAME).toBundle();
        getActivity().startActivity(intent, bundle);
    }
}
 
开发者ID:bassaer,项目名称:HelloTV,代码行数:21,代码来源:VideoDetailsFragment.java

示例5: onBindViewHolder

import android.support.v17.leanback.widget.ImageCardView; //导入依赖的package包/类
@Override
public void onBindViewHolder(ViewHolder viewHolder, Object item) {
    Episode episode = (Episode) item;
    ImageCardView cardView = (ImageCardView) viewHolder.view;
    ((ImageCardView) viewHolder.view).setTitleText(episode.getName());

    // Set card size from dimension resources.
    Resources res = cardView.getResources();
    int width = res.getDimensionPixelSize(R.dimen.card_width);
    int height = res.getDimensionPixelSize(R.dimen.card_height);
    cardView.setMainImageDimensions(width, height);

    Glide.with(cardView.getContext())
            .load(episode.providePosterURL())
            .error(R.color.color_primary)
            .placeholder(R.color.color_primary)
            .crossFade()
            .into(cardView.getMainImageView());
}
 
开发者ID:CrazyDude1994,项目名称:lostfilm-android-client,代码行数:20,代码来源:EpisodePresenter.java

示例6: onCreateViewHolder

import android.support.v17.leanback.widget.ImageCardView; //导入依赖的package包/类
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent) {
    Log.d(TAG, "onCreateViewHolder");

    sDefaultBackgroundColor = parent.getResources().getColor(R.color.default_background);
    sSelectedBackgroundColor = parent.getResources().getColor(R.color.selected_background);
    /*
     * This template uses a default image in res/drawable, but the general case for Android TV
     * will require your resources in xhdpi. For more information, see
     * https://developer.android.com/training/tv/start/layouts.html#density-resources
     */
    mDefaultCardImage = parent.getResources().getDrawable(R.drawable.movie);

    ImageCardView cardView = new ImageCardView(parent.getContext()) {
        @Override
        public void setSelected(boolean selected) {
            updateCardBackgroundColor(this, selected);
            super.setSelected(selected);
        }
    };

    cardView.setFocusable(true);
    cardView.setFocusableInTouchMode(true);
    updateCardBackgroundColor(cardView, false);
    return new ViewHolder(cardView);
}
 
开发者ID:alphater,项目名称:garras,代码行数:27,代码来源:CardPresenter.java

示例7: onItemClicked

import android.support.v17.leanback.widget.ImageCardView; //导入依赖的package包/类
@Override
public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item,
                          RowPresenter.ViewHolder rowViewHolder, Row row) {

    if (item instanceof Movie) {
        Log.d(TAG, "Item: " + item.toString());
        Intent intent = new Intent(getActivity(), DetailsActivity.class);
        intent.putExtra(getResources().getString(R.string.movie), mSelectedMovie);

        Bundle bundle = ActivityOptionsCompat.makeSceneTransitionAnimation(
                getActivity(),
                ((ImageCardView) itemViewHolder.view).getMainImageView(),
                DetailsActivity.SHARED_ELEMENT_NAME).toBundle();
        getActivity().startActivity(intent, bundle);
    }
}
 
开发者ID:alphater,项目名称:garras,代码行数:17,代码来源:VideoDetailsFragment.java

示例8: onCreateViewHolder

import android.support.v17.leanback.widget.ImageCardView; //导入依赖的package包/类
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent) {
	sDefaultBackgroundColor = parent.getResources().getColor(R.color.default_background);
	sSelectedBackgroundColor = parent.getResources().getColor(R.color.selected_background);
	mDefaultCardImage = parent.getResources().getDrawable(R.drawable.default_background);

	ImageCardView cardView = new ImageCardView(parent.getContext()) {
		@Override
		public void setSelected(boolean selected) {
			updateCardBackgroundColor(this, selected);
			super.setSelected(selected);
		}
	};

	cardView.setFocusable(true);
	cardView.setFocusableInTouchMode(true);
	updateCardBackgroundColor(cardView, false);
	return new ViewHolder(cardView);
}
 
开发者ID:NiciDieNase,项目名称:chaosflix-leanback,代码行数:20,代码来源:CardPresenter.java

示例9: onCreateViewHolder

import android.support.v17.leanback.widget.ImageCardView; //导入依赖的package包/类
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent) {
    Log.d(TAG, "onCreateViewHolder");

    sDefaultBackgroundColor = parent.getResources().getColor(R.color.default_background);
    sSelectedBackgroundColor = parent.getResources().getColor(R.color.detail_background);

    ImageCardView cardView = new ImageCardView(parent.getContext()) {
        @Override
        public void setSelected(boolean selected) {
            updateCardBackgroundColor(this, selected);
            super.setSelected(selected);
        }
    };

    cardView.setFocusable(true);
    cardView.setFocusableInTouchMode(true);
    updateCardBackgroundColor(cardView, false);
    return new ViewHolder(cardView);
}
 
开发者ID:TAnsz,项目名称:MyTvLauncher,代码行数:21,代码来源:CardPresenter.java

示例10: onCreateViewHolder

import android.support.v17.leanback.widget.ImageCardView; //导入依赖的package包/类
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent) {
    Log.d(TAG, "onCreateViewHolder");

    sDefaultBackgroundColor = parent.getResources().getColor(R.color.default_background);
    sSelectedBackgroundColor = parent.getResources().getColor(R.color.detail_background);

    ImageCardView cardView = new ImageCardView(parent.getContext()) {
        @Override
        public void setSelected(boolean selected) {
            updateCardBackgroundColor(this, selected);
            super.setSelected(selected);
        }
    };

    cardView.setFocusable(true);
    cardView.setFocusableInTouchMode(true);
    updateCardBackgroundColor(cardView, false);
    TextView title = (TextView) cardView.findViewById(R.id.title_text);
    title.setTextSize(TypedValue.COMPLEX_UNIT_SP, CARD_HEIGHT / 9);
    return new ViewHolder(cardView);
}
 
开发者ID:TAnsz,项目名称:MyTvLauncher,代码行数:23,代码来源:FunctionCardPresenter.java

示例11: onCreateViewHolder

import android.support.v17.leanback.widget.ImageCardView; //导入依赖的package包/类
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent) {
    Log.d(TAG, "onCreateViewHolder");

    sDefaultBackgroundColor = parent.getResources().getColor(R.color.default_background);
    sSelectedBackgroundColor = parent.getResources().getColor(R.color.detail_background);

    ImageCardView cardView = new ImageCardView(parent.getContext()) {
        @Override
        public void setSelected(boolean selected) {
            updateCardBackgroundColor(this, selected);
            super.setSelected(selected);
        }
    };

    cardView.setFocusable(true);
    cardView.setFocusableInTouchMode(true);
    TextView title = (TextView) cardView.findViewById(R.id.title_text);
    title.setTextSize(TypedValue.COMPLEX_UNIT_SP, mHeight / 9);
    updateCardBackgroundColor(cardView, false);
    return new ViewHolder(cardView);
}
 
开发者ID:TAnsz,项目名称:MyTvLauncher,代码行数:23,代码来源:AppCardPresenter.java

示例12: onItemClicked

import android.support.v17.leanback.widget.ImageCardView; //导入依赖的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

示例13: onItemClicked

import android.support.v17.leanback.widget.ImageCardView; //导入依赖的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(), VideoDetailsActivity.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,代码来源:VideoDetailsFragment.java

示例14: onCreateViewHolder

import android.support.v17.leanback.widget.ImageCardView; //导入依赖的package包/类
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent) {
    mDefaultBackgroundColor =
        ContextCompat.getColor(parent.getContext(), R.color.default_background);
    mSelectedBackgroundColor =
            ContextCompat.getColor(parent.getContext(), R.color.selected_background);
    mDefaultCardImage = parent.getResources().getDrawable(R.drawable.movie, null);

    ImageCardView cardView = new ImageCardView(parent.getContext()) {
        @Override
        public void setSelected(boolean selected) {
            updateCardBackgroundColor(this, selected);
            super.setSelected(selected);
        }
    };

    cardView.setFocusable(true);
    cardView.setFocusableInTouchMode(true);
    updateCardBackgroundColor(cardView, false);
    return new ViewHolder(cardView);
}
 
开发者ID:nejtv,项目名称:androidtv-sample,代码行数:22,代码来源:CardPresenter.java

示例15: onBindViewHolder

import android.support.v17.leanback.widget.ImageCardView; //导入依赖的package包/类
@Override
public void onBindViewHolder(Presenter.ViewHolder viewHolder, Object item) {
    Video video = (Video) item;

    ImageCardView cardView = (ImageCardView) viewHolder.view;
    cardView.setTitleText(video.title);
    cardView.setContentText(video.studio);

    if (video.cardImageUrl != null) {
        // Set card size from dimension resources.
        Resources res = cardView.getResources();
        int width = res.getDimensionPixelSize(R.dimen.card_width);
        int height = res.getDimensionPixelSize(R.dimen.card_height);
        cardView.setMainImageDimensions(width, height);

        Glide.with(cardView.getContext())
                .load(video.cardImageUrl)
                .error(mDefaultCardImage)
                .diskCacheStrategy(NONE)
                .into(cardView.getMainImageView());

        //obnovit obrazek
    }
}
 
开发者ID:nejtv,项目名称:androidtv-sample,代码行数:25,代码来源:CardPresenter.java


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