androidx.leanback.widget.RowPresenter Java Examples

The following examples show how to use androidx.leanback.widget.RowPresenter. 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: VideoGridExampleFragment.java    From tv-samples with Apache License 2.0 6 votes vote down vote up
@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 #2
Source File: CustomPlaybackFragmentGlueHost.java    From jellyfin-androidtv with GNU General Public License v2.0 6 votes vote down vote up
@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 #3
Source File: CustomPlaybackOverlayFragment.java    From jellyfin-androidtv with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item,
                          RowPresenter.ViewHolder rowViewHolder, Row row) {
    if (item instanceof BaseRowItem) {
        BaseRowItem rowItem = (BaseRowItem) item;
        switch (rowItem.getItemType()) {
            case Chapter:
                Long start = rowItem.getChapterInfo().getStartPositionTicks() / 10000;
                mPlaybackController.seek(start);
                hidePopupPanel();
                break;
        }
    } else if (item instanceof ChannelInfoDto) {
        Utils.beep(100);
        hidePopupPanel();
        switchChannel(((ChannelInfoDto) item).getId());
    }
}
 
Example #4
Source File: HomeFragmentFooterRow.java    From jellyfin-androidtv with GNU General Public License v2.0 6 votes vote down vote up
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: CustomListRowPresenter.java    From jellyfin-androidtv with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected void onBindRowViewHolder(RowPresenter.ViewHolder holder, Object item) {
    super.onBindRowViewHolder(holder, item);

    viewHolder = (View) holder.view.getParent();

    if (topPadding != null) {
        viewHolder.setPadding(viewHolder.getPaddingLeft(), topPadding, viewHolder.getPaddingRight(), viewHolder.getPaddingBottom());
    }

    if (backgroundDrawable != null) {
        viewHolder.setBackground(backgroundDrawable);
    } else if (backgroundColor != null) {
        viewHolder.setBackgroundColor(backgroundColor);
    }
}
 
Example #6
Source File: PlaybackFragment.java    From androidtv-Leanback with Apache License 2.0 6 votes vote down vote up
@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 #7
Source File: StdGridFragment.java    From jellyfin-androidtv with GNU General Public License v2.0 6 votes vote down vote up
@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 #8
Source File: AvContentTvItemClickListener.java    From xipl with Apache License 2.0 6 votes vote down vote up
@Override
public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item, RowPresenter.ViewHolder rowViewHolder, Row row) {

    if (item instanceof AvContent) {
        // The item comes from an AvContent element. Get the context from it's ViewHolder.
        AvContent avContent = (AvContent) item;
        Context context = itemViewHolder.view.getContext();
        Intent intent = new Intent(context, mClass);
        Bundle bundle = new Bundle();
        bundle.putString(VodTvSectionFragment.AV_CONTENT_TITLE_BUNDLE, avContent.getTitle());
        bundle.putString(VodTvSectionFragment.AV_CONTENT_LOGO_BUNDLE, avContent.getLogo());
        bundle.putString(VodTvSectionFragment.AV_CONTENT_LINK_BUNDLE, avContent.getContentLink());
        bundle.putString(VodTvSectionFragment.AV_CONTENT_GROUP_BUNDLE, avContent.getGroup());
        intent.putExtras(bundle);
        context.startActivity(intent);
    }
}
 
Example #9
Source File: VideoDetailsFragment.java    From androidtv-Leanback with Apache License 2.0 6 votes vote down vote up
@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 #10
Source File: VerticalGridFragment.java    From tv-samples with Apache License 2.0 6 votes vote down vote up
@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 #11
Source File: SearchFragment.java    From tv-samples with Apache License 2.0 6 votes vote down vote up
@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 #12
Source File: VideoDetailsFragment.java    From tv-samples with Apache License 2.0 6 votes vote down vote up
@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 #13
Source File: PlaybackFragment.java    From tv-samples with Apache License 2.0 6 votes vote down vote up
@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 #14
Source File: VerticalGridFragment.java    From androidtv-Leanback with Apache License 2.0 6 votes vote down vote up
@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 #15
Source File: DetailViewExampleWithVideoBackgroundFragment.java    From tv-samples with Apache License 2.0 6 votes vote down vote up
@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 #16
Source File: CustomBrowseFragment.java    From jellyfin-androidtv with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void onItemSelected(Presenter.ViewHolder itemViewHolder, Object item,
                           RowPresenter.ViewHolder rowViewHolder, Row row) {
    if (!(item instanceof BaseRowItem)) {
        //fill in default background
        mBackgroundUrl = null;
        startBackgroundTimer();
        return;
    }

    BaseRowItem rowItem = (BaseRowItem) item;
    mCurrentItem = rowItem;
    mCurrentRow = (ListRow) row;

    //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());

    mBackgroundUrl = rowItem.getBackdropImageUrl();
    startBackgroundTimer();

}
 
