[Android] Audio browser: save and restore the current tab of the AlbumsSongsFragment
Adrien Maglo
git at videolan.org
Thu Dec 12 14:14:34 CET 2013
vlc-ports/android | branch: master | Adrien Maglo <magsoft at videolan.org> | Thu Dec 12 14:14:26 2013 +0100| [9a10a19312b2d5633f7f9b97de62a6b4f1363e65] | committer: Adrien Maglo
Audio browser: save and restore the current tab of the AlbumsSongsFragment
> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=9a10a19312b2d5633f7f9b97de62a6b4f1363e65
---
.../videolan/vlc/gui/audio/AudioAlbumsSongsFragment.java | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
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 b813429..d5e25a5 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioAlbumsSongsFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioAlbumsSongsFragment.java
@@ -61,6 +61,9 @@ public class AudioAlbumsSongsFragment extends SherlockFragment {
private ArrayList<Media> mediaList;
private String mTitle;
+ TabHost mTabHost;
+ private int mCurrentTab = 0;
+
/* All subclasses of Fragment must include a public empty constructor. */
public AudioAlbumsSongsFragment() { }
@@ -89,7 +92,7 @@ public class AudioAlbumsSongsFragment extends SherlockFragment {
View v = inflater.inflate(R.layout.audio_albums_songs, container, false);
- TabHost tabHost = (TabHost) v.findViewById(android.R.id.tabhost);
+ mTabHost = (TabHost) v.findViewById(android.R.id.tabhost);
ListView albumsList = (ListView) v.findViewById(R.id.albums);
ListView songsList = (ListView) v.findViewById(R.id.songs);
@@ -99,10 +102,12 @@ public class AudioAlbumsSongsFragment extends SherlockFragment {
songsList.setOnItemClickListener(songsListener);
albumsList.setOnItemClickListener(albumsListener);
- tabHost.setup();
+ mTabHost.setup();
+
+ addNewTab(mTabHost, "albums", "Albums", R.id.albums);
+ addNewTab(mTabHost, "songs", "Songs", R.id.songs);
- addNewTab(tabHost, "albums", "Albums", R.id.albums);
- addNewTab(tabHost, "songs", "Songs", R.id.songs);
+ mTabHost.setCurrentTab(mCurrentTab);
return v;
}
@@ -124,6 +129,7 @@ public class AudioAlbumsSongsFragment extends SherlockFragment {
@Override
public void onPause() {
super.onPause();
+ mCurrentTab = mTabHost.getCurrentTab();
}
@Override
More information about the Android
mailing list