[Android] Simpler lists init
Geoffrey Métais
git at videolan.org
Fri Feb 27 15:12:57 CET 2015
vlc-ports/android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Fri Feb 27 15:12:31 2015 +0100| [587fc5596ff57d49d85b70428a3514b66cb89577] | committer: Geoffrey Métais
Simpler lists init
> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=587fc5596ff57d49d85b70428a3514b66cb89577
---
vlc-android/src/org/videolan/vlc/gui/AboutFragment.java | 6 +++---
.../org/videolan/vlc/gui/audio/AudioAlbumsSongsFragment.java | 5 ++---
.../src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java | 10 +++-------
.../src/org/videolan/vlc/gui/audio/AudioPagerAdapter.java | 5 +++--
4 files changed, 11 insertions(+), 15 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/gui/AboutFragment.java b/vlc-android/src/org/videolan/vlc/gui/AboutFragment.java
index 8e0ae90..acdc263 100644
--- a/vlc-android/src/org/videolan/vlc/gui/AboutFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/AboutFragment.java
@@ -46,6 +46,8 @@ import org.videolan.vlc.gui.audio.AudioPagerAdapter;
import org.videolan.vlc.util.Util;
import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
public class AboutFragment extends Fragment {
public final static String TAG = "VLC/AboutActivity";
@@ -92,9 +94,7 @@ public class AboutFragment extends Fragment {
}
});
- ArrayList<View> lists = new ArrayList<View>();
- lists.add(aboutMain);
- lists.add(t);
+ List<View> lists = Arrays.asList(aboutMain, t);
String[] titles = new String[] {getString(R.string.about), getString(R.string.licence)};
mViewPager = (ViewPager) v.findViewById(R.id.pager);
mViewPager.setOffscreenPageLimit(MODE_TOTAL-1);
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 5ef5f05..f5c262b 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioAlbumsSongsFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioAlbumsSongsFragment.java
@@ -60,6 +60,7 @@ import org.videolan.vlc.util.Util;
import org.videolan.vlc.util.VLCRunnable;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collections;
import java.util.List;
@@ -121,9 +122,7 @@ public class AudioAlbumsSongsFragment extends BrowserFragment implements SwipeRe
ListView albumsList = (ListView) v.findViewById(R.id.albums);
ListView songsList = (ListView) v.findViewById(R.id.songs);
- ArrayList<View> lists = new ArrayList<View>();
- lists.add(albumsList);
- lists.add(songsList);
+ List<View> lists = Arrays.asList((View)albumsList, songsList);
String[] titles = new String[] {getString(R.string.albums), getString(R.string.songs)};
mViewPager = (ViewPager) v.findViewById(R.id.pager);
mViewPager.setOffscreenPageLimit(MODE_TOTAL-1);
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 f50edb6..77fbfd6 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java
@@ -65,6 +65,7 @@ import org.videolan.vlc.util.VLCRunnable;
import org.videolan.vlc.util.WeakHandler;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.ConcurrentLinkedQueue;
@@ -87,7 +88,7 @@ public class AudioBrowserFragment extends BrowserFragment implements SwipeRefres
private ViewPager mViewPager;
private SlidingTabLayout mSlidingTabLayout;
private View mEmptyView;
- private ArrayList<View> mLists;
+ private List<View> mLists;
public final static int MODE_ARTIST = 0;
public final static int MODE_ALBUM = 1;
@@ -137,12 +138,7 @@ public class AudioBrowserFragment extends BrowserFragment implements SwipeRefres
albumList.setAdapter(mAlbumsAdapter);
genreList.setAdapter(mGenresAdapter);
-
- mLists = new ArrayList<View>();
- mLists.add(artistList);
- mLists.add(albumList);
- mLists.add(songsList);
- mLists.add(genreList);
+ mLists = Arrays.asList((View)artistList, albumList, songsList, genreList);
String[] titles = new String[] {getString(R.string.artists), getString(R.string.albums),
getString(R.string.songs), getString(R.string.genres)};
mViewPager = (ViewPager) v.findViewById(R.id.pager);
diff --git a/vlc-android/src/org/videolan/vlc/gui/audio/AudioPagerAdapter.java b/vlc-android/src/org/videolan/vlc/gui/audio/AudioPagerAdapter.java
index 131c57f..2523af1 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioPagerAdapter.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioPagerAdapter.java
@@ -28,13 +28,14 @@ import android.view.View;
import android.view.ViewGroup;
import java.util.ArrayList;
+import java.util.List;
public class AudioPagerAdapter extends PagerAdapter {
- private ArrayList<View> mLists;
+ private List<View> mLists;
private String[] mTitles;
- public AudioPagerAdapter(ArrayList<View> lists, String[] titles){
+ public AudioPagerAdapter(List<View> lists, String[] titles){
mLists = lists;
mTitles = titles;
}
More information about the Android
mailing list