Merge "Switch to synchronous transaction."

This commit is contained in:
Makoto Onuki 2011-06-16 11:48:03 -07:00 committed by Android (Google) Code Review
commit c16d060bda
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!
@ -511,11 +511,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();
}
}
/**
@ -633,8 +636,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

@ -527,7 +527,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();
}
}
/**