aboutsummaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2011-02-23 22:04:47 +0900
committerJean Chalard <jchalard@google.com>2011-02-24 11:20:21 +0900
commit7f2ba16aa2adba95e0575a2c6d58f6240154f313 (patch)
treea46d58f80cbab8d0c462a84512bc5661f081acd6 /java/src
parentededda059c45c83b2e217380c24370b14cfa7eb3 (diff)
downloadlatinime-7f2ba16aa2adba95e0575a2c6d58f6240154f313.tar.gz
latinime-7f2ba16aa2adba95e0575a2c6d58f6240154f313.tar.xz
latinime-7f2ba16aa2adba95e0575a2c6d58f6240154f313.zip
Allow the user to save words when there is no binary dictionary.
At the moment, if there is no binary dictionary, even when pressing the word in the suggestion strip the option to save in the user dictionary is not displayed. This change addresses that. Bug: 3363756 Change-Id: I4993a7f81ed15ab948a3098cdc49663e0f109e4a
Diffstat (limited to 'java/src')
-rw-r--r--java/src/com/android/inputmethod/latin/LatinIME.java16
1 files changed, 14 insertions, 2 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index 40cebb395..39a83ef7f 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -1627,9 +1627,21 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
mJustAddedAutoSpace = true;
}
- final boolean showingAddToDictionaryHint = index == 0 && mCorrectionMode > 0
+ // We should show the hint if the user pressed the first entry AND either:
+ // - There is no dictionary (we know that because we tried to load it => null != mSuggest
+ // AND mHasDictionary is false)
+ // - There is a dictionary and the word is not in it
+ // Please note that if mSuggest is null, it means that everything is off: suggestion
+ // and correction, so we shouldn't try to show the hint
+ // We used to look at mCorrectionMode here, but showing the hint should have nothing
+ // to do with the autocorrection setting.
+ final boolean showingAddToDictionaryHint = index == 0 &&
+ // Test for no dictionary:
+ ((!mHasDictionary && null != mSuggest) ||
+ // Test for dictionary && word is inside:
+ (mHasDictionary && null != mSuggest
&& !mSuggest.isValidWord(suggestion)
- && !mSuggest.isValidWord(suggestion.toString().toLowerCase());
+ && !mSuggest.isValidWord(suggestion.toString().toLowerCase())));
if (!correcting) {
// Fool the state watcher so that a subsequent backspace will not do a revert, unless