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
17f7b406
Commit
17f7b406
authored
12 years ago
by
Satoshi Kataoka
Browse files
Options
Downloads
Patches
Plain Diff
Clear cache of user dic
Change-Id: Iec2793de3fff7bf15f68f82a50331de7742b7049
parent
87cecf7d
No related branches found
No related tags found
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/AndroidWordLevelSpellCheckerSession.java
+23
-0
23 additions, 0 deletions
...latin/spellcheck/AndroidWordLevelSpellCheckerSession.java
with
23 additions
and
0 deletions
java/src/com/android/inputmethod/latin/spellcheck/AndroidWordLevelSpellCheckerSession.java
+
23
−
0
View file @
17f7b406
...
@@ -16,6 +16,9 @@
...
@@ -16,6 +16,9 @@
package
com.android.inputmethod.latin.spellcheck
;
package
com.android.inputmethod.latin.spellcheck
;
import
android.content.ContentResolver
;
import
android.database.ContentObserver
;
import
android.provider.UserDictionary.Words
;
import
android.service.textservice.SpellCheckerService.Session
;
import
android.service.textservice.SpellCheckerService.Session
;
import
android.text.TextUtils
;
import
android.text.TextUtils
;
import
android.util.Log
;
import
android.util.Log
;
...
@@ -45,6 +48,7 @@ public abstract class AndroidWordLevelSpellCheckerSession extends Session {
...
@@ -45,6 +48,7 @@ public abstract class AndroidWordLevelSpellCheckerSession extends Session {
private
int
mScript
;
// One of SCRIPT_LATIN or SCRIPT_CYRILLIC for now.
private
int
mScript
;
// One of SCRIPT_LATIN or SCRIPT_CYRILLIC for now.
private
final
AndroidSpellCheckerService
mService
;
private
final
AndroidSpellCheckerService
mService
;
protected
final
SuggestionsCache
mSuggestionsCache
=
new
SuggestionsCache
();
protected
final
SuggestionsCache
mSuggestionsCache
=
new
SuggestionsCache
();
private
final
ContentObserver
mObserver
;
private
static
class
SuggestionsParams
{
private
static
class
SuggestionsParams
{
public
final
String
[]
mSuggestions
;
public
final
String
[]
mSuggestions
;
...
@@ -83,10 +87,23 @@ public abstract class AndroidWordLevelSpellCheckerSession extends Session {
...
@@ -83,10 +87,23 @@ public abstract class AndroidWordLevelSpellCheckerSession extends Session {
mUnigramSuggestionsInfoCache
.
put
(
mUnigramSuggestionsInfoCache
.
put
(
generateKey
(
query
,
prevWord
),
new
SuggestionsParams
(
suggestions
,
flags
));
generateKey
(
query
,
prevWord
),
new
SuggestionsParams
(
suggestions
,
flags
));
}
}
public
void
clearCache
()
{
mUnigramSuggestionsInfoCache
.
evictAll
();
}
}
}
AndroidWordLevelSpellCheckerSession
(
final
AndroidSpellCheckerService
service
)
{
AndroidWordLevelSpellCheckerSession
(
final
AndroidSpellCheckerService
service
)
{
mService
=
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
@Override
...
@@ -97,6 +114,12 @@ public abstract class AndroidWordLevelSpellCheckerSession extends Session {
...
@@ -97,6 +114,12 @@ public abstract class AndroidWordLevelSpellCheckerSession extends Session {
mScript
=
AndroidSpellCheckerService
.
getScriptFromLocale
(
mLocale
);
mScript
=
AndroidSpellCheckerService
.
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
* Returns whether the code point is a letter that makes sense for the specified
* locale for this spell checker.
* 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