am 1110adad: [CB07] Small refactoring

* commit '1110adad111547f553bd862f87c9873b5102dd16':
  [CB07] Small refactoring
main
Jean Chalard 2014-03-17 05:59:22 -07:00 committed by Android Git Automerger
commit 17f8a0cfa6
2 changed files with 10 additions and 3 deletions

View File

@ -650,9 +650,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) { if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) {
ResearchLogger.getInstance().initDictionary(newSuggest.mDictionaryFacilitator); ResearchLogger.getInstance().initDictionary(newSuggest.mDictionaryFacilitator);
} }
final Suggest oldSuggest = mInputLogic.mSuggest; mInputLogic.replaceSuggest(newSuggest);
mInputLogic.mSuggest = newSuggest;
if (oldSuggest != null) oldSuggest.close();
refreshPersonalizationDictionarySession(); refreshPersonalizationDictionarySession();
} }

View File

@ -106,6 +106,15 @@ public final class InputLogic {
mInputLogicHandler = InputLogicHandler.NULL_HANDLER; 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. * Initializes the input logic for input in an editor.
* *