aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/github/daneren2005/dsub/activity/SubsonicActivity.java12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/github/daneren2005/dsub/activity/SubsonicActivity.java b/src/github/daneren2005/dsub/activity/SubsonicActivity.java
index 5bb75657..bae3273c 100644
--- a/src/github/daneren2005/dsub/activity/SubsonicActivity.java
+++ b/src/github/daneren2005/dsub/activity/SubsonicActivity.java
@@ -393,6 +393,7 @@ public class SubsonicActivity extends ActionBarActivity implements OnItemSelecte
private List<List<SubsonicFragment>> frags = new ArrayList<List<SubsonicFragment>>();
private List<QueuedFragment> queue = new ArrayList<QueuedFragment>();
private int currentPosition;
+ private boolean dontRecreate = false;
public TabPagerAdapter(ActionBarActivity activity, ViewPager pager) {
super(activity.getSupportFragmentManager());
@@ -429,15 +430,18 @@ public class SubsonicActivity extends ActionBarActivity implements OnItemSelecte
}
public void onCreateOptionsMenu(Menu menu, MenuInflater menuInflater) {
- if(currentFragment != null) {
- currentFragment.onCreateOptionsMenu(menu, menuInflater);
-
+ if(currentFragment != null && !dontRecreate) {
for(QueuedFragment addFragment: queue) {
+ // Let Pager know not to try to create options menu in replaceFragment
+ dontRecreate = true;
replaceFragment(addFragment.fragment, addFragment.id, currentFragment.getSupportTag());
currentFragment = addFragment.fragment;
}
- currentFragment.setPrimaryFragment(true);
+ dontRecreate = false;
queue.clear();
+
+ currentFragment.setPrimaryFragment(true);
+ currentFragment.onCreateOptionsMenu(menu, menuInflater);
}
}
public boolean onOptionsItemSelected(MenuItem item) {