Java Code Examples for androidx.leanback.widget.RowPresenter#ViewHolder
The following examples show how to use
androidx.leanback.widget.RowPresenter#ViewHolder .
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: SearchFragment.java From tv-samples with Apache License 2.0 | 6 votes |
@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(); } }
Example 2
Source File: VideoDetailsFragment.java From tv-samples with Apache License 2.0 | 6 votes |
@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); } }
Example 3
Source File: StdGridFragment.java From jellyfin-androidtv with GNU General Public License v2.0 | 6 votes |
@Override public void onItemSelected(Presenter.ViewHolder itemViewHolder, Object item, RowPresenter.ViewHolder rowViewHolder, Row row) { mHandler.removeCallbacks(mDelayedSetItem); if (!(item instanceof BaseRowItem)) { mCurrentItem = null; setTitle(MainTitle); //fill in default background mBackgroundUrl = null; startBackgroundTimer(); } else { mCurrentItem = (BaseRowItem)item; mTitleView.setText(mCurrentItem.getName()); mInfoRow.removeAllViews(); mHandler.postDelayed(mDelayedSetItem, 400); if (!determiningPosterSize) mGridAdapter.loadMoreItemsIfNeeded(mCurrentItem.getIndex()); } }
Example 4
Source File: HomeFragmentFooterRow.java From jellyfin-androidtv with GNU General Public License v2.0 | 6 votes |
public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item, RowPresenter.ViewHolder rowViewHolder, Row row) { if (!(item instanceof GridButton)) return; switch (((GridButton) item).getId()) { case LOGOUT: TvApp app = TvApp.getApplication(); // Present user selection app.setLoginApiClient(app.getApiClient()); // Open login activity Intent selectUserIntent = new Intent(activity, SelectUserActivity.class); selectUserIntent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY); // Disallow back button activity.startActivity(selectUserIntent); activity.finish(); break; case SETTINGS: Intent settingsIntent = new Intent(activity, PreferencesActivity.class); activity.startActivity(settingsIntent); break; } }
Example 5
Source File: VideoGridExampleFragment.java From tv-samples with Apache License 2.0 | 6 votes |
@Override public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item, RowPresenter.ViewHolder rowViewHolder, Row row) { if (item instanceof VideoCard) { VideoCard itemCard = (VideoCard) item; List<String> videoSources = itemCard.getVideoSources(); if (videoSources == null || videoSources.isEmpty()) { return; } MediaMetaData metaData = new MediaMetaData(); metaData.setMediaSourcePath(videoSources.get(0)); metaData.setMediaTitle(itemCard.getTitle()); metaData.setMediaArtistName(itemCard.getDescription()); metaData.setMediaAlbumArtUrl(itemCard.getImageUrl()); Intent intent = new Intent(getActivity(), VideoExampleActivity.class); intent.putExtra(VideoExampleActivity.TAG, metaData); intent.setData(Uri.parse(metaData.getMediaSourcePath())); getActivity().startActivity(intent); } }
Example 6
Source File: DetailViewExampleWithVideoBackgroundFragment.java From tv-samples with Apache License 2.0 | 6 votes |
@Override public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item, RowPresenter.ViewHolder rowViewHolder, Row row) { if (!(item instanceof Action)) return; Action action = (Action) item; long id = action.getId(); if (id == ACTION_RENT) { startWizardActivityForPayment(); } else if (action.getId() == ACTION_PLAY) { playMainVideoOnBackground(); } else if (action.getId() == ACTION_RELATED) { setSelectedPosition(1); } else { Toast.makeText(getActivity(), getString(R.string.action_cicked), Toast.LENGTH_LONG) .show(); } }
Example 7
Source File: DetailViewExampleFragment.java From tv-samples with Apache License 2.0 | 5 votes |
@Override public void onItemSelected(Presenter.ViewHolder itemViewHolder, Object item, RowPresenter.ViewHolder rowViewHolder, Row row) { if (mRowsAdapter.indexOf(row) > 0) { int backgroundColor = getResources().getColor(R.color.detail_view_related_background); getView().setBackgroundColor(backgroundColor); } else { getView().setBackground(null); } }
Example 8
Source File: CustomBrowseFragment.java From jellyfin-androidtv with GNU General Public License v2.0 | 5 votes |
@Override public void onItemClicked(final Presenter.ViewHolder itemViewHolder, Object item, RowPresenter.ViewHolder rowViewHolder, Row row) { if (!(item instanceof BaseRowItem)) return; ItemLauncher.launch((BaseRowItem) item, (ItemRowAdapter) ((ListRow)row).getAdapter(), ((BaseRowItem) item).getIndex(), getActivity()); }
Example 9
Source File: FullDetailsActivity.java From jellyfin-androidtv with GNU General Public License v2.0 | 5 votes |
@Override public void onItemClicked(final Presenter.ViewHolder itemViewHolder, Object item, RowPresenter.ViewHolder rowViewHolder, Row row) { if (!(item instanceof BaseRowItem)) return; ItemLauncher.launch((BaseRowItem) item, (ItemRowAdapter) ((ListRow)row).getAdapter(), ((BaseRowItem)item).getIndex(), mActivity); }
Example 10
Source File: ProviderSettingsTvFragment.java From xipl with Apache License 2.0 | 5 votes |
@Override public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item, RowPresenter.ViewHolder rowViewHolder, Row row) { if (item instanceof Bundle) { // The item comes from a Settings element. Bundle bundle = (Bundle) item; Intent intent = new Intent(itemViewHolder.view.getContext(), getSettingsElementActivity()); intent.putExtras(bundle); startActivity(intent); } }
Example 11
Source File: GridFragment.java From jellyfin-androidtv with GNU General Public License v2.0 | 5 votes |
@Override public void onItemSelected(Presenter.ViewHolder itemViewHolder, Object item, RowPresenter.ViewHolder rowViewHolder, Row row) { int position = mGridView.getSelectedPosition(); if (DEBUG) Log.v(TAG, "row selected position " + position); onRowSelected(position); if (mOnItemViewSelectedListener != null && position >= 0) { mOnItemViewSelectedListener.onItemSelected(itemViewHolder, item, rowViewHolder, row); } }
Example 12
Source File: EnhancedBrowseFragment.java From jellyfin-androidtv with GNU General Public License v2.0 | 5 votes |
@Override public void onItemSelected(Presenter.ViewHolder itemViewHolder, Object item, RowPresenter.ViewHolder rowViewHolder, Row row) { mHandler.removeCallbacks(updateContentTask); if (item instanceof GridButton && ((GridButton)item).getId() == FAVSONGS) { //set to specialized item mCurrentItem = favSongsRowItem; } if (!(item instanceof BaseRowItem)) { mTitle.setText(mFolder != null ? mFolder.getName() : ""); mInfoRow.removeAllViews(); mSummary.setText(""); //fill in default background mBackgroundUrl = null; startBackgroundTimer(); return; } BaseRowItem rowItem = (BaseRowItem) item; mCurrentItem = rowItem; mCurrentRow = (ListRow) row; mTitle.setText(mCurrentItem.getName()); mInfoRow.removeAllViews(); mSummary.setText(""); mHandler.postDelayed(updateContentTask, 500); //mApplication.getLogger().Debug("Selected Item "+rowItem.getIndex() + " type: "+ (rowItem.getItemType().equals(BaseRowItem.ItemType.BaseItem) ? rowItem.getBaseItem().getType() : "other")); ItemRowAdapter adapter = (ItemRowAdapter) ((ListRow)row).getAdapter(); adapter.loadMoreItemsIfNeeded(rowItem.getIndex()); if (ShowFanart) { mBackgroundUrl = rowItem.getBackdropImageUrl(); startBackgroundTimer(); } }
Example 13
Source File: AudioNowPlayingActivity.java From jellyfin-androidtv with GNU General Public License v2.0 | 5 votes |
@Override public void onItemSelected(Presenter.ViewHolder itemViewHolder, Object item, RowPresenter.ViewHolder rowViewHolder, Row row) { if (item instanceof BaseRowItem) { //Keep counter mCounter.setText(((BaseRowItem) item).getIndex() + 1 + " | " + mQueueRow.getAdapter().size()); } }
Example 14
Source File: BrowseFolderFragment.java From jellyfin-androidtv with GNU General Public License v2.0 | 5 votes |
@Override public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item, RowPresenter.ViewHolder rowViewHolder, Row row) { if (item instanceof GridButton) { switch (((GridButton) item).getId()) { case BY_LETTER: Intent intent = new Intent(getActivity(), ByLetterActivity.class); intent.putExtra(Extras.Folder, SerializerRepository.INSTANCE.getSerializer().SerializeToString(mFolder)); intent.putExtra(Extras.IncludeType, itemTypeString); getActivity().startActivity(intent); break; case GENRES: Intent genreIntent = new Intent(getActivity(), ByGenreActivity.class); genreIntent.putExtra(Extras.Folder, SerializerRepository.INSTANCE.getSerializer().SerializeToString(mFolder)); genreIntent.putExtra(Extras.IncludeType, itemTypeString); getActivity().startActivity(genreIntent); break; case SUGGESTED: Intent suggIntent = new Intent(getActivity(), SuggestedMoviesActivity.class); suggIntent.putExtra(Extras.Folder, SerializerRepository.INSTANCE.getSerializer().SerializeToString(mFolder)); suggIntent.putExtra(Extras.IncludeType, itemTypeString); getActivity().startActivity(suggIntent); break; case PERSONS: Intent personIntent = new Intent(getActivity(), BrowsePersonsActivity.class); personIntent.putExtra(Extras.Folder, SerializerRepository.INSTANCE.getSerializer().SerializeToString(mFolder)); personIntent.putExtra(Extras.IncludeType, itemTypeString); getActivity().startActivity(personIntent); break; default: Toast.makeText(getActivity(), item.toString() + mApplication.getString(R.string.msg_not_implemented), Toast.LENGTH_SHORT).show(); break; } } }
Example 15
Source File: SelectServerFragment.java From jellyfin-androidtv with GNU General Public License v2.0 | 5 votes |
@Override public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item, RowPresenter.ViewHolder rowViewHolder, Row row) { if (item instanceof GridButton) { switch (((GridButton) item).getId()) { case ENTER_MANUALLY: AuthenticationHelper.enterManualServerAddress(getActivity()); break; default: Toast.makeText(getActivity(), item.toString(), Toast.LENGTH_SHORT) .show(); break; } } }
Example 16
Source File: PositionableListRowPresenter.java From jellyfin-androidtv with GNU General Public License v2.0 | 4 votes |
@Override protected void onBindRowViewHolder(RowPresenter.ViewHolder holder, Object item) { super.onBindRowViewHolder(holder, item); viewHolder = (ViewHolder) holder; }
Example 17
Source File: MyDetailsOverviewRowPresenter.java From jellyfin-androidtv with GNU General Public License v2.0 | 4 votes |
@Override protected void onBindRowViewHolder(RowPresenter.ViewHolder holder, Object item) { super.onBindRowViewHolder(holder, item); MyDetailsOverviewRow row = (MyDetailsOverviewRow) item; ViewHolder vh = (ViewHolder) holder; setTitle(row.getItem().getName()); InfoLayoutHelper.addInfoRow(TvApp.getApplication().getCurrentActivity(), row.getItem(), vh.mInfoRow, false, false); addGenres(vh.mGenreRow, row.getItem()); setInfo1(row.getInfoItem1()); setInfo2(row.getInfoItem2()); setInfo3(row.getInfoItem3()); vh.mPoster.setImageDrawable(row.getImageDrawable()); //vh.mStudioImage.setImageDrawable(row.getStudioDrawable()); // Support simple HTML elements String summaryRaw = row.getSummary(); if (summaryRaw != null) vh.mSummary.setText(TextUtilsKt.toHtmlSpanned(summaryRaw)); switch (row.getItem().getBaseItemType()) { case Person: RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) vh.mSummary.getLayoutParams(); params.topMargin = 10; params.height = Utils.convertDpToPixel(TvApp.getApplication(), 185); vh.mSummary.setMaxLines(9); vh.mGenreRow.setVisibility(View.GONE); vh.mInfoRow.setVisibility(View.GONE); vh.collapseLeftFrame(); break; } vh.mButtonRow.removeAllViews(); for (TextUnderButton button : row.getActions()) { vh.mButtonRow.addView(button); } }
Example 18
Source File: VerticalGridFragment.java From tv-samples with Apache License 2.0 | 4 votes |
@Override public void onItemSelected(Presenter.ViewHolder itemViewHolder, Object item, RowPresenter.ViewHolder rowViewHolder, Row row) { }
Example 19
Source File: LiveDataRowPresenter.java From tv-samples with Apache License 2.0 | 4 votes |
@Override protected void onUnbindRowViewHolder(RowPresenter.ViewHolder holder) { super.onUnbindRowViewHolder(holder); LiveDataRowPresenterViewHolder vh = (LiveDataRowPresenterViewHolder)holder; vh.getLiveData().removeObservers(mLifecycleOwner); }
Example 20
Source File: VideoGridExampleFragment.java From tv-samples with Apache License 2.0 | 4 votes |
@Override public void onItemSelected(Presenter.ViewHolder itemViewHolder, Object item, RowPresenter.ViewHolder rowViewHolder, Row row) { }