diff options
author | 2013-10-22 04:32:50 -0700 | |
---|---|---|
committer | 2013-10-22 04:32:50 -0700 | |
commit | ea177b5693c6834abffe4d52b44add46cd71d452 (patch) | |
tree | 069f9d3a86071ea376e32c0c51823478c09f09b6 /java/src | |
parent | dbd87dc2f853fd0680b6b78c1b2a5bc9c084373b (diff) | |
parent | d4b5bc1695036f3f555561d55a4300723daa939d (diff) | |
download | latinime-ea177b5693c6834abffe4d52b44add46cd71d452.tar.gz latinime-ea177b5693c6834abffe4d52b44add46cd71d452.tar.xz latinime-ea177b5693c6834abffe4d52b44add46cd71d452.zip |
am d4b5bc16: Merge "Preliminary refactor"
* commit 'd4b5bc1695036f3f555561d55a4300723daa939d':
Preliminary refactor
Diffstat (limited to 'java/src')
-rw-r--r-- | java/src/com/android/inputmethod/latin/LatinIME.java | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index e43ec8c92..2e22af9f9 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -2517,6 +2517,18 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen } } + private String getPreviousWordForSuggestion(final SettingsValues currentSettings) { + if (currentSettings.mCurrentLanguageHasSpaces) { + // If we are typing in a language with spaces we can just look up the previous + // word from textview. + return mConnection.getNthPreviousWord(currentSettings.mWordSeparators, + mWordComposer.isComposingWord() ? 2 : 1); + } else { + return LastComposedWord.NOT_A_COMPOSED_WORD == mLastComposedWord ? null + : mLastComposedWord.mCommittedWord; + } + } + private void getSuggestedWords(final int sessionId, final int sequenceNumber, final OnGetSuggestedWordsCallback callback) { final Keyboard keyboard = mKeyboardSwitcher.getKeyboard(); @@ -2530,16 +2542,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen // should just skip whitespace if any, so 1. final SettingsValues currentSettings = mSettings.getCurrent(); final int[] additionalFeaturesOptions = currentSettings.mAdditionalFeaturesSettingValues; - final String prevWord; - if (currentSettings.mCurrentLanguageHasSpaces) { - // If we are typing in a language with spaces we can just look up the previous - // word from textview. - prevWord = mConnection.getNthPreviousWord(currentSettings.mWordSeparators, - mWordComposer.isComposingWord() ? 2 : 1); - } else { - prevWord = LastComposedWord.NOT_A_COMPOSED_WORD == mLastComposedWord ? null - : mLastComposedWord.mCommittedWord; - } + final String prevWord = getPreviousWordForSuggestion(currentSettings); suggest.getSuggestedWords(mWordComposer, prevWord, keyboard.getProximityInfo(), currentSettings.mBlockPotentiallyOffensive, currentSettings.mCorrectionEnabled, additionalFeaturesOptions, sessionId, sequenceNumber, callback); |