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 == null
|
||||||
|| mJustRevertedSeparator.length() == 0
|
|| mJustRevertedSeparator.length() == 0
|
||||||
|| mJustRevertedSeparator.charAt(0) != primaryCode)) {
|
|| mJustRevertedSeparator.charAt(0) != primaryCode)) {
|
||||||
pickDefaultSuggestion();
|
pickedDefault = pickDefaultSuggestion();
|
||||||
pickedDefault = true;
|
|
||||||
// Picked the suggestion by the space key. We consider this
|
// Picked the suggestion by the space key. We consider this
|
||||||
// as "added an auto space".
|
// as "added an auto space".
|
||||||
if (primaryCode == KEYCODE_SPACE) {
|
if (primaryCode == KEYCODE_SPACE) {
|
||||||
|
@ -1204,8 +1203,8 @@ public class LatinIME extends InputMethodService
|
||||||
//else if (TextEntryState.STATE_SPACE_AFTER_ACCEPTED) {
|
//else if (TextEntryState.STATE_SPACE_AFTER_ACCEPTED) {
|
||||||
doubleSpace();
|
doubleSpace();
|
||||||
}
|
}
|
||||||
if (pickedDefault && mBestWord != null) {
|
if (pickedDefault) {
|
||||||
TextEntryState.acceptedDefault(mWord.getTypedWord(), mBestWord);
|
TextEntryState.backToAcceptedDefault();
|
||||||
}
|
}
|
||||||
updateShiftKeyState(getCurrentInputEditorInfo());
|
updateShiftKeyState(getCurrentInputEditorInfo());
|
||||||
if (ic != null) {
|
if (ic != null) {
|
||||||
|
@ -1502,7 +1501,7 @@ public class LatinIME extends InputMethodService
|
||||||
setCandidatesViewShown(isCandidateStripVisible() || mCompletionOn);
|
setCandidatesViewShown(isCandidateStripVisible() || mCompletionOn);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void pickDefaultSuggestion() {
|
private boolean pickDefaultSuggestion() {
|
||||||
// Complete any pending candidate query first
|
// Complete any pending candidate query first
|
||||||
if (mHandler.hasMessages(MSG_UPDATE_SUGGESTIONS)) {
|
if (mHandler.hasMessages(MSG_UPDATE_SUGGESTIONS)) {
|
||||||
mHandler.removeMessages(MSG_UPDATE_SUGGESTIONS);
|
mHandler.removeMessages(MSG_UPDATE_SUGGESTIONS);
|
||||||
|
@ -1514,7 +1513,9 @@ public class LatinIME extends InputMethodService
|
||||||
pickSuggestion(mBestWord);
|
pickSuggestion(mBestWord);
|
||||||
// Add the word to the auto dictionary if it's not a known word
|
// Add the word to the auto dictionary if it's not a known word
|
||||||
checkAddToDictionary(mBestWord, AutoDictionary.FREQUENCY_FOR_TYPED);
|
checkAddToDictionary(mBestWord, AutoDictionary.FREQUENCY_FOR_TYPED);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void pickSuggestionManually(int index, CharSequence suggestion) {
|
public void pickSuggestionManually(int index, CharSequence suggestion) {
|
||||||
|
|
|
@ -133,6 +133,19 @@ public class TextEntryState {
|
||||||
LatinImeLogger.logOnAutoSuggestion(typedWord.toString(), actualWord.toString());
|
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) {
|
public static void acceptedTyped(CharSequence typedWord) {
|
||||||
sWordNotInDictionaryCount++;
|
sWordNotInDictionaryCount++;
|
||||||
sState = STATE_PICKED_SUGGESTION;
|
sState = STATE_PICKED_SUGGESTION;
|
||||||
|
|
Loading…
Reference in New Issue