[IL68] Start refactoring setComposingWord
Bug: 8636060 Change-Id: I242b7c264abf380bcd6b6b3c848238921f988e54main
parent
eb6d41a525
commit
9da4b49ef6
|
@ -16,6 +16,7 @@
|
|||
|
||||
package com.android.inputmethod.latin;
|
||||
|
||||
import com.android.inputmethod.annotations.UsedForTesting;
|
||||
import com.android.inputmethod.keyboard.Key;
|
||||
import com.android.inputmethod.keyboard.Keyboard;
|
||||
import com.android.inputmethod.latin.utils.StringUtils;
|
||||
|
@ -276,6 +277,8 @@ public final class WordComposer {
|
|||
/**
|
||||
* Add a dummy key by retrieving reasonable coordinates
|
||||
*/
|
||||
// TODO: make this private or remove it entirely. Right now it's used in the tests
|
||||
@UsedForTesting
|
||||
public void addKeyInfo(final int codePoint, final Keyboard keyboard) {
|
||||
final int x, y;
|
||||
final Key key;
|
||||
|
|
|
@ -312,11 +312,7 @@ public abstract class AndroidWordLevelSpellCheckerSession extends Session {
|
|||
false /* reportAsTypo */);
|
||||
}
|
||||
final WordComposer composer = new WordComposer();
|
||||
final int length = text.length();
|
||||
for (int i = 0; i < length; i = text.offsetByCodePoints(i, 1)) {
|
||||
final int codePoint = text.codePointAt(i);
|
||||
composer.addKeyInfo(codePoint, dictInfo.getKeyboard(codePoint));
|
||||
}
|
||||
composer.setComposingWord(text, null /* previousWord */, dictInfo.mKeyboard);
|
||||
// TODO: make a spell checker option to block offensive words or not
|
||||
final ArrayList<SuggestedWordInfo> suggestions =
|
||||
dictInfo.mDictionary.getSuggestions(composer, prevWord,
|
||||
|
|
|
@ -27,7 +27,7 @@ import com.android.inputmethod.keyboard.ProximityInfo;
|
|||
*/
|
||||
public final class DictAndKeyboard {
|
||||
public final Dictionary mDictionary;
|
||||
private final Keyboard mKeyboard;
|
||||
public final Keyboard mKeyboard;
|
||||
private final Keyboard mManualShiftedKeyboard;
|
||||
|
||||
public DictAndKeyboard(
|
||||
|
@ -43,13 +43,6 @@ public final class DictAndKeyboard {
|
|||
keyboardLayoutSet.getKeyboard(KeyboardId.ELEMENT_ALPHABET_MANUAL_SHIFTED);
|
||||
}
|
||||
|
||||
public Keyboard getKeyboard(final int codePoint) {
|
||||
if (mKeyboard == null) {
|
||||
return null;
|
||||
}
|
||||
return mKeyboard.getKey(codePoint) != null ? mKeyboard : mManualShiftedKeyboard;
|
||||
}
|
||||
|
||||
public ProximityInfo getProximityInfo() {
|
||||
return mKeyboard == null ? null : mKeyboard.getProximityInfo();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue