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;
}
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();
}
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);
}
}
}
Aggregations