diff options
| author | Gilles Debunne <debunne@google.com> | 2011-09-16 14:26:12 -0700 |
|---|---|---|
| committer | Gilles Debunne <debunne@google.com> | 2011-09-23 10:16:01 -0700 |
| commit | 186aaf973530f426b9b0e602e9744c591aa4aea9 (patch) | |
| tree | 629a4fba144a9142f742757b580b8bb7e18856a4 /core/java/android/widget/SpellChecker.java | |
| parent | 5840639fd18c334c0df30ae03b270c452fee0a61 (diff) | |
| download | frameworks_base-186aaf973530f426b9b0e602e9744c591aa4aea9.zip frameworks_base-186aaf973530f426b9b0e602e9744c591aa4aea9.tar.gz frameworks_base-186aaf973530f426b9b0e602e9744c591aa4aea9.tar.bz2 | |
Bug 5248215: Even though I turned off the Spelling correction, it still shows up
Bug 5313754: SpellCheckSession is released when the window loses focus.
When an EditText is initialized with text, a new spell check is initiated
and previous spell check spans are removed.
Requires a new flag to prevent this from happening when the window focus
change comes from the suggestion popup window being shown.
Also fixes bug 5329588: handle spell check language change.
This change has been reverted. This amended change defers the creation
of the SpellChecker, so that it is only created for editable TextView.
Patch 3: Bug 5332065, the spell check session is closed in onDetachedFromWindow, which is
called when the window is destroyed (like on rotation), which was not the case with
onWindowFocusChanged.
Patch 5: Fixed life cycle. A view can be created and never attached to the hierarchy. As
a result, the spellCheck session would not be closed. Moved spell check to onAttach and
perform a spell check when text is changed by setText only if the view has previously
been attached (and the spellChecker has been created).
Change-Id: Ic2cfbfc0d3f23c589dd9e37f02e4afc1d625615d
Diffstat (limited to 'core/java/android/widget/SpellChecker.java')
| -rw-r--r-- | core/java/android/widget/SpellChecker.java | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/core/java/android/widget/SpellChecker.java b/core/java/android/widget/SpellChecker.java index 14cbf6f..6b2f3e4 100644 --- a/core/java/android/widget/SpellChecker.java +++ b/core/java/android/widget/SpellChecker.java @@ -75,6 +75,20 @@ public class SpellChecker implements SpellCheckerSessionListener { mLength = 0; } + /** + * @return true if a spell checker session has successfully been created. Returns false if not, + * for instance when spell checking has been disabled in settings. + */ + public boolean isSessionActive() { + return mSpellCheckerSession != null; + } + + public void closeSession() { + if (mSpellCheckerSession != null) { + mSpellCheckerSession.close(); + } + } + public void addSpellCheckSpan(SpellCheckSpan spellCheckSpan) { int length = mIds.length; if (mLength >= length) { |
