aboutsummaryrefslogtreecommitdiff
path: root/src/github
diff options
context:
space:
mode:
authordaneren2005 <daneren2005@gmail.com>2013-09-05 13:50:04 -0700
committerdaneren2005 <daneren2005@gmail.com>2013-09-05 13:50:04 -0700
commit9d47b2bcb2615763896cc07ad010d2ba161e218d (patch)
tree52b427e2b9d0b2a9c425ccd14777532c3e468ec3 /src/github
parent7d7ad14a6695157e2f88b8af2c2ec10d79d1f238 (diff)
downloaddsub-9d47b2bcb2615763896cc07ad010d2ba161e218d.tar.gz
dsub-9d47b2bcb2615763896cc07ad010d2ba161e218d.tar.bz2
dsub-9d47b2bcb2615763896cc07ad010d2ba161e218d.zip
Attempt at fixing Show Album stack overflow: limit options menu create calls
Diffstat (limited to 'src/github')
-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) {