Merge "Receive a broadcast that the dictionary has been updated."

main
Jean Chalard 2011-04-14 04:58:29 -07:00 committed by Android (Google) Code Review
commit b53d6172ef
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() {