Commit 1377e9e2 authored by Geoffrey Métais's avatar Geoffrey Métais
Browse files

Factorize layout of audio lists

parent 314b61c2
......@@ -17,37 +17,8 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<org.videolan.vlc.gui.view.ContextMenuRecyclerView
android:id="@+id/albums"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:nestedScrollingEnabled="true"
android:clipToPadding="false"
android:scrollbars="none"
android:paddingBottom="@dimen/listview_bottom_padding"
android:paddingLeft="20dp"
android:paddingRight="20dp"
android:nextFocusUp="@+id/ml_menu_search"
android:nextFocusDown="@id/albums"
android:nextFocusLeft="@id/albums"
android:nextFocusRight="@id/albums"
style="@style/Theme.VLC.List" />
<org.videolan.vlc.gui.view.ContextMenuRecyclerView
android:id="@+id/songs"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
android:scrollbars="none"
android:nestedScrollingEnabled="true"
android:paddingBottom="@dimen/listview_bottom_padding"
android:paddingLeft="20dp"
android:paddingRight="20dp"
android:nextFocusUp="@+id/ml_menu_search"
android:nextFocusDown="@id/songs"
android:nextFocusLeft="@id/songs"
android:nextFocusRight="@id/songs"
style="@style/Theme.VLC.List" />
<include layout="@layout/audio_recyclerview" />
<include layout="@layout/audio_recyclerview" />
</android.support.v4.view.ViewPager>
</org.videolan.vlc.gui.view.SwipeRefreshLayout>
<org.videolan.vlc.gui.view.FastScroller
......
......@@ -41,47 +41,11 @@
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="match_parent">
<org.videolan.vlc.gui.view.ContextMenuRecyclerView
android:id="@+id/artists_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
android:paddingLeft="20dp"
android:paddingRight="20dp"
android:scrollbars="none" />
<org.videolan.vlc.gui.view.ContextMenuRecyclerView
android:id="@+id/albums_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
android:paddingLeft="20dp"
android:paddingRight="20dp"
android:scrollbars="none" />
<org.videolan.vlc.gui.view.ContextMenuRecyclerView
android:id="@+id/songs_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
android:paddingLeft="20dp"
android:paddingRight="20dp"
android:scrollbars="none" />
<org.videolan.vlc.gui.view.ContextMenuRecyclerView
android:id="@+id/genres_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
android:paddingLeft="20dp"
android:paddingRight="20dp"
android:scrollbars="none" />
<org.videolan.vlc.gui.view.ContextMenuRecyclerView
android:id="@+id/playlists_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
android:paddingLeft="20dp"
android:paddingRight="20dp"
android:scrollbars="none" />
<include layout="@layout/audio_recyclerview" />
<include layout="@layout/audio_recyclerview" />
<include layout="@layout/audio_recyclerview" />
<include layout="@layout/audio_recyclerview" />
<include layout="@layout/audio_recyclerview" />
</android.support.v4.view.ViewPager>
</org.videolan.vlc.gui.view.SwipeRefreshLayout>
<org.videolan.vlc.gui.view.FastScroller
......
<?xml version="1.0" encoding="utf-8"?>
<org.videolan.vlc.gui.view.ContextMenuRecyclerView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
android:paddingLeft="20dp"
android:paddingRight="20dp"
android:scrollbars="none" />
\ No newline at end of file
......@@ -109,8 +109,9 @@ public class AudioAlbumsSongsFragment extends BaseAudioBrowser implements SwipeR
View v = inflater.inflate(R.layout.audio_albums_songs, container, false);
ContextMenuRecyclerView albumsList = (ContextMenuRecyclerView) v.findViewById(R.id.albums);
ContextMenuRecyclerView songsList = (ContextMenuRecyclerView) v.findViewById(R.id.songs);
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)};
......@@ -119,7 +120,6 @@ public class AudioAlbumsSongsFragment extends BaseAudioBrowser implements SwipeR
songsList.setAdapter(mSongsAdapter);
albumsList.setAdapter(mAlbumsAdapter);
mViewPager = (ViewPager) v.findViewById(R.id.pager);
mViewPager.setOffscreenPageLimit(MODE_TOTAL - 1);
mViewPager.setAdapter(new AudioPagerAdapter(mLists, titles));
......
......@@ -127,19 +127,14 @@ public class AudioBrowserFragment extends BaseAudioBrowser implements DevicesDis
mEmptyView = (TextView) v.findViewById(R.id.no_media);
ContextMenuRecyclerView songsList = (ContextMenuRecyclerView)v.findViewById(R.id.songs_list);
ContextMenuRecyclerView artistList = (ContextMenuRecyclerView)v.findViewById(R.id.artists_list);
ContextMenuRecyclerView albumList = (ContextMenuRecyclerView)v.findViewById(R.id.albums_list);
ContextMenuRecyclerView genreList = (ContextMenuRecyclerView)v.findViewById(R.id.genres_list);
ContextMenuRecyclerView playlistsList = (ContextMenuRecyclerView)v.findViewById(R.id.playlists_list);
mViewPager = (ViewPager) v.findViewById(R.id.pager);
mFastScroller = (FastScroller) v.findViewById(R.id.songs_fast_scroller);
mLists = new ContextMenuRecyclerView[]{artistList, albumList, songsList, genreList, playlistsList};
mLists = new ContextMenuRecyclerView[MODE_TOTAL];
for (int i = 0; i < MODE_TOTAL; i++)
mLists[i] = (ContextMenuRecyclerView) mViewPager.getChildAt(i);
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 = (ViewPager) v.findViewById(R.id.pager);
mViewPager.setOffscreenPageLimit(MODE_TOTAL - 1);
mViewPager.setAdapter(new AudioPagerAdapter(mLists, titles));
......@@ -157,7 +152,7 @@ public class AudioBrowserFragment extends BaseAudioBrowser implements DevicesDis
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
RecyclerView.RecycledViewPool rvp = new RecyclerView.RecycledViewPool();
for (int i = 0; i< mLists.length; ++i) {
for (int i = 0; i< MODE_TOTAL; ++i) {
LinearLayoutManager llm = new LinearLayoutManager(getActivity());
llm.setRecycleChildrenOnDetach(true);
mLists[i].setLayoutManager(llm);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment