Switch to synchronous transaction.

Change-Id: I02639276e4cedd62d288433acb0dfaf34c7a4e76
This commit is contained in:
Makoto Onuki 2011-06-16 11:40:37 -07:00
parent 78959916e7
commit 2a292e235c
2 changed files with 12 additions and 6 deletions

View File

@ -40,8 +40,8 @@ import java.util.Set;
*
* One one-pane, only at most one fragment can be installed at a time.
*
* Note due to the asynchronous nature of the fragment transaction, there is a window when
* there is no installed or visible fragments.
* Note: Always use {@link #commitFragmentTransaction} to operate fragment transactions,
* so that we can easily switch between synchronous and asynchronous transactions.
*
* Major TODOs
* - TODO Newer/Older for message view with swipe!
@ -497,11 +497,14 @@ class UIControllerOnePane extends UIControllerBase {
}
/**
* Use this instead of {@link FragmentTransaction#commit}. We may switch to the synchronous
* Use this instead of {@link FragmentTransaction#commit}. We may switch to the asynchronous
* transaction some day.
*/
private void commitFragmentTransaction(FragmentTransaction ft) {
ft.commit();
if (!ft.isEmpty()) {
ft.commit();
mActivity.getFragmentManager().executePendingTransactions();
}
}
/**
@ -619,8 +622,8 @@ class UIControllerOnePane extends UIControllerBase {
removeFragment(ft, installed);
ft.attach(mPreviousFragment);
ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_CLOSE);
commitFragmentTransaction(ft);
mPreviousFragment = null;
commitFragmentTransaction(ft);
return;
}

View File

@ -535,7 +535,10 @@ class UIControllerTwoPane extends UIControllerBase implements
if (DEBUG_FRAGMENTS) {
Log.d(Logging.LOG_TAG, this + " commitFragmentTransaction: " + ft);
}
ft.commit();
if (!ft.isEmpty()) {
ft.commit();
mActivity.getFragmentManager().executePendingTransactions();
}
}
/**