diff options
author | 2011-07-28 18:09:51 -0700 | |
---|---|---|
committer | 2011-07-28 18:09:51 -0700 | |
commit | 4e7d0663ba2edeb2ea38c0c93b81827350e845c6 (patch) | |
tree | 00bf402d02c50d9b1cf7134837335b5805a9149f /java/src | |
parent | 259ce17f5d23810aac4c56a5fcd7c1d20fa8143e (diff) | |
parent | a90992e56244a914195daba3a2dd8a0e66e63384 (diff) | |
download | latinime-4e7d0663ba2edeb2ea38c0c93b81827350e845c6.tar.gz latinime-4e7d0663ba2edeb2ea38c0c93b81827350e845c6.tar.xz latinime-4e7d0663ba2edeb2ea38c0c93b81827350e845c6.zip |
Merge "Modified the test spell checker"
Diffstat (limited to 'java/src')
-rw-r--r-- | java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java b/java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java index 156510b40..ae938aea8 100644 --- a/java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java +++ b/java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java @@ -17,6 +17,7 @@ package com.android.inputmethod.latin.spellcheck; import android.service.textservice.SpellCheckerService; +import android.util.Log; import android.view.textservice.SuggestionsInfo; import android.view.textservice.TextInfo; @@ -24,11 +25,26 @@ import android.view.textservice.TextInfo; * Service for spell checking, using LatinIME's dictionaries and mechanisms. */ public class AndroidSpellCheckerService extends SpellCheckerService { + private static final String TAG = AndroidSpellCheckerService.class.getSimpleName(); + private static final boolean DBG = true; @Override public SuggestionsInfo getSuggestions(TextInfo textInfo, int suggestionsLimit, String locale) { // TODO: implement this - String[] candidates = new String[] {"candidate1", "candidate2", "candidate3"}; - return new SuggestionsInfo(0, candidates); + final String text = textInfo.getText(); + if (DBG) { + Log.w(TAG, "getSuggestions: " + text); + } + String[] candidates0 = new String[] {text, "candidate1", "candidate2", "candidate3"}; + String[] candidates1 = new String[] {text, "candidateA", "candidateB"}; + final int textLength = textInfo.getText().length() % 3; + if (textLength % 3 == 0) { + return new SuggestionsInfo(SuggestionsInfo.RESULT_ATTR_LOOKS_TYPO + | SuggestionsInfo.RESULT_ATTR_IN_THE_DICTIONARY, candidates0); + } else if (textLength % 3 == 1) { + return new SuggestionsInfo(SuggestionsInfo.RESULT_ATTR_IN_THE_DICTIONARY, candidates1); + } else { + return new SuggestionsInfo(0, null); + } } } |