Search in sources :

Example 6 with ContextMenuRecyclerView

use of org.videolan.vlc.gui.view.ContextMenuRecyclerView in project vlc-android by GeoffreyMetais.

the class AudioAlbumsSongsFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    final View v = inflater.inflate(R.layout.audio_albums_songs, container, false);
    mViewPager = v.findViewById(R.id.pager);
    final ContextMenuRecyclerView albumsList = (ContextMenuRecyclerView) mViewPager.getChildAt(MODE_ALBUM);
    final ContextMenuRecyclerView songsList = (ContextMenuRecyclerView) mViewPager.getChildAt(MODE_SONG);
    mLists = new ContextMenuRecyclerView[] { albumsList, songsList };
    final String[] titles = new String[] { getString(R.string.albums), getString(R.string.songs) };
    mAlbumsAdapter = new AudioBrowserAdapter(MediaLibraryItem.TYPE_ALBUM, this);
    mSongsAdapter = new AudioBrowserAdapter(MediaLibraryItem.TYPE_MEDIA, this);
    mAlbumsAdapter.setParentAdapterType(mItem.getItemType());
    mSongsAdapter.setParentAdapterType(mItem.getItemType());
    mAdapters = new AudioBrowserAdapter[] { mAlbumsAdapter, mSongsAdapter };
    songsList.setAdapter(mSongsAdapter);
    albumsList.setAdapter(mAlbumsAdapter);
    mViewPager.setOffscreenPageLimit(MODE_TOTAL - 1);
    mViewPager.setAdapter(new AudioPagerAdapter(mLists, titles));
    mFastScroller = v.findViewById(R.id.songs_fast_scroller);
    mViewPager.setOnTouchListener(mSwipeFilter);
    mTabLayout = v.findViewById(R.id.sliding_tabs);
    mTabLayout.setupWithViewPager(mViewPager);
    mSwipeRefreshLayout = v.findViewById(R.id.swipeLayout);
    mSwipeRefreshLayout.setOnRefreshListener(this);
    mSearchButtonView = v.findViewById(R.id.searchButton);
    return v;
}
Also used : ContextMenuRecyclerView(org.videolan.vlc.gui.view.ContextMenuRecyclerView) View(android.view.View) ContextMenuRecyclerView(org.videolan.vlc.gui.view.ContextMenuRecyclerView) RecyclerView(android.support.v7.widget.RecyclerView)

Example 7 with ContextMenuRecyclerView

use of org.videolan.vlc.gui.view.ContextMenuRecyclerView in project vlc-android by GeoffreyMetais.

the class AudioBrowserFragment method onActivityCreated.

@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    for (int i = 0; i < MODE_TOTAL; i++) mLists[i] = (ContextMenuRecyclerView) mViewPager.getChildAt(i);
    final String[] titles = new String[] { getString(R.string.artists), getString(R.string.albums), getString(R.string.songs), getString(R.string.genres), getString(R.string.playlists) };
    mViewPager.setOffscreenPageLimit(MODE_TOTAL - 1);
    mViewPager.setAdapter(new AudioPagerAdapter(mLists, titles));
    mViewPager.setCurrentItem(VLCApplication.getSettings().getInt(Constants.KEY_AUDIO_CURRENT_TAB, 0));
    final RecyclerView.RecycledViewPool rvp = new RecyclerView.RecycledViewPool();
    for (int i = 0; i < MODE_TOTAL; ++i) {
        final LinearLayoutManager llm = new LinearLayoutManager(getActivity());
        llm.setRecycleChildrenOnDetach(true);
        mLists[i].setLayoutManager(llm);
        mLists[i].setRecycledViewPool(rvp);
        mLists[i].setAdapter(mAdapters[i]);
    }
    mViewPager.setOnTouchListener(mSwipeFilter);
    setupTabLayout();
    mSwipeRefreshLayout.setOnRefreshListener(this);
    setupObservers();
}
Also used : ContextMenuRecyclerView(org.videolan.vlc.gui.view.ContextMenuRecyclerView) ContextMenuRecyclerView(org.videolan.vlc.gui.view.ContextMenuRecyclerView) RecyclerView(android.support.v7.widget.RecyclerView) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager)

Example 8 with ContextMenuRecyclerView

use of org.videolan.vlc.gui.view.ContextMenuRecyclerView in project vlc-android by GeoffreyMetais.

the class SearchActivity method initializeLists.

private void initializeLists() {
    int count = mBinding.resultsContainer.getChildCount();
    final LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    for (int i = 0; i < count; ++i) {
        View v = mBinding.resultsContainer.getChildAt(i);
        if (v instanceof ContextMenuRecyclerView) {
            ((RecyclerView) v).setAdapter(new SearchResultAdapter(inflater));
            ((RecyclerView) v).setLayoutManager(new LinearLayoutManager(this));
            ((SearchResultAdapter) ((RecyclerView) v).getAdapter()).setClickHandler(mClickHandler);
        }
    }
}
Also used : ContextMenuRecyclerView(org.videolan.vlc.gui.view.ContextMenuRecyclerView) LayoutInflater(android.view.LayoutInflater) ContextMenuRecyclerView(org.videolan.vlc.gui.view.ContextMenuRecyclerView) RecyclerView(android.support.v7.widget.RecyclerView) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) View(android.view.View) ContextMenuRecyclerView(org.videolan.vlc.gui.view.ContextMenuRecyclerView) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView)

Aggregations

RecyclerView (android.support.v7.widget.RecyclerView)8 ContextMenuRecyclerView (org.videolan.vlc.gui.view.ContextMenuRecyclerView)8 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)6 View (android.view.View)4 LayoutInflater (android.view.LayoutInflater)2 TextView (android.widget.TextView)2 ArrayList (java.util.ArrayList)1 List (java.util.List)1 MediaLibraryItem (org.videolan.medialibrary.media.MediaLibraryItem)1