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