[Android] [PATCH 1/7] AboutDialog: move to TabLayout
Jean-Baptiste Kempf
jb at videolan.org
Sat Jun 13 01:18:36 CEST 2015
---
vlc-android/res/layout/about.xml | 2 +-
vlc-android/src/org/videolan/vlc/gui/AboutFragment.java | 12 +++++-------
2 files changed, 6 insertions(+), 8 deletions(-)
diff --git a/vlc-android/res/layout/about.xml b/vlc-android/res/layout/about.xml
index 266144c..4ac4c93 100644
--- a/vlc-android/res/layout/about.xml
+++ b/vlc-android/res/layout/about.xml
@@ -4,7 +4,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/AboutFragment.java b/vlc-android/src/org/videolan/vlc/gui/AboutFragment.java
index cd15c5f..f926e2c 100644
--- a/vlc-android/src/org/videolan/vlc/gui/AboutFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/AboutFragment.java
@@ -21,6 +21,7 @@
package org.videolan.vlc.gui;
import android.os.Bundle;
+import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
@@ -37,8 +38,6 @@ import android.webkit.WebView;
import android.widget.ImageView;
import android.widget.TextView;
-import com.android.widget.SlidingTabLayout;
-
import org.videolan.vlc.BuildConfig;
import org.videolan.vlc.R;
import org.videolan.vlc.gui.audio.AudioPagerAdapter;
@@ -55,7 +54,7 @@ public class AboutFragment extends Fragment {
public final static int MODE_TOTAL = 2; // Number of audio browser modes
private ViewPager mViewPager;
- private SlidingTabLayout mSlidingTabLayout;
+ private TabLayout mSlidingTabLayout;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
@@ -97,10 +96,9 @@ public class AboutFragment extends Fragment {
mViewPager.setOffscreenPageLimit(MODE_TOTAL-1);
mViewPager.setAdapter(new AudioPagerAdapter(lists, titles));
- mSlidingTabLayout = (SlidingTabLayout) v.findViewById(R.id.sliding_tabs);
- mSlidingTabLayout.setCustomTabView(R.layout.tab_layout, R.id.tab_title);
- mSlidingTabLayout.setDistributeEvenly(true);
- mSlidingTabLayout.setViewPager(mViewPager);
+ mSlidingTabLayout = (TabLayout) v.findViewById(R.id.sliding_tabs);
+ mSlidingTabLayout.setupWithViewPager(mViewPager);
+ mSlidingTabLayout.setTabMode(TabLayout.MODE_FIXED);
return v;
}
--
2.4.2
More information about the Android
mailing list