Merge "Preliminary refactor"
commit
d4b5bc1695
|
@ -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,
|
private void getSuggestedWords(final int sessionId, final int sequenceNumber,
|
||||||
final OnGetSuggestedWordsCallback callback) {
|
final OnGetSuggestedWordsCallback callback) {
|
||||||
final Keyboard keyboard = mKeyboardSwitcher.getKeyboard();
|
final Keyboard keyboard = mKeyboardSwitcher.getKeyboard();
|
||||||
|
@ -2530,16 +2542,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
// should just skip whitespace if any, so 1.
|
// should just skip whitespace if any, so 1.
|
||||||
final SettingsValues currentSettings = mSettings.getCurrent();
|
final SettingsValues currentSettings = mSettings.getCurrent();
|
||||||
final int[] additionalFeaturesOptions = currentSettings.mAdditionalFeaturesSettingValues;
|
final int[] additionalFeaturesOptions = currentSettings.mAdditionalFeaturesSettingValues;
|
||||||
final String prevWord;
|
final String prevWord = getPreviousWordForSuggestion(currentSettings);
|
||||||
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;
|
|
||||||
}
|
|
||||||
suggest.getSuggestedWords(mWordComposer, prevWord, keyboard.getProximityInfo(),
|
suggest.getSuggestedWords(mWordComposer, prevWord, keyboard.getProximityInfo(),
|
||||||
currentSettings.mBlockPotentiallyOffensive, currentSettings.mCorrectionEnabled,
|
currentSettings.mBlockPotentiallyOffensive, currentSettings.mCorrectionEnabled,
|
||||||
additionalFeaturesOptions, sessionId, sequenceNumber, callback);
|
additionalFeaturesOptions, sessionId, sequenceNumber, callback);
|
||||||
|
|
Loading…
Reference in New Issue