summaryrefslogtreecommitdiff
path: root/core/java/android/widget/SpellChecker.java
diff options
context:
space:
mode:
authorSatoshi Kataoka <satok@google.com>2012-12-05 22:25:48 +0900
committerSatoshi Kataoka <satok@google.com>2012-12-06 19:30:50 +0900
commit5bb4ee6d38bec37c84086d52a2293b5396ee33df (patch)
treeaebf0f7669858e8ee282fdb4c4d4dc7874539f59 /core/java/android/widget/SpellChecker.java
parent2b0b6596e4300350a84bbe917fd87f3b79bd2888 (diff)
Fix an issue on changing the keyboard locale between spellchecking supported language to non-supported language
Bug: 7658675 Change-Id: Ia2353f299506b5871e0104594e4486b6ab1ffa82
Diffstat (limited to 'core/java/android/widget/SpellChecker.java')
-rw-r--r--core/java/android/widget/SpellChecker.java15
1 files changed, 9 insertions, 6 deletions
diff --git a/core/java/android/widget/SpellChecker.java b/core/java/android/widget/SpellChecker.java
index 74ea038f78f3..9e7f97ea16eb 100644
--- a/core/java/android/widget/SpellChecker.java
+++ b/core/java/android/widget/SpellChecker.java
@@ -109,7 +109,7 @@ public class SpellChecker implements SpellCheckerSessionListener {
mIds = new int[size];
mSpellCheckSpans = new SpellCheckSpan[size];
- setLocale(mTextView.getTextServicesLocale());
+ setLocale(mTextView.getSpellCheckerLocale());
mCookie = hashCode();
}
@@ -120,7 +120,8 @@ public class SpellChecker implements SpellCheckerSessionListener {
mTextServicesManager = (TextServicesManager) mTextView.getContext().
getSystemService(Context.TEXT_SERVICES_MANAGER_SERVICE);
if (!mTextServicesManager.isSpellCheckerEnabled()
- || mTextServicesManager.getCurrentSpellCheckerSubtype(true) == null) {
+ || mCurrentLocale == null
+ || mTextServicesManager.getCurrentSpellCheckerSubtype(true) == null) {
mSpellCheckerSession = null;
} else {
mSpellCheckerSession = mTextServicesManager.newSpellCheckerSession(
@@ -146,8 +147,10 @@ public class SpellChecker implements SpellCheckerSessionListener {
resetSession();
- // Change SpellParsers' wordIterator locale
- mWordIterator = new WordIterator(locale);
+ if (locale != null) {
+ // Change SpellParsers' wordIterator locale
+ mWordIterator = new WordIterator(locale);
+ }
// This class is the listener for locale change: warn other locale-aware objects
mTextView.onLocaleChanged();
@@ -222,9 +225,9 @@ public class SpellChecker implements SpellCheckerSessionListener {
if (DBG) {
Log.d(TAG, "Start spell-checking: " + start + ", " + end);
}
- final Locale locale = mTextView.getTextServicesLocale();
+ final Locale locale = mTextView.getSpellCheckerLocale();
final boolean isSessionActive = isSessionActive();
- if (mCurrentLocale == null || (!(mCurrentLocale.equals(locale)))) {
+ if (locale == null || mCurrentLocale == null || (!(mCurrentLocale.equals(locale)))) {
setLocale(locale);
// Re-check the entire text
start = 0;