[Android] XML factorization for TabLayout
Geoffrey Métais
git at videolan.org
Mon Jun 15 15:31:56 CEST 2015
vlc-ports/android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Mon Jun 15 14:46:00 2015 +0200| [ecd387d3e608e3b24fc60e2ecd3b52b028e3b4c1] | committer: Geoffrey Métais
XML factorization for TabLayout
> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=ecd387d3e608e3b24fc60e2ecd3b52b028e3b4c1
---
vlc-android/res/layout/about.xml | 10 +---------
vlc-android/res/layout/audio_albums_songs.xml | 10 +---------
vlc-android/res/layout/audio_browser.xml | 9 +--------
vlc-android/res/layout/tab_layout.xml | 11 +++++++++++
vlc-android/src/org/videolan/vlc/gui/AboutFragment.java | 1 -
.../videolan/vlc/gui/audio/AudioAlbumsSongsFragment.java | 1 -
.../org/videolan/vlc/gui/audio/AudioBrowserFragment.java | 1 -
7 files changed, 14 insertions(+), 29 deletions(-)
diff --git a/vlc-android/res/layout/about.xml b/vlc-android/res/layout/about.xml
index cf5c556..911a0eb 100644
--- a/vlc-android/res/layout/about.xml
+++ b/vlc-android/res/layout/about.xml
@@ -1,18 +1,10 @@
<?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" >
- <android.support.design.widget.TabLayout
- android:id="@+id/sliding_tabs"
- android:layout_width="match_parent"
- 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"/>
+ <include layout="@layout/tab_layout" />
<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 7ac98c2..00ab80f 100644
--- a/vlc-android/res/layout/audio_albums_songs.xml
+++ b/vlc-android/res/layout/audio_albums_songs.xml
@@ -1,19 +1,11 @@
<?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" >
- <android.support.design.widget.TabLayout
- android:id="@+id/sliding_tabs"
- android:layout_width="match_parent"
- 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"/>
+ <include layout="@layout/tab_layout" />
<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 eeee49f..8534333 100644
--- a/vlc-android/res/layout/audio_browser.xml
+++ b/vlc-android/res/layout/audio_browser.xml
@@ -5,14 +5,7 @@
android:layout_width="fill_parent"
android:layout_height="fill_parent">
- <android.support.design.widget.TabLayout
- android:id="@+id/sliding_tabs"
- android:layout_width="match_parent"
- 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"/>
+ <include layout="@layout/tab_layout" />
<TextView
android:id="@+id/no_media"
diff --git a/vlc-android/res/layout/tab_layout.xml b/vlc-android/res/layout/tab_layout.xml
new file mode 100644
index 0000000..a03c138
--- /dev/null
+++ b/vlc-android/res/layout/tab_layout.xml
@@ -0,0 +1,11 @@
+<android.support.design.widget.TabLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ android:id="@+id/sliding_tabs"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:background="?attr/background_actionbar"
+ app:tabMode="scrollable"
+ app:tabSelectedTextColor="?attr/font_actionbar_selected"
+ app:tabTextColor="?attr/font_actionbar"
+ app:tabIndicatorColor="?attr/font_actionbar_selected"/>
\ No newline at end of file
diff --git a/vlc-android/src/org/videolan/vlc/gui/AboutFragment.java b/vlc-android/src/org/videolan/vlc/gui/AboutFragment.java
index a95f392..7c5d35d 100644
--- a/vlc-android/src/org/videolan/vlc/gui/AboutFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/AboutFragment.java
@@ -98,7 +98,6 @@ public class AboutFragment extends Fragment {
mTabLayout = (TabLayout) v.findViewById(R.id.sliding_tabs);
mTabLayout.setupWithViewPager(mViewPager);
- 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 3fd1606..deb9cd5 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,6 @@ public class AudioAlbumsSongsFragment extends Fragment implements SwipeRefreshLa
mViewPager.setOnTouchListener(mSwipeFilter);
TabLayout mTabLayout = (TabLayout) v.findViewById(R.id.sliding_tabs);
- 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 d04534d..7676b33 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java
@@ -167,7 +167,6 @@ public class AudioBrowserFragment extends MediaBrowserFragment implements SwipeR
mTabLayout = (TabLayout) v.findViewById(R.id.sliding_tabs);
mTabLayout.setupWithViewPager(mViewPager);
- mTabLayout.setTabMode(TabLayout.MODE_SCROLLABLE);
mViewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(mTabLayout));
mTabLayout.setOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
More information about the Android
mailing list