From 28ebbd481ad38f41211d853bf5eb39b36842be36 Mon Sep 17 00:00:00 2001 From: Jean Chalard Date: Mon, 30 Jun 2014 22:15:36 +0900 Subject: [HW5] Make the word composer package private. Change-Id: I66ed277751272eb3ae2fd5e55e9f3e413970082f --- .../inputmethod/latin/inputlogic/InputLogic.java | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java') diff --git a/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java b/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java index b2af50466..7d3c4230a 100644 --- a/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java +++ b/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java @@ -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. */ -- cgit v1.2.3-83-g751a