Example #17
Source File: PageAndListRowFragment.java    From tv-samples with Apache License 2.0 6 votes vote down vote up
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 #18
Source File: ListenerModule.java    From tv-samples with Apache License 2.0 6 votes vote down vote up
@PerFragment
@Provides
@IntoMap
@ListenerModuleKey(LiveDataFragment.class)
public OnItemViewSelectedListener provideOnItemViewSelectedListener(final Activity activity,
        final DisplayMetrics metrics, final BackgroundManager backgroundManager,
        final RequestOptions defaultPlaceHolder, final Drawable finalDrawable, final Handler mainHandler) {
    return new OnItemViewSelectedListener() {
        @Override
        public void onItemSelected(Presenter.ViewHolder itemViewHolder, Object item,
                RowPresenter.ViewHolder rowViewHolder, Row row) {
            VideoEntity selectedVideo = (VideoEntity) item;
            RunnableClass backgroundRunnable = new RunnableClass(selectedVideo, activity,
                    metrics, backgroundManager, defaultPlaceHolder, finalDrawable);

            if (lastTime != null) {
                mainHandler.removeCallbacks(lastTime);
            }
            mainHandler.postDelayed(backgroundRunnable, BACKGROUND_UPDATE_DELAY);
            lastTime = backgroundRunnable;
        }
    };
}
 
Example #19
Source File: PageAndListRowFragment.java    From tv-samples with Apache License 2.0 6 votes vote down vote up
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 #20
Source File: SearchFragment.java    From androidtv-Leanback with Apache License 2.0 6 votes vote down vote up
@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 #21
Source File: FullDetailsActivity.java    From jellyfin-androidtv with GNU General Public License v2.0 5 votes vote down vote up
@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 #22
Source File: EnhancedBrowseFragment.java    From jellyfin-androidtv with GNU General Public License v2.0 5 votes vote down vote up
@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 #23
Source File: AudioNowPlayingActivity.java    From jellyfin-androidtv with GNU General Public License v2.0 5 votes vote down vote up
@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 #24
Source File: FullDetailsActivity.java    From jellyfin-androidtv with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onItemSelected(Presenter.ViewHolder itemViewHolder, Object item,
                           RowPresenter.ViewHolder rowViewHolder, Row row) {
    if (!(item instanceof BaseRowItem)) {
        mCurrentItem = null;
    } else {
        mCurrentItem = (BaseRowItem)item;
    }
}
 
Example #25
Source File: StdGridFragment.java    From jellyfin-androidtv with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onItemClicked(final Presenter.ViewHolder itemViewHolder, Object item,
                          RowPresenter.ViewHolder rowViewHolder, Row row) {

    if (!(item instanceof BaseRowItem)) return;
    ItemLauncher.launch((BaseRowItem) item, mGridAdapter, ((BaseRowItem)item).getIndex(), getActivity());
}
 
Example #26
Source File: ProviderSettingsTvFragment.java    From xipl with Apache License 2.0 5 votes vote down vote up
@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 #27
Source File: StdBrowseFragment.java    From jellyfin-androidtv with GNU General Public License v2.0 5 votes vote down vote up
@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 #28
Source File: BrowseFolderFragment.java    From jellyfin-androidtv with GNU General Public License v2.0 5 votes vote down vote up
@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 #29
Source File: CustomBrowseFragment.java    From jellyfin-androidtv with GNU General Public License v2.0 5 votes vote down vote up
@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 #30
Source File: StdBrowseFragment.java    From jellyfin-androidtv with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onItemSelected(Presenter.ViewHolder itemViewHolder, Object item,
                           RowPresenter.ViewHolder rowViewHolder, Row row) {

    if (!(item instanceof BaseRowItem)) {
        mCurrentItem = null;
        //fill in default background
        mBackgroundUrl = null;
        startBackgroundTimer();
        return;
    } else {
        mCurrentItem = (BaseRowItem)item;
    }

    mCurrentRow = (ListRow) row;
    BaseRowItem rowItem = (BaseRowItem) item;

    if (((ListRow) row).getAdapter() instanceof ItemRowAdapter) {
        //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();
    }

}