1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-12 04:25:08 -05:00

Also clear back stack when a new intent arrives.

This should make sure there aren't any old fragment instances in that
case.
This commit is contained in:
Danny Baumann 2013-03-10 12:27:58 +01:00
parent a619a9df93
commit d523caa61b

View File

@ -163,6 +163,7 @@ public class MessageList extends K9FragmentActivity implements MessageListFragme
private MessageListFragment mMessageListFragment; private MessageListFragment mMessageListFragment;
private MessageViewFragment mMessageViewFragment; private MessageViewFragment mMessageViewFragment;
private int mFirstBackStackId = -1;
private Account mAccount; private Account mAccount;
private String mFolderName; private String mFolderName;
@ -238,6 +239,11 @@ public class MessageList extends K9FragmentActivity implements MessageListFragme
setIntent(intent); setIntent(intent);
if (mFirstBackStackId >= 0) {
getSupportFragmentManager().popBackStackImmediate(mFirstBackStackId,
FragmentManager.POP_BACK_STACK_INCLUSIVE);
mFirstBackStackId = -1;
}
removeMessageListFragment(); removeMessageListFragment();
removeMessageViewFragment(); removeMessageViewFragment();
@ -1159,11 +1165,7 @@ public class MessageList extends K9FragmentActivity implements MessageListFragme
@Override @Override
public void onBackStackChanged() { public void onBackStackChanged() {
FragmentManager fragmentManager = getSupportFragmentManager(); findFragments();
mMessageListFragment = (MessageListFragment) fragmentManager.findFragmentById(
R.id.message_list_container);
mMessageViewFragment = (MessageViewFragment) fragmentManager.findFragmentById(
R.id.message_view_container);
if (mDisplayMode == DisplayMode.SPLIT_VIEW) { if (mDisplayMode == DisplayMode.SPLIT_VIEW) {
showMessageViewPlaceHolder(); showMessageViewPlaceHolder();
@ -1213,7 +1215,11 @@ public class MessageList extends K9FragmentActivity implements MessageListFragme
ft.addToBackStack(null); ft.addToBackStack(null);
mMessageListFragment = fragment; mMessageListFragment = fragment;
ft.commit();
int transactionId = ft.commit();
if (transactionId >= 0 && mFirstBackStackId < 0) {
mFirstBackStackId = transactionId;
}
} }
@Override @Override