diff options
author | 2009-10-08 17:30:50 -0700 | |
---|---|---|
committer | 2009-10-08 17:30:50 -0700 | |
commit | f195bd94f3d64bf15956a728d860e6a17f57ec30 (patch) | |
tree | 31a7bfd7de8e23c5de33d6071c2d7e7dd0aeb087 /src | |
parent | e9c82cbb2be095de88f16fb009428f12ab616726 (diff) | |
parent | b7a94fd7d66ad2cb73ed6c7226de5535935ab8b0 (diff) | |
download | latinime-f195bd94f3d64bf15956a728d860e6a17f57ec30.tar.gz latinime-f195bd94f3d64bf15956a728d860e6a17f57ec30.tar.xz latinime-f195bd94f3d64bf15956a728d860e6a17f57ec30.zip |
am b7a94fd7: Merge change Ib3f6d58b into eclair
Merge commit 'b7a94fd7d66ad2cb73ed6c7226de5535935ab8b0' into eclair-mr2
* commit 'b7a94fd7d66ad2cb73ed6c7226de5535935ab8b0':
Fix for 2148982: Keyboard freezes while typing
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/inputmethod/latin/ContactsDictionary.java | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/com/android/inputmethod/latin/ContactsDictionary.java b/src/com/android/inputmethod/latin/ContactsDictionary.java index e8faf45a1..6f7f4b6a4 100644 --- a/src/com/android/inputmethod/latin/ContactsDictionary.java +++ b/src/com/android/inputmethod/latin/ContactsDictionary.java @@ -16,16 +16,11 @@ package com.android.inputmethod.latin; -import java.util.ArrayList; -import java.util.List; -import java.util.Locale; - import android.content.ContentResolver; import android.content.Context; import android.database.ContentObserver; import android.database.Cursor; import android.provider.ContactsContract.Contacts; -import android.util.Log; public class ContactsDictionary extends ExpandableDictionary { @@ -40,6 +35,8 @@ public class ContactsDictionary extends ExpandableDictionary { private boolean mRequiresReload; + private long mLastLoadedContacts; + public ContactsDictionary(Context context) { super(context); // Perform a managed query. The Activity will handle closing and requerying the cursor @@ -64,12 +61,17 @@ public class ContactsDictionary extends ExpandableDictionary { } private synchronized void loadDictionary() { - Cursor cursor = getContext().getContentResolver() - .query(Contacts.CONTENT_URI, PROJECTION, null, null, null); - if (cursor != null) { - addWords(cursor); + long now = android.os.SystemClock.uptimeMillis(); + if (mLastLoadedContacts == 0 + || now - mLastLoadedContacts > 30 * 60 * 1000 /* 30 minutes */) { + Cursor cursor = getContext().getContentResolver() + .query(Contacts.CONTENT_URI, PROJECTION, null, null, null); + if (cursor != null) { + addWords(cursor); + } + mRequiresReload = false; + mLastLoadedContacts = now; } - mRequiresReload = false; } @Override |