aboutsummaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
authorKen Wakasa <kwakasa@google.com>2010-08-04 03:47:42 +0900
committerKen Wakasa <kwakasa@google.com>2010-08-06 01:14:09 +0900
commit6558253160e2039c87f424bd814f402ecd31de3b (patch)
tree90d8d6bb8abb7b9c2c9edb214746007dcfcb2f96 /java/src
parent88e7b49fc8657544380620729eb28966669103a2 (diff)
downloadlatinime-6558253160e2039c87f424bd814f402ecd31de3b.tar.gz
latinime-6558253160e2039c87f424bd814f402ecd31de3b.tar.xz
latinime-6558253160e2039c87f424bd814f402ecd31de3b.zip
Fix a bug in backspace handling for the "Tap again to save"
bug: 2889273 Change-Id: I0f317e203f368f5f47738154a6dee0f556d56148
Diffstat (limited to 'java/src')
-rwxr-xr-xjava/src/com/android/inputmethod/latin/CandidateView.java6
-rw-r--r--java/src/com/android/inputmethod/latin/LatinIME.java23
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 0c0373b3b..9a7c35d4c 100755
--- a/java/src/com/android/inputmethod/latin/CandidateView.java
+++ b/java/src/com/android/inputmethod/latin/CandidateView.java
@@ -333,6 +333,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 = mSuggestions.size();
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index 299b6a650..dc49fa58d 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -913,6 +913,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;
}
@@ -1058,9 +1061,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;
@@ -1136,6 +1150,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();