Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
LatinIME
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
keyboard
LatinIME
Commits
f5becbcd
Commit
f5becbcd
authored
12 years ago
by
satok
Committed by
Android Git Automerger
12 years ago
Browse files
Options
Downloads
Plain Diff
am
f1e13f1f
: DO NOT MERGE: Clear cache of the user dictionary when a word is added
* commit '
f1e13f1f
': DO NOT MERGE: Clear cache of the user dictionary when a word is added
parents
70fb1d1a
f1e13f1f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java
+23
-0
23 additions, 0 deletions
...utmethod/latin/spellcheck/AndroidSpellCheckerService.java
with
23 additions
and
0 deletions
java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java
+
23
−
0
View file @
f5becbcd
...
...
@@ -16,9 +16,12 @@
package
com.android.inputmethod.latin.spellcheck
;
import
android.content.ContentResolver
;
import
android.content.Intent
;
import
android.content.SharedPreferences
;
import
android.database.ContentObserver
;
import
android.preference.PreferenceManager
;
import
android.provider.UserDictionary.Words
;
import
android.service.textservice.SpellCheckerService
;
import
android.text.TextUtils
;
import
android.util.Log
;
...
...
@@ -490,6 +493,7 @@ public class AndroidSpellCheckerService extends SpellCheckerService
private
final
AndroidSpellCheckerService
mService
;
private
final
SuggestionsCache
mSuggestionsCache
=
new
SuggestionsCache
();
private
final
ContentObserver
mObserver
;
private
static
class
SuggestionsParams
{
public
final
String
[]
mSuggestions
;
...
...
@@ -516,10 +520,23 @@ public class AndroidSpellCheckerService extends SpellCheckerService
}
mUnigramSuggestionsInfoCache
.
put
(
query
,
new
SuggestionsParams
(
suggestions
,
flags
));
}
public
void
clearCache
()
{
mUnigramSuggestionsInfoCache
.
evictAll
();
}
}
AndroidSpellCheckerSession
(
final
AndroidSpellCheckerService
service
)
{
mService
=
service
;
final
ContentResolver
cres
=
service
.
getContentResolver
();
mObserver
=
new
ContentObserver
(
null
)
{
@Override
public
void
onChange
(
boolean
self
)
{
mSuggestionsCache
.
clearCache
();
}
};
cres
.
registerContentObserver
(
Words
.
CONTENT_URI
,
true
,
mObserver
);
}
@Override
...
...
@@ -530,6 +547,12 @@ public class AndroidSpellCheckerService extends SpellCheckerService
mScript
=
getScriptFromLocale
(
mLocale
);
}
@Override
public
void
onClose
()
{
final
ContentResolver
cres
=
mService
.
getContentResolver
();
cres
.
unregisterContentObserver
(
mObserver
);
}
/*
* Returns whether the code point is a letter that makes sense for the specified
* locale for this spell checker.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment