[CB07] Small refactoring

Bug: 8689779
Change-Id: I2cf10c690c7e4a9c6bf27211d1fccc1f9d4a9249
This commit is contained in:
Jean Chalard 2014-03-14 21:21:25 +09:00
parent 5eac728b4a
commit 1110adad11
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) {
ResearchLogger.getInstance().initDictionary(newSuggest.mDictionaryFacilitator);
}
final Suggest oldSuggest = mInputLogic.mSuggest;
mInputLogic.mSuggest = newSuggest;
if (oldSuggest != null) oldSuggest.close();
mInputLogic.replaceSuggest(newSuggest);
refreshPersonalizationDictionarySession();
}

View file

@ -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.
*