am 6511376f: am 65582531: Fix a bug in backspace handling for the "Tap again to save"
Merge commit '6511376ff6f06aba15cdd1ab598a96924bae16ad' into gingerbread-plus-aosp * commit '6511376ff6f06aba15cdd1ab598a96924bae16ad': Fix a bug in backspace handling for the "Tap again to save"main
commit
b608a93c0f
|
@ -333,6 +333,12 @@ public class CandidateView extends View {
|
||||||
mShowingAddToDictionary = true;
|
mShowingAddToDictionary = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean dismissAddToDictionaryHint() {
|
||||||
|
if (!mShowingAddToDictionary) return false;
|
||||||
|
clear();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public void scrollPrev() {
|
public void scrollPrev() {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
final int count = mSuggestions.size();
|
final int count = mSuggestions.size();
|
||||||
|
|
|
@ -913,6 +913,9 @@ public class LatinIME extends InputMethodService
|
||||||
|
|
||||||
public boolean addWordToDictionary(String word) {
|
public boolean addWordToDictionary(String word) {
|
||||||
mUserDictionary.addWord(word, 128);
|
mUserDictionary.addWord(word, 128);
|
||||||
|
// Suggestion strip should be updated after the operation of adding word to the
|
||||||
|
// user dictionary
|
||||||
|
postUpdateSuggestions();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1058,9 +1061,20 @@ public class LatinIME extends InputMethodService
|
||||||
} else if (mEnteredText != null && sameAsTextBeforeCursor(ic, mEnteredText)) {
|
} else if (mEnteredText != null && sameAsTextBeforeCursor(ic, mEnteredText)) {
|
||||||
ic.deleteSurroundingText(mEnteredText.length(), 0);
|
ic.deleteSurroundingText(mEnteredText.length(), 0);
|
||||||
} else if (deleteChar) {
|
} else if (deleteChar) {
|
||||||
sendDownUpKeyEvents(KeyEvent.KEYCODE_DEL);
|
if (mCandidateView != null && mCandidateView.dismissAddToDictionaryHint()) {
|
||||||
if (mDeleteCount > DELETE_ACCELERATE_AT) {
|
// Go back to the suggestion mode if the user canceled the
|
||||||
|
// "Tap again to save".
|
||||||
|
// NOTE: In gerenal, we don't revert the word when backspacing
|
||||||
|
// from a manual suggestion pick. We deliberately chose a
|
||||||
|
// different behavior only in the case of picking the first
|
||||||
|
// suggestion (typed word). It's intentional to have made this
|
||||||
|
// inconsistent with backspacing after selecting other suggestions.
|
||||||
|
revertLastWord(deleteChar);
|
||||||
|
} else {
|
||||||
sendDownUpKeyEvents(KeyEvent.KEYCODE_DEL);
|
sendDownUpKeyEvents(KeyEvent.KEYCODE_DEL);
|
||||||
|
if (mDeleteCount > DELETE_ACCELERATE_AT) {
|
||||||
|
sendDownUpKeyEvents(KeyEvent.KEYCODE_DEL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mJustRevertedSeparator = null;
|
mJustRevertedSeparator = null;
|
||||||
|
@ -1136,6 +1150,11 @@ public class LatinIME extends InputMethodService
|
||||||
mVoiceInput.incrementTextModificationInsertPunctuationCount(1);
|
mVoiceInput.incrementTextModificationInsertPunctuationCount(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Should dismiss the "Tap again to save" message when handling separator
|
||||||
|
if (mCandidateView != null && mCandidateView.dismissAddToDictionaryHint()) {
|
||||||
|
postUpdateSuggestions();
|
||||||
|
}
|
||||||
|
|
||||||
boolean pickedDefault = false;
|
boolean pickedDefault = false;
|
||||||
// Handle separator
|
// Handle separator
|
||||||
InputConnection ic = getCurrentInputConnection();
|
InputConnection ic = getCurrentInputConnection();
|
||||||
|
|
Loading…
Reference in New Issue