Search in sources :

Example 1 with PlaylistInfoItem

use of org.schabi.newpipe.extractor.playlist.PlaylistInfoItem in project NewPipe by TeamNewPipe.

the class BaseListFragment method initListeners.

@Override
protected void initListeners() {
    super.initListeners();
    infoListAdapter.setOnStreamSelectedListener(new OnClickGesture<StreamInfoItem>() {

        @Override
        public void selected(StreamInfoItem selectedItem) {
            onItemSelected(selectedItem);
            NavigationHelper.openVideoDetailFragment(useAsFrontPage ? getParentFragment().getFragmentManager() : getFragmentManager(), selectedItem.getServiceId(), selectedItem.getUrl(), selectedItem.getName());
        }

        @Override
        public void held(StreamInfoItem selectedItem) {
            showStreamDialog(selectedItem);
        }
    });
    infoListAdapter.setOnChannelSelectedListener(new OnClickGesture<ChannelInfoItem>() {

        @Override
        public void selected(ChannelInfoItem selectedItem) {
            onItemSelected(selectedItem);
            NavigationHelper.openChannelFragment(useAsFrontPage ? getParentFragment().getFragmentManager() : getFragmentManager(), selectedItem.getServiceId(), selectedItem.getUrl(), selectedItem.getName());
        }
    });
    infoListAdapter.setOnPlaylistSelectedListener(new OnClickGesture<PlaylistInfoItem>() {

        @Override
        public void selected(PlaylistInfoItem selectedItem) {
            onItemSelected(selectedItem);
            NavigationHelper.openPlaylistFragment(useAsFrontPage ? getParentFragment().getFragmentManager() : getFragmentManager(), selectedItem.getServiceId(), selectedItem.getUrl(), selectedItem.getName());
        }
    });
    itemsList.clearOnScrollListeners();
    itemsList.addOnScrollListener(new OnScrollBelowItemsListener() {

        @Override
        public void onScrolledDown(RecyclerView recyclerView) {
            onScrollToBottom();
        }
    });
}
Also used : OnScrollBelowItemsListener(org.schabi.newpipe.fragments.OnScrollBelowItemsListener) StreamInfoItem(org.schabi.newpipe.extractor.stream.StreamInfoItem) RecyclerView(android.support.v7.widget.RecyclerView) ChannelInfoItem(org.schabi.newpipe.extractor.channel.ChannelInfoItem) PlaylistInfoItem(org.schabi.newpipe.extractor.playlist.PlaylistInfoItem)

Example 2 with PlaylistInfoItem

use of org.schabi.newpipe.extractor.playlist.PlaylistInfoItem in project NewPipe by TeamNewPipe.

the class PlaylistMiniInfoItemHolder method updateFromItem.

@Override
public void updateFromItem(final InfoItem infoItem) {
    if (!(infoItem instanceof PlaylistInfoItem))
        return;
    final PlaylistInfoItem item = (PlaylistInfoItem) infoItem;
    itemTitleView.setText(item.getName());
    itemStreamCountView.setText(String.valueOf(item.getStreamCount()));
    itemUploaderView.setText(item.getUploaderName());
    itemBuilder.getImageLoader().displayImage(item.getThumbnailUrl(), itemThumbnailView, ImageDisplayConstants.DISPLAY_THUMBNAIL_OPTIONS);
    itemView.setOnClickListener(view -> {
        if (itemBuilder.getOnPlaylistSelectedListener() != null) {
            itemBuilder.getOnPlaylistSelectedListener().selected(item);
        }
    });
    itemView.setLongClickable(true);
    itemView.setOnLongClickListener(view -> {
        if (itemBuilder.getOnPlaylistSelectedListener() != null) {
            itemBuilder.getOnPlaylistSelectedListener().held(item);
        }
        return true;
    });
}
Also used : PlaylistInfoItem(org.schabi.newpipe.extractor.playlist.PlaylistInfoItem)

Aggregations

PlaylistInfoItem (org.schabi.newpipe.extractor.playlist.PlaylistInfoItem)2 RecyclerView (android.support.v7.widget.RecyclerView)1 ChannelInfoItem (org.schabi.newpipe.extractor.channel.ChannelInfoItem)1 StreamInfoItem (org.schabi.newpipe.extractor.stream.StreamInfoItem)1 OnScrollBelowItemsListener (org.schabi.newpipe.fragments.OnScrollBelowItemsListener)1