- don't push current pane to backstack if it was called via back button

- fixes endless loop of while toggling panes
This commit is contained in:
Philipp Schaefer 2013-12-03 13:49:38 +01:00
parent 7140cd41d7
commit 7b69693a3f

View File

@ -370,6 +370,7 @@ public class IITC_Mobile extends Activity implements OnSharedPreferenceChangeLis
// Pop last item from backstack and pretend the relevant menu item was clicked // Pop last item from backstack and pretend the relevant menu item was clicked
if (!mBackStack.isEmpty()) { if (!mBackStack.isEmpty()) {
backStackPop(); backStackPop();
mBackButtonPressed = true;
return; return;
} }
@ -405,8 +406,10 @@ public class IITC_Mobile extends Activity implements OnSharedPreferenceChangeLis
// map pane is top-lvl. clear stack. // map pane is top-lvl. clear stack.
if (pane == Pane.MAP) mBackStack.clear(); if (pane == Pane.MAP) mBackStack.clear();
else mBackStack.push(mCurrentPane); // don't push current pane to backstack if this method was called via back button
else if (!mBackButtonPressed) mBackStack.push(mCurrentPane);
mBackButtonPressed = false;
mCurrentPane = pane; mCurrentPane = pane;
mNavigationHelper.switchTo(pane); mNavigationHelper.switchTo(pane);
} }