Java Code Examples for android.support.v17.leanback.widget.ImageCardView#setMainImageScaleType()

The following examples show how to use android.support.v17.leanback.widget.ImageCardView#setMainImageScaleType() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GameRowPresenter.java    From citra_android with GNU General Public License v3.0 6 votes vote down vote up
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent)
{
  // Create a new view.
  ImageCardView gameCard = new ImageCardView(parent.getContext());

  gameCard.setMainImageAdjustViewBounds(true);
  gameCard.setMainImageDimensions(48, 48);
  gameCard.setMainImageScaleType(ImageView.ScaleType.CENTER_CROP);

  gameCard.setFocusable(true);
  gameCard.setFocusableInTouchMode(true);

  // Use that view to create a ViewHolder.
  return new TvGameViewHolder(gameCard);
}
 
Example 2
Source File: FunctionCardPresenter.java    From AndroidTVLauncher with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onBindViewHolder(ViewHolder viewHolder, Object item) {
    ImageCardView cardView = (ImageCardView) viewHolder.view;
    cardView.setMainImageDimensions(CARD_WIDTH,CARD_HEIGHT);
    FunctionModel functionModel = (FunctionModel) item;
    cardView.setMainImageScaleType(ImageView.ScaleType.CENTER_INSIDE);
    cardView.getMainImageView().setImageResource(functionModel.getIcon());
    cardView.setTitleText(functionModel.getName());
}
 
Example 3
Source File: AppCardPresenter.java    From AndroidTVLauncher with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onBindViewHolder(ViewHolder viewHolder, Object item) {
    ImageCardView cardView = (ImageCardView) viewHolder.view;
    cardView.setMainImageDimensions(CARD_WIDTH,CARD_HEIGHT);
    AppModel appBean = (AppModel) item;
    cardView.setMainImageScaleType(ImageView.ScaleType.CENTER_INSIDE);
    cardView.getMainImageView().setImageDrawable(appBean.getIcon());
    cardView.setTitleText(appBean.getName());
}
 
Example 4
Source File: EpisodePresenter.java    From iview-android-tv with MIT License 5 votes vote down vote up
protected ImageCardView getCardView(Context context) {
    ImageCardView card = new ImageCardView(context);
    card.setFocusable(true);
    card.setFocusableInTouchMode(true);
    card.setMainImageScaleType(ImageView.ScaleType.CENTER_CROP);
    Point size = getCardSize(context);
    card.setMainImageDimensions(size.x, size.y);
    return card;
}