Merge "Bug 5575396: close spell session on language change" into ics-mr1

This commit is contained in:
Gilles Debunne
2011-11-09 00:26:46 -08:00
committed by Android (Google) Code Review

View File

@@ -82,6 +82,8 @@ public class SpellChecker implements SpellCheckerSessionListener {
} }
private void setLocale(Locale locale) { private void setLocale(Locale locale) {
closeSession();
final TextServicesManager textServicesManager = (TextServicesManager) final TextServicesManager textServicesManager = (TextServicesManager)
mTextView.getContext().getSystemService(Context.TEXT_SERVICES_MANAGER_SERVICE); mTextView.getContext().getSystemService(Context.TEXT_SERVICES_MANAGER_SERVICE);
if (!textServicesManager.isSpellCheckerEnabled()) { if (!textServicesManager.isSpellCheckerEnabled()) {
@@ -104,12 +106,6 @@ public class SpellChecker implements SpellCheckerSessionListener {
// Change SpellParsers' wordIterator locale // Change SpellParsers' wordIterator locale
mWordIterator = new WordIterator(locale); mWordIterator = new WordIterator(locale);
// Stop all SpellParsers
final int length = mSpellParsers.length;
for (int i = 0; i < length; i++) {
mSpellParsers[i].finish();
}
// Remove existing misspelled SuggestionSpans // Remove existing misspelled SuggestionSpans
mTextView.removeMisspelledSpans((Editable) mTextView.getText()); mTextView.removeMisspelledSpans((Editable) mTextView.getText());