androidx.leanback.widget.OnItemViewClickedListener Java Examples
The following examples show how to use
androidx.leanback.widget.OnItemViewClickedListener.
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: PageAndListRowFragment.java From tv-samples with Apache License 2.0 | 6 votes |
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(); } }); }
Example #2
Source File: PageAndListRowFragment.java From tv-samples with Apache License 2.0 | 6 votes |
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(); } }); }
Example #3
Source File: CustomPlaybackFragmentGlueHost.java From jellyfin-androidtv with GNU General Public License v2.0 | 6 votes |
@Override public void setOnActionClickedListener(OnActionClickedListener listener) { // Copy from superclass if (listener == null) { fragment.setOnPlaybackItemViewClickedListener(null); } else { fragment.setOnPlaybackItemViewClickedListener(new OnItemViewClickedListener() { @Override public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item, RowPresenter.ViewHolder rowViewHolder, Row row) { // Call our custom function and pass the view instance if (item instanceof CustomAction) { ((CustomAction) item).onCustomActionClicked(itemViewHolder.view); } if (item instanceof Action) { listener.onActionClicked((Action) item); } } }); }; }
Example #4
Source File: CardExampleFragment.java From tv-samples with Apache License 2.0 | 5 votes |
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(); }
Example #5
Source File: ListenerFactory.java From tv-samples with Apache License 2.0 | 5 votes |
@Inject public ListenerFactory(Map<Class, OnItemViewClickedListener> onItemViewClickedListenerMap, Map<Class, OnItemViewSelectedListener> onItemViewSelectedListenerMap, Map<Class, View.OnClickListener> viewOnClickListenerMap) { mOnItemViewClickedListenerMap = onItemViewClickedListenerMap; mOnItemViewSelectedListenerMap = onItemViewSelectedListenerMap; mViewOnClickListenerMap = viewOnClickListenerMap; }
Example #6
Source File: GridFragment.java From tv-samples with Apache License 2.0 | 5 votes |
/** * Sets an item clicked listener. */ public void setOnItemViewClickedListener(OnItemViewClickedListener listener) { mOnItemViewClickedListener = listener; if (mGridPresenter != null) { mGridPresenter.setOnItemViewClickedListener(mOnItemViewClickedListener); } }
Example #7
Source File: GridFragment.java From jellyfin-androidtv with GNU General Public License v2.0 | 5 votes |
/** * Sets an item clicked listener. */ public void setOnItemViewClickedListener(OnItemViewClickedListener listener) { mOnItemViewClickedListener = listener; if (mGridPresenter != null) { if (mGridPresenter instanceof HorizontalGridPresenter) ((HorizontalGridPresenter)mGridPresenter).setOnItemViewClickedListener(mOnItemViewClickedListener); else if (mGridPresenter instanceof VerticalGridPresenter) ((VerticalGridPresenter)mGridPresenter).setOnItemViewClickedListener(mOnItemViewClickedListener); } }
Example #8
Source File: ListenerFactory.java From tv-samples with Apache License 2.0 | 4 votes |
public OnItemViewClickedListener getOnItemViewClickedListener(Class key) { return mOnItemViewClickedListenerMap.get(key); }
Example #9
Source File: GridFragment.java From tv-samples with Apache License 2.0 | 4 votes |
/** * Returns the item clicked listener. */ public OnItemViewClickedListener getOnItemViewClickedListener() { return mOnItemViewClickedListener; }
Example #10
Source File: HorizontalGridPresenter.java From jellyfin-androidtv with GNU General Public License v2.0 | 4 votes |
/** * Returns the item clicked listener. */ public final OnItemViewClickedListener getOnItemViewClickedListener() { return mOnItemViewClickedListener; }
Example #11
Source File: GridFragment.java From jellyfin-androidtv with GNU General Public License v2.0 | 4 votes |
/** * Returns the item clicked listener. */ public OnItemViewClickedListener getOnItemViewClickedListener() { return mOnItemViewClickedListener; }
Example #12
Source File: CompositeClickedListener.java From jellyfin-androidtv with GNU General Public License v2.0 | 4 votes |
public void registerListener (OnItemViewClickedListener listener) { registeredListeners.add(listener); }
Example #13
Source File: CompositeClickedListener.java From jellyfin-androidtv with GNU General Public License v2.0 | 4 votes |
public void unRegisterListener (OnItemViewClickedListener listener) { registeredListeners.remove(listener); }
Example #14
Source File: CompositeClickedListener.java From jellyfin-androidtv with GNU General Public License v2.0 | 4 votes |
@Override public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item, RowPresenter.ViewHolder rowViewHolder, Row row) { for (OnItemViewClickedListener listener : registeredListeners) { listener.onItemClicked(itemViewHolder, item, rowViewHolder, row); } }
Example #15
Source File: HorizontalGridPresenter.java From jellyfin-androidtv with GNU General Public License v2.0 | 2 votes |
/** * Sets the item clicked listener. * OnItemViewClickedListener will override {@link View.OnClickListener} that * item presenter sets during {@link Presenter#onCreateViewHolder(ViewGroup)}. * So in general, developer should choose one of the listeners but not both. */ public final void setOnItemViewClickedListener(OnItemViewClickedListener listener) { mOnItemViewClickedListener = listener; }
Example #16
Source File: LiveDataDetailFragmentSubComponent.java From tv-samples with Apache License 2.0 | votes |
Map<Class, OnItemViewClickedListener> onItemViewClickedListenerMap();