diff options
Diffstat (limited to 'java/src/com/android/inputmethod/latin/UserDictionary.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/UserDictionary.java | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/java/src/com/android/inputmethod/latin/UserDictionary.java b/java/src/com/android/inputmethod/latin/UserDictionary.java index 2aaa26c8d..6608d8268 100644 --- a/java/src/com/android/inputmethod/latin/UserDictionary.java +++ b/java/src/com/android/inputmethod/latin/UserDictionary.java @@ -26,6 +26,8 @@ import android.net.Uri; import android.os.RemoteException; import android.provider.UserDictionary.Words; +import com.android.inputmethod.keyboard.ProximityInfo; + public class UserDictionary extends ExpandableDictionary { private static final String[] PROJECTION_QUERY = { @@ -38,23 +40,24 @@ public class UserDictionary extends ExpandableDictionary { Words.FREQUENCY, Words.LOCALE, }; - + private ContentObserver mObserver; private String mLocale; public UserDictionary(Context context, String locale) { super(context, Suggest.DIC_USER); mLocale = locale; - // Perform a managed query. The Activity will handle closing and requerying the cursor + // Perform a managed query. The Activity will handle closing and re-querying the cursor // when needed. ContentResolver cres = context.getContentResolver(); - - cres.registerContentObserver(Words.CONTENT_URI, true, mObserver = new ContentObserver(null) { + + mObserver = new ContentObserver(null) { @Override public void onChange(boolean self) { setRequiresReload(true); } - }); + }; + cres.registerContentObserver(Words.CONTENT_URI, true, mObserver); loadDictionary(); } @@ -76,6 +79,17 @@ public class UserDictionary extends ExpandableDictionary { addWords(cursor); } + public boolean isEnabled() { + final ContentResolver cr = getContext().getContentResolver(); + final ContentProviderClient client = cr.acquireContentProviderClient(Words.CONTENT_URI); + if (client != null) { + client.release(); + return true; + } else { + return false; + } + } + /** * Adds a word to the dictionary and makes it persistent. * @param word the word to add. If the word is capitalized, then the dictionary will @@ -138,8 +152,9 @@ public class UserDictionary extends ExpandableDictionary { } @Override - public synchronized void getWords(final WordComposer codes, final WordCallback callback) { - super.getWords(codes, callback); + public synchronized void getWords(final WordComposer codes, final WordCallback callback, + final ProximityInfo proximityInfo) { + super.getWords(codes, callback, proximityInfo); } @Override |