diff options
author | 2010-09-24 08:33:31 -0700 | |
---|---|---|
committer | 2010-09-24 08:33:31 -0700 | |
commit | 6ee1bd425bc44d91dbb151e999e9781bc301e632 (patch) | |
tree | 383ec60a36045316ebb039d9e45fc794ecae198f /java/src/com/android/inputmethod/latin/UserDictionary.java | |
parent | 64e5a1940f69d3640ab5ca49bc62004625e73f4e (diff) | |
parent | 336bc6bfebe8f965572682e5d5f1d66829ee7e17 (diff) | |
download | latinime-6ee1bd425bc44d91dbb151e999e9781bc301e632.tar.gz latinime-6ee1bd425bc44d91dbb151e999e9781bc301e632.tar.xz latinime-6ee1bd425bc44d91dbb151e999e9781bc301e632.zip |
Merge "Keep addWordToDictionary from doing disk I/O on main thread" into gingerbread
Diffstat (limited to 'java/src/com/android/inputmethod/latin/UserDictionary.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/UserDictionary.java | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/java/src/com/android/inputmethod/latin/UserDictionary.java b/java/src/com/android/inputmethod/latin/UserDictionary.java index 3315cf6c9..49b95e9aa 100644 --- a/java/src/com/android/inputmethod/latin/UserDictionary.java +++ b/java/src/com/android/inputmethod/latin/UserDictionary.java @@ -89,13 +89,19 @@ public class UserDictionary extends ExpandableDictionary { super.addWord(word, frequency); // Update the user dictionary provider - ContentValues values = new ContentValues(5); + final ContentValues values = new ContentValues(5); values.put(Words.WORD, word); values.put(Words.FREQUENCY, frequency); values.put(Words.LOCALE, mLocale); values.put(Words.APP_ID, 0); - getContext().getContentResolver().insert(Words.CONTENT_URI, values); + final ContentResolver contentResolver = getContext().getContentResolver(); + new Thread("addWord") { + public void run() { + contentResolver.insert(Words.CONTENT_URI, values); + } + }.start(); + // In case the above does a synchronous callback of the change observer setRequiresReload(false); } |