Receive a broadcast that the dictionary has been updated.

Change-Id: I9751cc627a835a4061f144c48ff51e9d81b2c93b
main
Jean Chalard 2011-04-14 20:45:47 +09:00
parent 7c83293686
commit 646d950ed8
2 changed files with 12 additions and 0 deletions

View File

@ -30,6 +30,11 @@ import android.net.Uri;
public class DictionaryPackInstallBroadcastReceiver extends BroadcastReceiver { public class DictionaryPackInstallBroadcastReceiver extends BroadcastReceiver {
final LatinIME mService; 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) { public DictionaryPackInstallBroadcastReceiver(final LatinIME service) {
mService = 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 // TODO: Only reload dictionary on REMOVED when the removed package is the one we
// read dictionary from? // read dictionary from?
mService.resetSuggestMainDict(); mService.resetSuggestMainDict();
} else if (action.equals(NEW_DICTIONARY_INTENT_ACTION)) {
mService.resetSuggestMainDict();
} }
} }
} }

View File

@ -440,6 +440,11 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
packageFilter.addAction(Intent.ACTION_PACKAGE_REMOVED); packageFilter.addAction(Intent.ACTION_PACKAGE_REMOVED);
packageFilter.addDataScheme(SCHEME_PACKAGE); packageFilter.addDataScheme(SCHEME_PACKAGE);
registerReceiver(mDictionaryPackInstallReceiver, packageFilter); registerReceiver(mDictionaryPackInstallReceiver, packageFilter);
final IntentFilter newDictFilter = new IntentFilter();
newDictFilter.addAction(
DictionaryPackInstallBroadcastReceiver.NEW_DICTIONARY_INTENT_ACTION);
registerReceiver(mDictionaryPackInstallReceiver, newDictFilter);
} }
private void initSuggest() { private void initSuggest() {