am 0100a49b: Merge "[HW5] Make the word composer package private."

* commit '0100a49bdd7658814b016fbefe63148e57d6096f':
  [HW5] Make the word composer package private.
main
Ken Wakasa 2014-07-01 09:30:06 +00:00 committed by Android Git Automerger
commit 7f1e6b5979
2 changed files with 20 additions and 11 deletions

View File

@ -686,16 +686,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
final SettingsValues settingsValues = mSettings.getCurrent();
if (settingsValues.mDisplayOrientation != conf.orientation) {
mHandler.startOrientationChanging();
// If !isComposingWord, #commitTyped() is a no-op, but still, it's better to avoid
// the useless IPC of {begin,end}BatchEdit.
if (mInputLogic.mWordComposer.isComposingWord()) {
mInputLogic.mConnection.beginBatchEdit();
// If we had a composition in progress, we need to commit the word so that the
// suggestionsSpan will be added. This will allow resuming on the same suggestions
// after rotation is finished.
mInputLogic.commitTyped(mSettings.getCurrent(), LastComposedWord.NOT_A_SEPARATOR);
mInputLogic.mConnection.endBatchEdit();
}
mInputLogic.onOrientationChange(mSettings.getCurrent());
}
// TODO: Remove this test.
if (!conf.locale.equals(mPersonalizationDictionaryUpdater.getLocale())) {

View File

@ -80,7 +80,8 @@ public final class InputLogic {
private final DictionaryFacilitator mDictionaryFacilitator;
public LastComposedWord mLastComposedWord = LastComposedWord.NOT_A_COMPOSED_WORD;
public final WordComposer mWordComposer;
// This has package visibility so it can be accessed from InputLogicHandler.
/* package */ final WordComposer mWordComposer;
public final RichInputConnection mConnection;
private final RecapitalizeStatus mRecapitalizeStatus = new RecapitalizeStatus();
@ -151,6 +152,23 @@ public final class InputLogic {
startInput(combiningSpec);
}
/**
* Call this when the orientation changes.
* @param settingsValues the current values of the settings.
*/
public void onOrientationChange(final SettingsValues settingsValues) {
// If !isComposingWord, #commitTyped() is a no-op, but still, it's better to avoid
// the useless IPC of {begin,end}BatchEdit.
if (mWordComposer.isComposingWord()) {
mConnection.beginBatchEdit();
// If we had a composition in progress, we need to commit the word so that the
// suggestionsSpan will be added. This will allow resuming on the same suggestions
// after rotation is finished.
commitTyped(settingsValues, LastComposedWord.NOT_A_SEPARATOR);
mConnection.endBatchEdit();
}
}
/**
* Clean up the input logic after input is finished.
*/