diff options
author | 2010-03-10 11:39:06 -0800 | |
---|---|---|
committer | 2010-03-10 11:39:06 -0800 | |
commit | 283a77f633e92ed7dbe96b083c921fc244bbe880 (patch) | |
tree | b7cebd95da3d926f14eec5cf9513d87a86f83087 /java/src/com/android/inputmethod/latin/AutoDictionary.java | |
parent | 97e2d11039137b2f82ff300d742ecb433f1a56e0 (diff) | |
download | latinime-283a77f633e92ed7dbe96b083c921fc244bbe880.tar.gz latinime-283a77f633e92ed7dbe96b083c921fc244bbe880.tar.xz latinime-283a77f633e92ed7dbe96b083c921fc244bbe880.zip |
Load UserDictionary and AutoDictionary in a background thread.
This is to avoid ANRs during bootup, as some of the providers
may not have been initialized yet.
Refactored the ContactsDictionary and moved the async loading
code to ExpandableDictionary to share with the other dicts.
Bug: 2501133
Change-Id: I20393edb6fdf5df2f54ebac8dd04419a592177a2
Diffstat (limited to 'java/src/com/android/inputmethod/latin/AutoDictionary.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/AutoDictionary.java | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/java/src/com/android/inputmethod/latin/AutoDictionary.java b/java/src/com/android/inputmethod/latin/AutoDictionary.java index 3d76dc301..da9dd6eb9 100644 --- a/java/src/com/android/inputmethod/latin/AutoDictionary.java +++ b/java/src/com/android/inputmethod/latin/AutoDictionary.java @@ -96,11 +96,14 @@ public class AutoDictionary extends ExpandableDictionary { return frequency >= VALIDITY_THRESHOLD; } + @Override public void close() { mOpenHelper.close(); + super.close(); } - private void loadDictionary() { + @Override + public void loadDictionaryAsync() { // Load the words that correspond to the current input locale Cursor cursor = query(COLUMN_LOCALE + "=?", new String[] { mLocale }); if (cursor.moveToFirst()) { @@ -183,15 +186,6 @@ public class AutoDictionary extends ExpandableDictionary { return c; } - private boolean insert(ContentValues values) { - SQLiteDatabase db = mOpenHelper.getWritableDatabase(); - long rowId = db.insert(AUTODICT_TABLE_NAME, Words.WORD, values); - if (rowId > 0) { - return true; - } - return false; - } - private int delete(String where, String[] whereArgs) { SQLiteDatabase db = mOpenHelper.getWritableDatabase(); int count = db.delete(AUTODICT_TABLE_NAME, where, whereArgs); |