本文整理汇总了Java中android.support.v17.leanback.widget.OnItemViewClickedListener类的典型用法代码示例。如果您正苦于以下问题:Java OnItemViewClickedListener类的具体用法?Java OnItemViewClickedListener怎么用?Java OnItemViewClickedListener使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
OnItemViewClickedListener类属于android.support.v17.leanback.widget包,在下文中一共展示了OnItemViewClickedListener类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getDefaultItemClickedListener
import android.support.v17.leanback.widget.OnItemViewClickedListener; //导入依赖的package包/类
private OnItemViewClickedListener getDefaultItemClickedListener() {
return new OnItemViewClickedListener() {
@Override
public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item,
RowPresenter.ViewHolder rowViewHolder, Row row) {
if (item instanceof Clip) {
Toast.makeText(getActivity(), "** toggle selected **",
Toast.LENGTH_LONG).show();
} else {
Toast.makeText(getActivity(), "** add as playlist **",
Toast.LENGTH_LONG).show();
}
}
};
}
示例2: setupEventListeners
import android.support.v17.leanback.widget.OnItemViewClickedListener; //导入依赖的package包/类
protected void setupEventListeners() {
setOnItemViewClickedListener(new OnItemViewClickedListener() {
@Override
public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item, RowPresenter.ViewHolder rowViewHolder, Row row) {
if (item instanceof MetaFile2) {
MetaFile2 file = (MetaFile2) item;
if (file.isDirectory()) {
openDirectory(file);
} else {
String mimeType = MimeUtils.guessMimeTypeFromExtension(file.getExtension());
PlayUtils.openAnyFile(file, getActivity());
}
} else if (item instanceof Video) {
openDetailsActivity((Video) item, itemViewHolder);
} else {
throw new IllegalArgumentException("Click on an unexpected item type " + item);
}
}
});
}
示例3: setupAdapter
import android.support.v17.leanback.widget.OnItemViewClickedListener; //导入依赖的package包/类
private void setupAdapter() {
VerticalGridPresenter presenter = new VerticalGridPresenter(ZOOM_FACTOR);
presenter.setNumberOfColumns(COLUMNS);
setGridPresenter(presenter);
CardPresenterSelector cardPresenter = new CardPresenterSelector(getActivity());
mAdapter = new ArrayObjectAdapter(cardPresenter);
setAdapter(mAdapter);
setOnItemViewClickedListener(new OnItemViewClickedListener() {
@Override
public void onItemClicked(
Presenter.ViewHolder itemViewHolder,
Object item,
RowPresenter.ViewHolder rowViewHolder,
Row row) {
Card card = (Card)item;
Toast.makeText(getActivity(),
"Clicked on "+card.getTitle(),
Toast.LENGTH_SHORT).show();
}
});
}
示例4: SampleFragmentB
import android.support.v17.leanback.widget.OnItemViewClickedListener; //导入依赖的package包/类
public SampleFragmentB() {
mRowsAdapter = new ArrayObjectAdapter(new ShadowRowPresenterSelector());
setAdapter(mRowsAdapter);
setOnItemViewClickedListener(new OnItemViewClickedListener() {
@Override
public void onItemClicked(
Presenter.ViewHolder itemViewHolder,
Object item,
RowPresenter.ViewHolder rowViewHolder,
Row row) {
Toast.makeText(getActivity(), "Implement click handler", Toast.LENGTH_SHORT)
.show();
}
});
}
示例5: getItemClickedListener
import android.support.v17.leanback.widget.OnItemViewClickedListener; //导入依赖的package包/类
private OnItemViewClickedListener getItemClickedListener() {
return new OnItemViewClickedListener() {
@Override
public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item, RowPresenter.ViewHolder rowViewHolder, Row row) {
Log.d(TAG, "Clicked item:" + item);
if (item instanceof EpisodeBaseModel) {
EpisodeBaseModel ep = (EpisodeBaseModel) item;
Intent intent = new Intent(getActivity(), getPlayerActivityClass());
intent.putExtra(ContentManagerBase.CONTENT_ID, ep);
String[] others = getOtherEpisodeUrls().toArray(new String[getOtherEpisodeUrls().size()]);
intent.putExtra(ContentManagerBase.OTHER_EPISODES, others);
startActivity(intent);
}
}
};
}
示例6: initUi
import android.support.v17.leanback.widget.OnItemViewClickedListener; //导入依赖的package包/类
private void initUi() {
PlaybackControlsRowPresenter presenter = mediaControllerHelper.createControlsRowAndPresenter();
rows = new ArrayObjectAdapter(presenter);
rows.add(mediaControllerHelper.getControlsRow());
setAdapter(rows);
setOnItemViewClickedListener(new OnItemViewClickedListener() {
@Override
public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item,
RowPresenter.ViewHolder rowViewHolder, Row row) {
if (item instanceof Action) {
mediaControllerHelper.onActionClicked((Action) item);
}
}
});
}
示例7: onCreate
import android.support.v17.leanback.widget.OnItemViewClickedListener; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mRowsAdapter = new ArrayObjectAdapter(new ListRowPresenter());
setSearchResultProvider(this);
setOnItemViewClickedListener(new OnItemViewClickedListener() {
@Override
public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item, RowPresenter.ViewHolder rowViewHolder, Row row) {
if (!(item instanceof BaseRowItem)) return;
ItemLauncher.launch((BaseRowItem) item, TvApp.getApplication(), getActivity(), itemViewHolder);
}
});
mDelayedLoad = new SearchRunnable();
prepareBackgroundManager();
}
示例8: onActivityCreated
import android.support.v17.leanback.widget.OnItemViewClickedListener; //导入依赖的package包/类
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
loadVideoData();
setCustomPadding();
setOnItemViewClickedListener(new OnItemViewClickedListener() {
@Override
public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item, RowPresenter.ViewHolder rowViewHolder, Row row) {
Movie movie = (Movie) item;
Intent intent = new Intent(getActivity(), MovieDetailsActivity.class);
intent.putExtra(MovieDetailsActivity.MOVIE, movie);
Bundle bundle = ActivityOptionsCompat.makeSceneTransitionAnimation(
getActivity(),
((ImageCardView) itemViewHolder.view).getMainImageView(),
MovieDetailsActivity.SHARED_ELEMENT_NAME).toBundle();
getActivity().startActivity(intent, bundle);
}
});
}
示例9: onCreate
import android.support.v17.leanback.widget.OnItemViewClickedListener; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mScraper = new Scraper(getActivity());
mSearchExecutor = new SerialExecutor();
ClassPresenterSelector rowsPresenterSelector = new ClassPresenterSelector();
rowsPresenterSelector.addClassPresenter(ListRow.class, new ListRowPresenter());
rowsPresenterSelector.addClassPresenter(ShadowLessListRow.class, new ShadowLessRowPresenter());
mRowsAdapter = new ArrayObjectAdapter(rowsPresenterSelector);
setBadgeDrawable(getResources().getDrawable(R.mipmap.video2));
setSearchResultProvider(this);
setOnItemViewClickedListener(new OnItemViewClickedListener() {
@Override
public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item, RowPresenter.ViewHolder rowViewHolder, Row row) {
if (item instanceof BaseTags) {
saveTagsAndFinish((BaseTags) item);
}
}
});
mSpeechRecognitionCallback = new SpeechRecognitionCallback() {
@Override
public void recognizeSpeech() {
// ACTION_RECOGNIZE_SPEECH
try{
startActivityForResult(getRecognizerIntent(), SEARCH_REQUEST_CODE);
}catch (ActivityNotFoundException e){/*non google device*/}
}
};
setSpeechRecognitionCallback(mSpeechRecognitionCallback);
}
示例10: onCreate
import android.support.v17.leanback.widget.OnItemViewClickedListener; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setTopOffsetRatio(0.6f);
final Intent intent = getActivity().getIntent();
mShowId = intent.getLongExtra(EXTRA_TVSHOW_ID, -1);
mColor = ContextCompat.getColor(getActivity(), R.color.leanback_details_background);
mOverviewRowPresenter = new DetailsOverviewRowPresenter(new TvshowMoreDetailsDescriptionPresenter());
mOverviewRowPresenter.setSharedElementEnterTransition(getActivity(), SHARED_ELEMENT_NAME, 1000);
mOverviewRowPresenter.setBackgroundColor(getResources().getColor(R.color.leanback_details_background));
mOverviewRowPresenter.setStyleLarge(false);
mOverviewRowPresenter.setOnActionClickedListener(null);
setOnItemViewClickedListener(new OnItemViewClickedListener() {
@Override
public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item, RowPresenter.ViewHolder rowViewHolder, Row row) {
if (item instanceof ScraperImage) {
if (row == mPostersRow) {
mShowPosterSaverTask = new ShowPosterSaverTask().execute((ScraperImage) item);
}
else if (row == mBackdropsRow) {
mBackdropSaverTask = new BackdropSaverTask().execute((ScraperImage) item);
}
}
else if (item instanceof WebPageLink) {
WebPageLink link = (WebPageLink)item;
WebUtils.openWebLink(getActivity(), link.getUrl());
}
}
});
// WORKAROUND: at least one instance of BackdropTask must be created soon in the process (onCreate ?)
// else it does not work later.
// --> This instance of BackdropTask() will not be used but it must be created here!
mBackdropTask = new BackdropTask(getActivity(), VideoInfoCommonClass.getDarkerColor(mColor));
}
示例11: setOnItemViewClickedListener
import android.support.v17.leanback.widget.OnItemViewClickedListener; //导入依赖的package包/类
/**
* Sets an item clicked listener.
*/
public void setOnItemViewClickedListener(OnItemViewClickedListener listener) {
mOnItemViewClickedListener = listener;
if (mGridPresenter != null) {
mGridPresenter.setOnItemViewClickedListener(mOnItemViewClickedListener);
}
}
示例12: getDefaultItemClickedListener
import android.support.v17.leanback.widget.OnItemViewClickedListener; //导入依赖的package包/类
protected OnItemViewClickedListener getDefaultItemClickedListener() {
return new OnItemViewClickedListener() {
@Override public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object object, RowPresenter.ViewHolder rowViewHolder,
Row row) {
if (object instanceof MediaCardPresenter.MediaCardItem) {
MediaCardPresenter.MediaCardItem item = (MediaCardPresenter.MediaCardItem) object;
Media media = item.getMedia();
PTVMediaDetailActivity.startActivity(getActivity(), media);
}
}
};
}
示例13: setupUi
import android.support.v17.leanback.widget.OnItemViewClickedListener; //导入依赖的package包/类
private void setupUi() {
setHeadersState(HEADERS_ENABLED);
setHeadersTransitionOnBackEnabled(true);
setTitle(getString(R.string.card_examples_title));
setOnSearchClickedListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(getActivity(), getString(R.string.implement_search),
Toast.LENGTH_LONG).show();
}
});
setOnItemViewClickedListener(new OnItemViewClickedListener() {
@Override
public void onItemClicked(Presenter.ViewHolder viewHolder, Object item, RowPresenter.ViewHolder viewHolder1, Row row) {
if (!(item instanceof Card)) return;
if (!(viewHolder.view instanceof ImageCardView)) return;
ImageView imageView = ((ImageCardView) viewHolder.view).getMainImageView();
Bundle bundle = ActivityOptionsCompat.makeSceneTransitionAnimation(getActivity(),
imageView, DetailViewExampleFragment.TRANSITION_NAME).toBundle();
Intent intent = new Intent(getActivity().getBaseContext(),
DetailViewExampleActivity.class);
Card card = (Card) item;
int imageResId = card.getLocalImageResourceId(getContext());
intent.putExtra(DetailViewExampleFragment.EXTRA_CARD, imageResId);
startActivity(intent, bundle);
}
});
prepareEntranceTransition();
}
示例14: provideOnItemViewClickListenerForLiveDataFragment
import android.support.v17.leanback.widget.OnItemViewClickedListener; //导入依赖的package包/类
@PerFragment
@Provides
@IntoMap
@ListenerModuleKey(LiveDataFragment.class)
public OnItemViewClickedListener provideOnItemViewClickListenerForLiveDataFragment(
final Activity currentActivity) {
return new OnItemViewClickedListener() {
@Override
public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item,
RowPresenter.ViewHolder rowViewHolder, Row row) {
Intent intent;
Long videoItemId = ((VideoEntity) item).getId();
intent = new Intent(currentActivity, LiveDataDetailActivity.class);
intent.putExtra(LiveDataDetailActivity.VIDEO_ID, videoItemId);
VideoEntity cachedBundle = (VideoEntity) item;
intent.putExtra(LiveDataDetailActivity.CACHED_CONTENT, cachedBundle);
// enable the scene transition animation when the detail's activity is launched
Bundle bundle = ActivityOptionsCompat.makeSceneTransitionAnimation(
currentActivity,
((ImageCardView) itemViewHolder.view).getMainImageView(),
LiveDataDetailActivity.SHARED_ELEMENT_NAME).toBundle();
currentActivity.startActivity(intent, bundle);
}
};
}
示例15: provideOnItemViewClickListenerForLiveDataDetailFragmentSearch
import android.support.v17.leanback.widget.OnItemViewClickedListener; //导入依赖的package包/类
@PerFragment
@Provides
@IntoMap
@ListenerModuleKey(SearchFragment.class)
public OnItemViewClickedListener provideOnItemViewClickListenerForLiveDataDetailFragmentSearch(
final Activity currentActivity) {
return new OnItemViewClickedListener() {
@Override
public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item,
RowPresenter.ViewHolder rowViewHolder, Row row) {
if (item instanceof VideoEntity) {
Intent intent;
Long videoItemId = ((VideoEntity) item).getId();
intent = new Intent(currentActivity, LiveDataDetailActivity.class);
intent.putExtra(LiveDataDetailActivity.VIDEO_ID, videoItemId);
VideoEntity cachedBundle = (VideoEntity) item;
intent.putExtra(LiveDataDetailActivity.CACHED_CONTENT, cachedBundle);
// enable the scene transition animation when the detail's activity is launched
Bundle bundle = ActivityOptionsCompat.makeSceneTransitionAnimation(
currentActivity,
((ImageCardView) itemViewHolder.view).getMainImageView(),
LiveDataDetailActivity.SHARED_ELEMENT_NAME).toBundle();
currentActivity.startActivity(intent, bundle);
}
}
};
}