From 87eb7ac29c51ba4c341cb663cdbbc5ea74595f2d Mon Sep 17 00:00:00 2001 From: Dan Zivkovic Date: Wed, 1 Apr 2015 19:18:52 -0700 Subject: 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 --- .../spellcheck/AndroidSpellCheckerService.java | 35 ++-------------------- 1 file changed, 2 insertions(+), 33 deletions(-) (limited to 'java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java') 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); -- cgit v1.2.3-83-g751a