aboutsummaryrefslogtreecommitdiff
path: root/subsonic-android/src
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2013-04-18 18:34:24 -0700
committerScott Jackson <daneren2005@gmail.com>2013-04-18 18:34:24 -0700
commitb821a78dbf0db79426a540ea119ef3b29a1c2865 (patch)
tree5b95d0675ac470543ce88847ef05ad7c84374e33 /subsonic-android/src
parentf875b73b57da0156714cde8a2a086821a803daef (diff)
downloaddsub-b821a78dbf0db79426a540ea119ef3b29a1c2865.tar.gz
dsub-b821a78dbf0db79426a540ea119ef3b29a1c2865.tar.bz2
dsub-b821a78dbf0db79426a540ea119ef3b29a1c2865.zip
Fix redefining tabs when reopening activity
Diffstat (limited to 'subsonic-android/src')
-rw-r--r--subsonic-android/src/github/daneren2005/dsub/activity/MainActivity.java16
1 files changed, 9 insertions, 7 deletions
diff --git a/subsonic-android/src/github/daneren2005/dsub/activity/MainActivity.java b/subsonic-android/src/github/daneren2005/dsub/activity/MainActivity.java
index 0240d5a3..fc283310 100644
--- a/subsonic-android/src/github/daneren2005/dsub/activity/MainActivity.java
+++ b/subsonic-android/src/github/daneren2005/dsub/activity/MainActivity.java
@@ -48,14 +48,16 @@ public class MainActivity extends SubsonicActivity {
trackView = (TextView) bottomBar.findViewById(R.id.track_name);
artistView = (TextView) bottomBar.findViewById(R.id.artist_name);
- viewPager = (ViewPager) findViewById(R.id.pager);
- pagerAdapter = new TabPagerAdapter(this, viewPager);
- viewPager.setAdapter(pagerAdapter);
- viewPager.setOnPageChangeListener(pagerAdapter);
+ if (savedInstanceState == null) {
+ viewPager = (ViewPager) findViewById(R.id.pager);
+ pagerAdapter = new TabPagerAdapter(this, viewPager);
+ viewPager.setAdapter(pagerAdapter);
+ viewPager.setOnPageChangeListener(pagerAdapter);
- addTab("Home", MainFragment.class, null);
- addTab("Library", SelectArtistFragment.class, null);
- addTab("Playlists", SelectPlaylistFragment.class, null);
+ addTab("Home", MainFragment.class, null);
+ addTab("Library", SelectArtistFragment.class, null);
+ addTab("Playlists", SelectPlaylistFragment.class, null);
+ }
}
@Override