Search in sources :

Example 1 with ContextMenuRecyclerView

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

the class AudioAlbumsSongsFragment method onViewCreated.

@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    RecyclerView.RecycledViewPool rvp = new RecyclerView.RecycledViewPool();
    for (ContextMenuRecyclerView rv : mLists) {
        rv.setLayoutManager(new LinearLayoutManager(view.getContext()));
        LinearLayoutManager llm = new LinearLayoutManager(getActivity());
        llm.setRecycleChildrenOnDetach(true);
        rv.setLayoutManager(llm);
        rv.setRecycledViewPool(rvp);
    }
    mFabPlay.setImageResource(R.drawable.ic_fab_play);
    mTabLayout.addOnTabSelectedListener(this);
    updateList();
}
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 2 with ContextMenuRecyclerView

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

the class AudioAlbumsSongsFragment method onViewCreated.

@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    RecyclerView.RecycledViewPool rvp = new RecyclerView.RecycledViewPool();
    for (ContextMenuRecyclerView rv : mLists) {
        rv.setLayoutManager(new LinearLayoutManager(view.getContext()));
        final LinearLayoutManager llm = new LinearLayoutManager(getActivity());
        llm.setRecycleChildrenOnDetach(true);
        rv.setLayoutManager(llm);
        rv.setRecycledViewPool(rvp);
    }
    mFabPlay.setImageResource(R.drawable.ic_fab_play);
    mTabLayout.addOnTabSelectedListener(this);
    albumProvider.getSections().observe(this, new Observer<List<MediaLibraryItem>>() {

        @Override
        public void onChanged(@Nullable List<MediaLibraryItem> albums) {
            if (albums != null)
                mAlbumsAdapter.update(albums);
        }
    });
    tracksProvider.getSections().observe(this, new Observer<List<MediaLibraryItem>>() {

        @Override
        public void onChanged(@Nullable List<MediaLibraryItem> tracks) {
            if (tracks != null)
                mSongsAdapter.update(tracks);
        }
    });
}
Also used : ContextMenuRecyclerView(org.videolan.vlc.gui.view.ContextMenuRecyclerView) MediaLibraryItem(org.videolan.medialibrary.media.MediaLibraryItem) ContextMenuRecyclerView(org.videolan.vlc.gui.view.ContextMenuRecyclerView) RecyclerView(android.support.v7.widget.RecyclerView) ArrayList(java.util.ArrayList) List(java.util.List) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager)

Example 3 with ContextMenuRecyclerView

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

the class AudioAlbumsSongsFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.audio_albums_songs, container, false);
    mViewPager = (ViewPager) v.findViewById(R.id.pager);
    ContextMenuRecyclerView albumsList = (ContextMenuRecyclerView) mViewPager.getChildAt(MODE_ALBUM);
    ContextMenuRecyclerView songsList = (ContextMenuRecyclerView) mViewPager.getChildAt(MODE_SONG);
    mLists = new ContextMenuRecyclerView[] { albumsList, songsList };
    String[] titles = new String[] { getString(R.string.albums), getString(R.string.songs) };
    mAlbumsAdapter = new AudioBrowserAdapter(MediaLibraryItem.TYPE_ALBUM, this, true);
    mSongsAdapter = new AudioBrowserAdapter(MediaLibraryItem.TYPE_MEDIA, this, true);
    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 = (FastScroller) v.findViewById(R.id.songs_fast_scroller);
    mViewPager.setOnTouchListener(mSwipeFilter);
    mTabLayout = (TabLayout) v.findViewById(R.id.sliding_tabs);
    mTabLayout.setupWithViewPager(mViewPager);
    mSwipeRefreshLayout = (SwipeRefreshLayout) 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 4 with ContextMenuRecyclerView

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

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);
}
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 5 with ContextMenuRecyclerView

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

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