summaryrefslogtreecommitdiff
path: root/java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java
diff options
context:
space:
mode:
authorDan Zivkovic <zivkovic@google.com>2015-04-01 19:18:52 -0700
committerDan Zivkovic <zivkovic@google.com>2015-04-02 11:15:27 -0700
commit87eb7ac29c51ba4c341cb663cdbbc5ea74595f2d (patch)
tree694894ec228c941fb203a8394b6b50867907188a /java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java
parent1a58c47ebe137ee1d5b3a2567b97802946945d38 (diff)
Add shortcut support to UserDictionaryLookup.
Also move the class to the parent package, since it's no longer tied to the spell checking service. Bug 19966848. Bug 20036810. Change-Id: I35014d212fd87281eb90def03ee92e6872dcd63e
Diffstat (limited to 'java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java')
-rw-r--r--java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java35
1 files changed, 2 insertions, 33 deletions
diff --git a/java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java b/java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java
index 766b385a9..4625e8e8b 100644
--- a/java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java
+++ b/java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java
@@ -24,7 +24,6 @@ import android.text.InputType;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputMethodSubtype;
import android.view.textservice.SuggestionsInfo;
-import android.util.Log;
import com.android.inputmethod.keyboard.Keyboard;
import com.android.inputmethod.keyboard.KeyboardId;
@@ -83,7 +82,6 @@ public final class AndroidSpellCheckerService extends SpellCheckerService
public static final String SINGLE_QUOTE = "\u0027";
public static final String APOSTROPHE = "\u2019";
- private UserDictionaryLookup mUserDictionaryLookup;
public AndroidSpellCheckerService() {
super();
@@ -95,30 +93,11 @@ public final class AndroidSpellCheckerService extends SpellCheckerService
@Override
public void onCreate() {
super.onCreate();
- mRecommendedThreshold =
- Float.parseFloat(getString(R.string.spellchecker_recommended_threshold_value));
+ mRecommendedThreshold = Float.parseFloat(
+ getString(R.string.spellchecker_recommended_threshold_value));
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
prefs.registerOnSharedPreferenceChangeListener(this);
onSharedPreferenceChanged(prefs, PREF_USE_CONTACTS_KEY);
- // Create a UserDictionaryLookup. It needs to be close()d and set to null in onDestroy.
- if (mUserDictionaryLookup == null) {
- if (DEBUG) {
- Log.d(TAG, "Creating mUserDictionaryLookup in onCreate");
- }
- mUserDictionaryLookup = new UserDictionaryLookup(this);
- } else if (DEBUG) {
- Log.d(TAG, "mUserDictionaryLookup already created before onCreate");
- }
- }
-
- @Override
- public void onDestroy() {
- if (DEBUG) {
- Log.d(TAG, "Closing and dereferencing mUserDictionaryLookup in onDestroy");
- }
- mUserDictionaryLookup.close();
- mUserDictionaryLookup = null;
- super.onDestroy();
}
public float getRecommendedThreshold() {
@@ -181,16 +160,6 @@ public final class AndroidSpellCheckerService extends SpellCheckerService
public boolean isValidWord(final Locale locale, final String word) {
mSemaphore.acquireUninterruptibly();
try {
- if (mUserDictionaryLookup.isValidWord(word, locale)) {
- if (DEBUG) {
- Log.d(TAG, "mUserDictionaryLookup.isValidWord(" + word + ")=true");
- }
- return true;
- } else {
- if (DEBUG) {
- Log.d(TAG, "mUserDictionaryLookup.isValidWord(" + word + ")=false");
- }
- }
DictionaryFacilitator dictionaryFacilitatorForLocale =
mDictionaryFacilitatorCache.get(locale);
return dictionaryFacilitatorForLocale.isValidSpellingWord(word);