Search in sources :

Example 1 with LocalItemListAdapter

use of org.schabi.newpipe.fragments.local.LocalItemListAdapter in project NewPipe by TeamNewPipe.

the class PlaylistAppendDialog method onViewCreated.

@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    final LocalPlaylistManager playlistManager = new LocalPlaylistManager(NewPipeDatabase.getInstance(getContext()));
    playlistAdapter = new LocalItemListAdapter(getActivity());
    playlistAdapter.setSelectedListener(new OnClickGesture<LocalItem>() {

        @Override
        public void selected(LocalItem selectedItem) {
            if (!(selectedItem instanceof PlaylistMetadataEntry) || getStreams() == null)
                return;
            onPlaylistSelected(playlistManager, (PlaylistMetadataEntry) selectedItem, getStreams());
        }
    });
    playlistRecyclerView = view.findViewById(R.id.playlist_list);
    playlistRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
    playlistRecyclerView.setAdapter(playlistAdapter);
    final View newPlaylistButton = view.findViewById(R.id.newPlaylist);
    newPlaylistButton.setOnClickListener(ignored -> openCreatePlaylistDialog());
    playlistReactor = playlistManager.getPlaylists().observeOn(AndroidSchedulers.mainThread()).subscribe(this::onPlaylistsReceived);
}
Also used : LocalItemListAdapter(org.schabi.newpipe.fragments.local.LocalItemListAdapter) LocalItem(org.schabi.newpipe.database.LocalItem) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) View(android.view.View) RecyclerView(android.support.v7.widget.RecyclerView) LocalPlaylistManager(org.schabi.newpipe.fragments.local.LocalPlaylistManager) PlaylistMetadataEntry(org.schabi.newpipe.database.playlist.PlaylistMetadataEntry)

Example 2 with LocalItemListAdapter

use of org.schabi.newpipe.fragments.local.LocalItemListAdapter in project NewPipe by TeamNewPipe.

the class BaseLocalListFragment method initViews.

@Override
protected void initViews(View rootView, Bundle savedInstanceState) {
    super.initViews(rootView, savedInstanceState);
    itemsList = rootView.findViewById(R.id.items_list);
    itemsList.setLayoutManager(getListLayoutManager());
    itemListAdapter = new LocalItemListAdapter(activity);
    itemListAdapter.setHeader(headerRootView = getListHeader());
    itemListAdapter.setFooter(footerRootView = getListFooter());
    itemsList.setAdapter(itemListAdapter);
}
Also used : LocalItemListAdapter(org.schabi.newpipe.fragments.local.LocalItemListAdapter)

Aggregations

LocalItemListAdapter (org.schabi.newpipe.fragments.local.LocalItemListAdapter)2 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)1 RecyclerView (android.support.v7.widget.RecyclerView)1 View (android.view.View)1 LocalItem (org.schabi.newpipe.database.LocalItem)1 PlaylistMetadataEntry (org.schabi.newpipe.database.playlist.PlaylistMetadataEntry)1 LocalPlaylistManager (org.schabi.newpipe.fragments.local.LocalPlaylistManager)1