當前位置: 首頁>>代碼示例>>Java>>正文


Java Presenter類代碼示例

本文整理匯總了Java中android.support.v17.leanback.widget.Presenter的典型用法代碼示例。如果您正苦於以下問題:Java Presenter類的具體用法?Java Presenter怎麽用?Java Presenter使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Presenter類屬於android.support.v17.leanback.widget包,在下文中一共展示了Presenter類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setupUIElements

import android.support.v17.leanback.widget.Presenter; //導入依賴的package包/類
private void setupUIElements() {
    setBadgeDrawable(
            getActivity().getResources().getDrawable(R.drawable.nejcz, null));
    setTitle(getString(R.string.browse_title)); // Badge, when set, takes precedent over title
    setHeadersState(HEADERS_ENABLED);
    setHeadersTransitionOnBackEnabled(true);

    // Set fastLane (or headers) background color
    setBrandColor(ContextCompat.getColor(getActivity(), R.color.fastlane_background));

    // Set search icon color.
    setSearchAffordanceColor(ContextCompat.getColor(getActivity(), R.color.search_opaque));

    setHeaderPresenterSelector(new PresenterSelector() {
        @Override
        public Presenter getPresenter(Object o) {
            return new IconHeaderItemPresenter();
        }
    });
}
 
開發者ID:nejtv,項目名稱:androidtv-sample,代碼行數:21,代碼來源:MainFragment.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:bassaer,項目名稱:HelloTV,代碼行數:18,代碼來源:CardPresenter.java

示例3: 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 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

示例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 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

示例5: onBindViewHolder

import android.support.v17.leanback.widget.Presenter; //導入依賴的package包/類
@Override
public void onBindViewHolder(Presenter.ViewHolder viewHolder, Object item) {
	HeaderItem headerItem = ((ListRow) item).getHeaderItem();
	View view = viewHolder.view;
	ImageView headerIcon = (ImageView) view.findViewById(R.id.header_icon);
	TextView headerLabel = (TextView) view.findViewById(R.id.header_label);

	Resources resources = view.getContext().getResources();
	String streamingPrefix = resources.getString(R.string.streaming_prefix);
	if (headerItem.getName().startsWith(streamingPrefix)) {
		Drawable camIcon = resources.getDrawable(R.drawable.ic_videocam_white_24dp);
		headerIcon.setImageDrawable(camIcon);
		((ListRow) item).setHeaderItem(new HeaderItem(headerItem.getName()
				.substring(streamingPrefix.length())));
	} else {
		Drawable movieIcon = resources.getDrawable(R.drawable.ic_local_movies_white_24dp);
		headerIcon.setImageDrawable(movieIcon);
		headerLabel.setText(headerItem.getName());
	}
}
 
開發者ID:NiciDieNase,項目名稱:chaosflix-leanback,代碼行數:21,代碼來源:HeaderItemPresenter.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) {

    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

示例7: 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(), 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

示例8: onBindViewHolder

import android.support.v17.leanback.widget.Presenter; //導入依賴的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

示例9: 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(), 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);
    } else {
        Toast.makeText(getActivity(), ((String) item), Toast.LENGTH_SHORT).show();
    }
}
 
開發者ID:nejtv,項目名稱:androidtv-sample,代碼行數:19,代碼來源:SearchFragment.java

示例10: 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(), 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,代碼行數:18,代碼來源:VerticalGridFragment.java

示例11: getPresenter

import android.support.v17.leanback.widget.Presenter; //導入依賴的package包/類
@Override
public Presenter getPresenter(Object o) {
	if (o instanceof Movie) {
		if (((Movie) o).getCategory().equals(MOVIE_CATEGORY[0])) {
			return new IconCardPresenter();
		} else if (((Movie) o).getCategory().equals(MOVIE_CATEGORY[1])) {
			return new LoadingCardPresenter();
		} else if (((Movie) o).getCategory().equals(MOVIE_CATEGORY[2])) {
			return new OverlayCardPresenter();
		} else {
			return new ProcessCardPresenter();
		}
	} else {
		return new CardPresenter();
	}
}
 
開發者ID:fasteque,項目名稱:leanback-extensions,代碼行數:17,代碼來源:CardPresenterSelector.java

示例12: 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:fasteque,項目名稱:leanback-extensions,代碼行數:18,代碼來源:CardPresenter.java

示例13: onItemClicked

import android.support.v17.leanback.widget.Presenter; //導入依賴的package包/類
@Override
public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item,
        RowPresenter.ViewHolder rowViewHolder, Row row) {
    if (isAdded()) {
        if (item instanceof Clip) {
            Clip clip = (Clip) item;
            Intent intent = new Intent(getActivity(), PlaybackActivity.class);
            intent.putExtra(PlaybackActivity.EXTRA_CLIP, clip);
            startActivity(intent);
            final long programId = clip.getProgramId();
            if (programId != 0) {
                // This clip is published as a program. Increment the view count for the
                // program to demonstrate updating.
                new SetViewCountInBackground(programId, clip.incrementViewCount());
            }
        }
    }
}
 
開發者ID:googlesamples,項目名稱:leanback-homescreen-channels,代碼行數:19,代碼來源:MainFragment.java

示例14: onBindViewHolder

import android.support.v17.leanback.widget.Presenter; //導入依賴的package包/類
@Override
public void onBindViewHolder(Presenter.ViewHolder viewHolder, Object item) {
    Clip clip = (Clip) item;
    if (clip.getCardImageUrl() != null) {
        ImageCardView cardView = (ImageCardView) viewHolder.view;
        Resources resources = cardView.getContext().getResources();
        cardView.setTitleText(clip.getTitle());
        cardView.setContentText(clip.getDescription());
        float widthMultiplier = getWidthMultplier(clip.getAspectRatio());
        int cardWidth = Math.round(resources.getDimensionPixelSize(R.dimen.card_width)
                * widthMultiplier);
        int cardHeight = resources.getDimensionPixelSize(R.dimen.card_height);
        cardView.setMainImageDimensions(cardWidth, cardHeight);
        Glide.with(viewHolder.view.getContext())
                .load(clip.getCardImageUrl())
                .into(cardView.getMainImageView());
    }
}
 
開發者ID:googlesamples,項目名稱:leanback-homescreen-channels,代碼行數:19,代碼來源:CardPresenter.java

示例15: onBindViewHolder

import android.support.v17.leanback.widget.Presenter; //導入依賴的package包/類
@Override
public void onBindViewHolder(Presenter.ViewHolder viewHolder, Object item) {
    final Playlist playlist = (Playlist) item;
    AddChannelViewHolder addChannelViewHolder = (AddChannelViewHolder) viewHolder;
    String descriptionText = String.format(mDescriptionFormat, playlist.getName());
    addChannelViewHolder.mDescription.setText(descriptionText);
    if (addChannelViewHolder.mOnButtonClickedListener != null) {
        addChannelViewHolder.mButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (mOnButtonClickedListener != null) {
                    mOnButtonClickedListener.onButtonClicked(playlist);
                }
            }
        });
    }
}
 
開發者ID:googlesamples,項目名稱:leanback-homescreen-channels,代碼行數:18,代碼來源:AddChannelPresenter.java


注:本文中的android.support.v17.leanback.widget.Presenter類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。