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
2e8aa060
Commit
2e8aa060
authored
12 years ago
by
Tom Ouyang
Browse files
Options
Downloads
Patches
Plain Diff
Contacts binary dictionary updates with change in keyboard locale.
Bug: 6616436 Change-Id: I8d66a37f295134c5b9875b2a305a9be7442bd75d
parent
6b3b37da
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
java/src/com/android/inputmethod/latin/ContactsBinaryDictionary.java
+4
-0
4 additions, 0 deletions
...m/android/inputmethod/latin/ContactsBinaryDictionary.java
java/src/com/android/inputmethod/latin/LatinIME.java
+29
-16
29 additions, 16 deletions
java/src/com/android/inputmethod/latin/LatinIME.java
with
33 additions
and
16 deletions
java/src/com/android/inputmethod/latin/ContactsBinaryDictionary.java
+
4
−
0
View file @
2e8aa060
...
...
@@ -52,6 +52,9 @@ public class ContactsBinaryDictionary extends ExpandableBinaryDictionary {
/** The number of contacts in the most recent dictionary rebuild. */
static
private
int
sContactCountAtLastRebuild
=
0
;
/** The locale for this contacts dictionary. Controls name bigram predictions. */
public
final
Locale
mLocale
;
private
ContentObserver
mObserver
;
/**
...
...
@@ -61,6 +64,7 @@ public class ContactsBinaryDictionary extends ExpandableBinaryDictionary {
public
ContactsBinaryDictionary
(
final
Context
context
,
final
int
dicTypeId
,
Locale
locale
)
{
super
(
context
,
getFilenameWithLocale
(
NAME
,
locale
.
toString
()),
dicTypeId
);
mLocale
=
locale
;
mUseFirstLastBigrams
=
useFirstLastBigramsForLocale
(
locale
);
registerObserver
(
context
);
...
...
This diff is collapsed.
Click to expand it.
java/src/com/android/inputmethod/latin/LatinIME.java
+
29
−
16
View file @
2e8aa060
...
...
@@ -505,9 +505,8 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
/**
* Resets the contacts dictionary in mSuggest according to the user settings.
*
* This method takes an optional contacts dictionary to use. Since the contacts dictionary
* does not depend on the locale, it can be reused across different instances of Suggest.
* The dictionary will also be opened or closed as necessary depending on the settings.
* This method takes an optional contacts dictionary to use when the locale hasn't changed
* since the contacts dictionary can be opened or closed as necessary depending on the settings.
*
* @param oldContactsDictionary an optional dictionary to use, or null
*/
...
...
@@ -520,21 +519,35 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
// so it's safe to call it anyways.
if
(
null
!=
oldContactsDictionary
)
oldContactsDictionary
.
close
();
dictionaryToUse
=
null
;
}
else
if
(
null
!=
oldContactsDictionary
)
{
// Make sure the old contacts dictionary is opened. If it is already open, this is a
// no-op, so it's safe to call it anyways.
if
(
USE_BINARY_CONTACTS_DICTIONARY
)
{
((
ContactsBinaryDictionary
)
oldContactsDictionary
).
reopen
(
this
);
}
else
{
((
ContactsDictionary
)
oldContactsDictionary
).
reopen
(
this
);
}
dictionaryToUse
=
oldContactsDictionary
;
}
else
{
if
(
USE_BINARY_CONTACTS_DICTIONARY
)
{
dictionaryToUse
=
new
ContactsBinaryDictionary
(
this
,
Suggest
.
DIC_CONTACTS
,
mSubtypeSwitcher
.
getCurrentSubtypeLocale
());
final
Locale
locale
=
mSubtypeSwitcher
.
getCurrentSubtypeLocale
();
if
(
null
!=
oldContactsDictionary
)
{
if
(
USE_BINARY_CONTACTS_DICTIONARY
)
{
ContactsBinaryDictionary
oldContactsBinaryDictionary
=
(
ContactsBinaryDictionary
)
oldContactsDictionary
;
if
(!
oldContactsBinaryDictionary
.
mLocale
.
equals
(
locale
))
{
// If the locale has changed then recreate the contacts dictionary. This
// allows locale dependent rules for handling bigram name predictions.
oldContactsDictionary
.
close
();
dictionaryToUse
=
new
ContactsBinaryDictionary
(
this
,
Suggest
.
DIC_CONTACTS
,
locale
);
}
else
{
// Make sure the old contacts dictionary is opened. If it is already open,
// this is a no-op, so it's safe to call it anyways.
oldContactsBinaryDictionary
.
reopen
(
this
);
dictionaryToUse
=
oldContactsDictionary
;
}
}
else
{
((
ContactsDictionary
)
oldContactsDictionary
).
reopen
(
this
);
dictionaryToUse
=
oldContactsDictionary
;
}
}
else
{
dictionaryToUse
=
new
ContactsDictionary
(
this
,
Suggest
.
DIC_CONTACTS
);
if
(
USE_BINARY_CONTACTS_DICTIONARY
)
{
dictionaryToUse
=
new
ContactsBinaryDictionary
(
this
,
Suggest
.
DIC_CONTACTS
,
locale
);
}
else
{
dictionaryToUse
=
new
ContactsDictionary
(
this
,
Suggest
.
DIC_CONTACTS
);
}
}
}
...
...
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