diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index b7a822d79..4a18c2b3c 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -650,9 +650,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) { ResearchLogger.getInstance().initDictionary(newSuggest.mDictionaryFacilitator); } - final Suggest oldSuggest = mInputLogic.mSuggest; - mInputLogic.mSuggest = newSuggest; - if (oldSuggest != null) oldSuggest.close(); + mInputLogic.replaceSuggest(newSuggest); refreshPersonalizationDictionarySession(); } diff --git a/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java b/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java index 67e56fd8b..fa7c4b4fc 100644 --- a/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java +++ b/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java @@ -106,6 +106,15 @@ public final class InputLogic { mInputLogicHandler = InputLogicHandler.NULL_HANDLER; } + // Replace the old Suggest with the passed Suggest and close it. + public void replaceSuggest(final Suggest newSuggest) { + final Suggest oldSuggest = mSuggest; + mSuggest = newSuggest; + if (oldSuggest != null) { + oldSuggest.close(); + } + } + /** * Initializes the input logic for input in an editor. *