aboutsummaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2013-10-22 16:20:02 +0900
committerJean Chalard <jchalard@google.com>2013-10-22 20:16:17 +0900
commitb00ed463851405706a41b1dffe66746c6d2467a1 (patch)
treef13a117e3167d041eb26c35f69711c1349aa9a47 /java/src
parent926ebe849a83c43488bd2bb044b81f39e6b51eef (diff)
downloadlatinime-b00ed463851405706a41b1dffe66746c6d2467a1.tar.gz
latinime-b00ed463851405706a41b1dffe66746c6d2467a1.tar.xz
latinime-b00ed463851405706a41b1dffe66746c6d2467a1.zip
Preliminary refactor
Bug: 11328842 Change-Id: I7c22e951fef9bc4443c6b64625e25f632f876ab1
Diffstat (limited to 'java/src')
-rw-r--r--java/src/com/android/inputmethod/latin/LatinIME.java23
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);