From 646d950ed8d2b2555df92855e18b350fd7761b21 Mon Sep 17 00:00:00 2001 From: Jean Chalard Date: Thu, 14 Apr 2011 20:45:47 +0900 Subject: [PATCH] Receive a broadcast that the dictionary has been updated. Change-Id: I9751cc627a835a4061f144c48ff51e9d81b2c93b --- .../latin/DictionaryPackInstallBroadcastReceiver.java | 7 +++++++ java/src/com/android/inputmethod/latin/LatinIME.java | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/java/src/com/android/inputmethod/latin/DictionaryPackInstallBroadcastReceiver.java b/java/src/com/android/inputmethod/latin/DictionaryPackInstallBroadcastReceiver.java index c7864621d..9d30af84b 100644 --- a/java/src/com/android/inputmethod/latin/DictionaryPackInstallBroadcastReceiver.java +++ b/java/src/com/android/inputmethod/latin/DictionaryPackInstallBroadcastReceiver.java @@ -30,6 +30,11 @@ import android.net.Uri; public class DictionaryPackInstallBroadcastReceiver extends BroadcastReceiver { final LatinIME mService; + /** + * The action of the intent for publishing that new dictionary data is available. + */ + /* package */ static final String NEW_DICTIONARY_INTENT_ACTION = + "com.android.inputmethod.latin.dictionarypack.newdict"; public DictionaryPackInstallBroadcastReceiver(final LatinIME service) { mService = service; @@ -77,6 +82,8 @@ public class DictionaryPackInstallBroadcastReceiver extends BroadcastReceiver { // TODO: Only reload dictionary on REMOVED when the removed package is the one we // read dictionary from? mService.resetSuggestMainDict(); + } else if (action.equals(NEW_DICTIONARY_INTENT_ACTION)) { + mService.resetSuggestMainDict(); } } } diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index 6f5d2fe4f..88b3ded8e 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -440,6 +440,11 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar packageFilter.addAction(Intent.ACTION_PACKAGE_REMOVED); packageFilter.addDataScheme(SCHEME_PACKAGE); registerReceiver(mDictionaryPackInstallReceiver, packageFilter); + + final IntentFilter newDictFilter = new IntentFilter(); + newDictFilter.addAction( + DictionaryPackInstallBroadcastReceiver.NEW_DICTIONARY_INTENT_ACTION); + registerReceiver(mDictionaryPackInstallReceiver, newDictFilter); } private void initSuggest() {