diff options
author | Scott Jackson <daneren2005@gmail.com> | 2013-04-25 21:59:45 -0700 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2013-04-25 21:59:45 -0700 |
commit | 2718330401778f1420b91cb256c89da82047dcbd (patch) | |
tree | d58b83e21915dd242698287e81de9aa8ba673149 /subsonic-android | |
parent | f5b2d1f6af2f96f468577ae943e128b25197f40b (diff) | |
download | dsub-2718330401778f1420b91cb256c89da82047dcbd.tar.gz dsub-2718330401778f1420b91cb256c89da82047dcbd.tar.bz2 dsub-2718330401778f1420b91cb256c89da82047dcbd.zip |
Got rid of extra stuff
Diffstat (limited to 'subsonic-android')
-rw-r--r-- | subsonic-android/src/github/daneren2005/dsub/activity/MainActivity.java | 32 | ||||
-rw-r--r-- | subsonic-android/src/github/daneren2005/dsub/activity/SubsonicActivity.java | 3 |
2 files changed, 16 insertions, 19 deletions
diff --git a/subsonic-android/src/github/daneren2005/dsub/activity/MainActivity.java b/subsonic-android/src/github/daneren2005/dsub/activity/MainActivity.java index fc283310..0074f30a 100644 --- a/subsonic-android/src/github/daneren2005/dsub/activity/MainActivity.java +++ b/subsonic-android/src/github/daneren2005/dsub/activity/MainActivity.java @@ -48,16 +48,14 @@ public class MainActivity extends SubsonicActivity { trackView = (TextView) bottomBar.findViewById(R.id.track_name);
artistView = (TextView) bottomBar.findViewById(R.id.artist_name);
- 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);
- }
+ 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);
}
@Override
@@ -74,7 +72,7 @@ public class MainActivity extends SubsonicActivity { @Override
public void onResume() {
super.onResume();
-
+
final Handler handler = new Handler();
Runnable runnable = new Runnable() {
@Override
@@ -91,7 +89,7 @@ public class MainActivity extends SubsonicActivity { executorService = Executors.newSingleThreadScheduledExecutor();
executorService.scheduleWithFixedDelay(runnable, 0L, 1000L, TimeUnit.MILLISECONDS);
}
-
+
@Override
public void onPause() {
super.onPause();
@@ -117,15 +115,17 @@ public class MainActivity extends SubsonicActivity { @Override
public boolean onCreateOptionsMenu(Menu menu) {
- com.actionbarsherlock.view.MenuInflater menuInflater = getSupportMenuInflater();
- pagerAdapter.onCreateOptionsMenu(menu, menuInflater);
+ if(pagerAdapter != null) {
+ com.actionbarsherlock.view.MenuInflater menuInflater = getSupportMenuInflater();
+ pagerAdapter.onCreateOptionsMenu(menu, menuInflater);
+ }
return true;
}
@Override
public boolean onOptionsItemSelected(com.actionbarsherlock.view.MenuItem item) {
return pagerAdapter.onOptionsItemSelected(item);
}
-
+
private void update() {
if (getDownloadService() == null) {
return;
@@ -138,7 +138,7 @@ public class MainActivity extends SubsonicActivity { getImageLoader().loadImage(coverArtView, null, false, false);
return;
}
-
+
MusicDirectory.Entry song = current.getSong();
trackView.setText(song.getTitle());
artistView.setText(song.getArtist());
diff --git a/subsonic-android/src/github/daneren2005/dsub/activity/SubsonicActivity.java b/subsonic-android/src/github/daneren2005/dsub/activity/SubsonicActivity.java index d0dbdde1..eae6c56a 100644 --- a/subsonic-android/src/github/daneren2005/dsub/activity/SubsonicActivity.java +++ b/subsonic-android/src/github/daneren2005/dsub/activity/SubsonicActivity.java @@ -228,7 +228,6 @@ public class SubsonicActivity extends SherlockFragmentActivity { private SubsonicTabFragment currentFragment;
private List tabs = new ArrayList();
private List frags = new ArrayList();
- private List ids = new ArrayList();
private int currentPosition;
public TabPagerAdapter(SherlockFragmentActivity activity, ViewPager pager) {
@@ -246,7 +245,6 @@ public class SubsonicActivity extends SherlockFragmentActivity { List fragStack = new ArrayList();
fragStack.add(frag);
frags.add(i, fragStack);
- ids.add(i, 0);
if(currentFragment == null) {
currentFragment = (SubsonicTabFragment) frag;
currentFragment.setPrimaryFragment(true);
@@ -329,7 +327,6 @@ public class SubsonicActivity extends SherlockFragmentActivity { currentFragment.setPrimaryFragment(true);
activity.invalidateOptionsMenu();
- ids.add(currentPosition, id);
FragmentTransaction trans = getSupportFragmentManager().beginTransaction();
trans.add(id, fragment);
trans.commit();
|