[Android] Restore tabs appearance and fix selection

Geoffrey Métais git at videolan.org
Mon Jun 15 11:45:23 CEST 2015


vlc-ports/android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Mon Jun 15 11:42:01 2015 +0200| [6c2f1271e67d07133886ae0c7dc7052dfcef6142] | committer: Geoffrey Métais

Restore tabs appearance and fix selection

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

 vlc-android/res/layout/about.xml                                |    7 ++++++-
 vlc-android/res/layout/audio_albums_songs.xml                   |    7 ++++++-
 vlc-android/res/layout/audio_browser.xml                        |    6 +++++-
 vlc-android/src/org/videolan/vlc/gui/AboutFragment.java         |    2 +-
 .../org/videolan/vlc/gui/audio/AudioAlbumsSongsFragment.java    |    2 +-
 .../src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java    |    7 +++++--
 6 files changed, 24 insertions(+), 7 deletions(-)

diff --git a/vlc-android/res/layout/about.xml b/vlc-android/res/layout/about.xml
index 4ac4c93..cf5c556 100644
--- a/vlc-android/res/layout/about.xml
+++ b/vlc-android/res/layout/about.xml
@@ -1,5 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
     android:id="@android:id/tabcontent"
     android:layout_width="fill_parent"
     android:layout_height="fill_parent" >
@@ -7,7 +8,11 @@
     <android.support.design.widget.TabLayout
         android:id="@+id/sliding_tabs"
         android:layout_width="match_parent"
-        android:layout_height="wrap_content"/>
+        android:layout_height="wrap_content"
+        android:background="?attr/background_actionbar"
+        app:tabSelectedTextColor="?attr/font_actionbar_selected"
+        app:tabTextColor="?attr/font_actionbar"
+        app:tabIndicatorColor="?attr/font_actionbar_selected"/>
 
         <android.support.v4.view.ViewPager
             android:id="@+id/pager"
diff --git a/vlc-android/res/layout/audio_albums_songs.xml b/vlc-android/res/layout/audio_albums_songs.xml
index 0986f13..7ac98c2 100644
--- a/vlc-android/res/layout/audio_albums_songs.xml
+++ b/vlc-android/res/layout/audio_albums_songs.xml
@@ -1,6 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 
 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
     android:id="@android:id/tabcontent"
     android:layout_width="fill_parent"
     android:layout_height="fill_parent" >
@@ -8,7 +9,11 @@
     <android.support.design.widget.TabLayout
         android:id="@+id/sliding_tabs"
         android:layout_width="match_parent"
-        android:layout_height="wrap_content"/>
+        android:layout_height="wrap_content"
+        android:background="?attr/background_actionbar"
+        app:tabSelectedTextColor="?attr/font_actionbar_selected"
+        app:tabTextColor="?attr/font_actionbar"
+        app:tabIndicatorColor="?attr/font_actionbar_selected"/>
 
     <org.videolan.vlc.widget.SwipeRefreshLayout
         android:id="@+id/swipeLayout"
diff --git a/vlc-android/res/layout/audio_browser.xml b/vlc-android/res/layout/audio_browser.xml
index 9d1beaa..eeee49f 100644
--- a/vlc-android/res/layout/audio_browser.xml
+++ b/vlc-android/res/layout/audio_browser.xml
@@ -8,7 +8,11 @@
     <android.support.design.widget.TabLayout
         android:id="@+id/sliding_tabs"
         android:layout_width="match_parent"
-        android:layout_height="wrap_content"/>
+        android:layout_height="wrap_content"
+        android:background="?attr/background_actionbar"
+        app:tabSelectedTextColor="?attr/font_actionbar_selected"
+        app:tabTextColor="?attr/font_actionbar"
+        app:tabIndicatorColor="?attr/font_actionbar_selected"/>
 
     <TextView
         android:id="@+id/no_media"
diff --git a/vlc-android/src/org/videolan/vlc/gui/AboutFragment.java b/vlc-android/src/org/videolan/vlc/gui/AboutFragment.java
index 8b0763d..a95f392 100644
--- a/vlc-android/src/org/videolan/vlc/gui/AboutFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/AboutFragment.java
@@ -98,7 +98,7 @@ public class AboutFragment extends Fragment {
 
         mTabLayout = (TabLayout) v.findViewById(R.id.sliding_tabs);
         mTabLayout.setupWithViewPager(mViewPager);
-        mTabLayout.setTabMode(TabLayout.MODE_FIXED);
+        mTabLayout.setTabMode(TabLayout.MODE_SCROLLABLE);
 
         return v;
     }
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 5e898c1..3fd1606 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioAlbumsSongsFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioAlbumsSongsFragment.java
@@ -135,7 +135,7 @@ public class AudioAlbumsSongsFragment extends Fragment implements SwipeRefreshLa
 
         mViewPager.setOnTouchListener(mSwipeFilter);
         TabLayout mTabLayout = (TabLayout) v.findViewById(R.id.sliding_tabs);
-        mTabLayout.setTabMode(TabLayout.MODE_FIXED);
+        mTabLayout.setTabMode(TabLayout.MODE_SCROLLABLE);
         mTabLayout.setupWithViewPager(mViewPager);
 
         songsList.setAdapter(mSongsAdapter);
diff --git a/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java b/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java
index a911b3a..d04534d 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java
@@ -167,12 +167,13 @@ public class AudioBrowserFragment extends MediaBrowserFragment implements SwipeR
 
         mTabLayout = (TabLayout) v.findViewById(R.id.sliding_tabs);
         mTabLayout.setupWithViewPager(mViewPager);
-        mTabLayout.setTabMode(TabLayout.MODE_FIXED);
+        mTabLayout.setTabMode(TabLayout.MODE_SCROLLABLE);
 
         mViewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(mTabLayout));
         mTabLayout.setOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
             @Override
             public void onTabSelected(TabLayout.Tab tab) {
+                mViewPager.setCurrentItem(tab.getPosition());
                 updateEmptyView(tab.getPosition());
                 setFabPlayShuffleAllVisibility();
             }
@@ -181,7 +182,9 @@ public class AudioBrowserFragment extends MediaBrowserFragment implements SwipeR
             public void onTabUnselected(TabLayout.Tab tab) {}
 
             @Override
-            public void onTabReselected(TabLayout.Tab tab) {}
+            public void onTabReselected(TabLayout.Tab tab) {
+                mViewPager.setCurrentItem(tab.getPosition());
+            }
         });
 
         songsList.setOnItemClickListener(songListener);



More information about the Android mailing list