diff options
author | 2010-08-05 16:44:39 -0700 | |
---|---|---|
committer | 2010-08-05 16:44:39 -0700 | |
commit | 6be8e3523581408b496861427726f9332f779b0e (patch) | |
tree | bd3d1ff28afe8573c05f56e686c972adcfd7bf74 /java/src | |
parent | 43c88ce56a37560ad30eb78328aaab0f6e29bec7 (diff) | |
parent | b608a93c0f3087b191c88cd75665886b7c52015e (diff) | |
download | latinime-6be8e3523581408b496861427726f9332f779b0e.tar.gz latinime-6be8e3523581408b496861427726f9332f779b0e.tar.xz latinime-6be8e3523581408b496861427726f9332f779b0e.zip |
am b608a93c: am 6511376f: am 65582531: Fix a bug in backspace handling for the "Tap again to save"
Merge commit 'b608a93c0f3087b191c88cd75665886b7c52015e'
* commit 'b608a93c0f3087b191c88cd75665886b7c52015e':
Fix a bug in backspace handling for the "Tap again to save"
Diffstat (limited to 'java/src')
-rwxr-xr-x | java/src/com/android/inputmethod/latin/CandidateView.java | 6 | ||||
-rw-r--r-- | java/src/com/android/inputmethod/latin/LatinIME.java | 23 |
2 files changed, 27 insertions, 2 deletions
diff --git a/java/src/com/android/inputmethod/latin/CandidateView.java b/java/src/com/android/inputmethod/latin/CandidateView.java index faf72c996..7fcc3d532 100755 --- a/java/src/com/android/inputmethod/latin/CandidateView.java +++ b/java/src/com/android/inputmethod/latin/CandidateView.java @@ -341,6 +341,12 @@ public class CandidateView extends View { mShowingAddToDictionary = true; } + public boolean dismissAddToDictionaryHint() { + if (!mShowingAddToDictionary) return false; + clear(); + return true; + } + public void scrollPrev() { int i = 0; final int count = Math.min(mSuggestions.size(), MAX_SUGGESTIONS); diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index bbca316a4..13f018a28 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -1060,6 +1060,9 @@ public class LatinIME extends InputMethodService public boolean addWordToDictionary(String word) { mUserDictionary.addWord(word, 128); + // Suggestion strip should be updated after the operation of adding word to the + // user dictionary + postUpdateSuggestions(); return true; } @@ -1211,9 +1214,20 @@ public class LatinIME extends InputMethodService } else if (mEnteredText != null && sameAsTextBeforeCursor(ic, mEnteredText)) { ic.deleteSurroundingText(mEnteredText.length(), 0); } else if (deleteChar) { - sendDownUpKeyEvents(KeyEvent.KEYCODE_DEL); - if (mDeleteCount > DELETE_ACCELERATE_AT) { + if (mCandidateView != null && mCandidateView.dismissAddToDictionaryHint()) { + // 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); + if (mDeleteCount > DELETE_ACCELERATE_AT) { + sendDownUpKeyEvents(KeyEvent.KEYCODE_DEL); + } } } mJustRevertedSeparator = null; @@ -1305,6 +1319,11 @@ public class LatinIME extends InputMethodService mVoiceInput.incrementTextModificationInsertPunctuationCount(1); } + // Should dismiss the "Tap again to save" message when handling separator + if (mCandidateView != null && mCandidateView.dismissAddToDictionaryHint()) { + postUpdateSuggestions(); + } + boolean pickedDefault = false; // Handle separator InputConnection ic = getCurrentInputConnection(); |