[Android] AudioAlbumSongs: move to TabLayout

Jean-Baptiste Kempf git at videolan.org
Mon Jun 15 11:45:22 CEST 2015


vlc-ports/android | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Sat Jun 13 01:18:38 2015 +0200| [e217905cc5744623fd6913f9ff2d8c3bb9a82b6d] | committer: Geoffrey Métais

AudioAlbumSongs: move to TabLayout

> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=e217905cc5744623fd6913f9ff2d8c3bb9a82b6d
---

 vlc-android/res/layout/audio_albums_songs.xml               |    2 +-
 .../videolan/vlc/gui/audio/AudioAlbumsSongsFragment.java    |   11 +++++------
 2 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/vlc-android/res/layout/audio_albums_songs.xml b/vlc-android/res/layout/audio_albums_songs.xml
index ef74b84..0986f13 100644
--- a/vlc-android/res/layout/audio_albums_songs.xml
+++ b/vlc-android/res/layout/audio_albums_songs.xml
@@ -5,7 +5,7 @@
     android:layout_width="fill_parent"
     android:layout_height="fill_parent" >
 
-    <com.android.widget.SlidingTabLayout
+    <android.support.design.widget.TabLayout
         android:id="@+id/sliding_tabs"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"/>
diff --git a/vlc-android/src/org/videolan/vlc/gui/audio/AudioAlbumsSongsFragment.java b/vlc-android/src/org/videolan/vlc/gui/audio/AudioAlbumsSongsFragment.java
index f23c144..d0dbab3 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioAlbumsSongsFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioAlbumsSongsFragment.java
@@ -28,6 +28,7 @@ import android.os.Bundle;
 import android.os.Handler;
 import android.os.Message;
 import android.support.design.widget.Snackbar;
+import android.support.design.widget.TabLayout;
 import android.support.v4.app.Fragment;
 import android.support.v4.view.ViewPager;
 import android.view.ContextMenu;
@@ -46,8 +47,7 @@ import android.widget.AdapterView.OnItemClickListener;
 import android.widget.ListView;
 import android.widget.PopupMenu;
 import android.widget.PopupMenu.OnMenuItemClickListener;
-
-import com.android.widget.SlidingTabLayout;
+import android.widget.TextView;
 
 import org.videolan.libvlc.util.AndroidUtil;
 import org.videolan.vlc.MediaLibrary;
@@ -134,10 +134,9 @@ public class AudioAlbumsSongsFragment extends Fragment implements SwipeRefreshLa
         mViewPager.setAdapter(new AudioPagerAdapter(lists, titles));
 
         mViewPager.setOnTouchListener(mSwipeFilter);
-        SlidingTabLayout mSlidingTabLayout = (SlidingTabLayout) v.findViewById(R.id.sliding_tabs);
-        mSlidingTabLayout.setCustomTabView(R.layout.tab_layout, R.id.tab_title);
-        mSlidingTabLayout.setDistributeEvenly(true);
-        mSlidingTabLayout.setViewPager(mViewPager);
+        TabLayout mSlidingTabLayout = (TabLayout) v.findViewById(R.id.sliding_tabs);
+        mSlidingTabLayout.setTabMode(TabLayout.MODE_FIXED);
+        mSlidingTabLayout.setupWithViewPager(mViewPager);
 
         songsList.setAdapter(mSongsAdapter);
         albumsList.setAdapter(mAlbumsAdapter);



More information about the Android mailing list