Fix log dupplication of auto suggest
Change-Id: Ic2af15adff64631cc275b07113b42991363c92f8main
parent
cddf471210
commit
352f8bc9a3
|
@ -1172,8 +1172,7 @@ public class LatinIME extends InputMethodService
|
|||
(mJustRevertedSeparator == null
|
||||
|| mJustRevertedSeparator.length() == 0
|
||||
|| mJustRevertedSeparator.charAt(0) != primaryCode)) {
|
||||
pickDefaultSuggestion();
|
||||
pickedDefault = true;
|
||||
pickedDefault = pickDefaultSuggestion();
|
||||
// Picked the suggestion by the space key. We consider this
|
||||
// as "added an auto space".
|
||||
if (primaryCode == KEYCODE_SPACE) {
|
||||
|
@ -1204,8 +1203,8 @@ public class LatinIME extends InputMethodService
|
|||
//else if (TextEntryState.STATE_SPACE_AFTER_ACCEPTED) {
|
||||
doubleSpace();
|
||||
}
|
||||
if (pickedDefault && mBestWord != null) {
|
||||
TextEntryState.acceptedDefault(mWord.getTypedWord(), mBestWord);
|
||||
if (pickedDefault) {
|
||||
TextEntryState.backToAcceptedDefault();
|
||||
}
|
||||
updateShiftKeyState(getCurrentInputEditorInfo());
|
||||
if (ic != null) {
|
||||
|
@ -1502,7 +1501,7 @@ public class LatinIME extends InputMethodService
|
|||
setCandidatesViewShown(isCandidateStripVisible() || mCompletionOn);
|
||||
}
|
||||
|
||||
private void pickDefaultSuggestion() {
|
||||
private boolean pickDefaultSuggestion() {
|
||||
// Complete any pending candidate query first
|
||||
if (mHandler.hasMessages(MSG_UPDATE_SUGGESTIONS)) {
|
||||
mHandler.removeMessages(MSG_UPDATE_SUGGESTIONS);
|
||||
|
@ -1514,7 +1513,9 @@ public class LatinIME extends InputMethodService
|
|||
pickSuggestion(mBestWord);
|
||||
// Add the word to the auto dictionary if it's not a known word
|
||||
checkAddToDictionary(mBestWord, AutoDictionary.FREQUENCY_FOR_TYPED);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void pickSuggestionManually(int index, CharSequence suggestion) {
|
||||
|
|
|
@ -132,7 +132,20 @@ public class TextEntryState {
|
|||
sState = STATE_ACCEPTED_DEFAULT;
|
||||
LatinImeLogger.logOnAutoSuggestion(typedWord.toString(), actualWord.toString());
|
||||
}
|
||||
|
||||
|
||||
// STATE_ACCEPTED_DEFAULT will be changed to other sub-states
|
||||
// (see "case STATE_ACCEPTED_DEFAULT" in typedCharacter() below),
|
||||
// and should be restored back to STATE_ACCEPTED_DEFAULT after processing for each sub-state.
|
||||
public static void backToAcceptedDefault() {
|
||||
switch (sState) {
|
||||
case STATE_SPACE_AFTER_ACCEPTED:
|
||||
case STATE_PUNCTUATION_AFTER_ACCEPTED:
|
||||
case STATE_IN_WORD:
|
||||
sState = STATE_ACCEPTED_DEFAULT;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public static void acceptedTyped(CharSequence typedWord) {
|
||||
sWordNotInDictionaryCount++;
|
||||
sState = STATE_PICKED_SUGGESTION;
|
||||
|
|
Loading…
Reference in New Issue