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
43ebd8a0
Commit
43ebd8a0
authored
12 years ago
by
satok
Browse files
Options
Downloads
Patches
Plain Diff
Fix the locale of flags in BinaryDictionary
Bug: 6129372 Change-Id: I4958c2aabf651d7e26648a29b75fcc6c77813451
parent
b082c95a
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
java/src/com/android/inputmethod/latin/BinaryDictionary.java
+16
-3
16 additions, 3 deletions
java/src/com/android/inputmethod/latin/BinaryDictionary.java
java/src/com/android/inputmethod/latin/DictionaryFactory.java
+4
-3
4 additions, 3 deletions
.../src/com/android/inputmethod/latin/DictionaryFactory.java
with
20 additions
and
6 deletions
java/src/com/android/inputmethod/latin/BinaryDictionary.java
+
16
−
3
View file @
43ebd8a0
...
...
@@ -17,10 +17,14 @@
package
com.android.inputmethod.latin
;
import
android.content.Context
;
import
android.content.res.AssetFileDescriptor
;
import
android.content.res.Resources
;
import
com.android.inputmethod.keyboard.ProximityInfo
;
import
com.android.inputmethod.latin.LocaleUtils.RunInLocale
;
import
java.util.Arrays
;
import
java.util.Locale
;
/**
* Implements a static, compacted, binary dictionary of standard words.
...
...
@@ -94,14 +98,23 @@ public class BinaryDictionary extends Dictionary {
* @param flagArray the flags to limit the dictionary to, or null for default.
*/
public
BinaryDictionary
(
final
Context
context
,
final
String
filename
,
final
long
offset
,
final
long
length
,
Flag
[]
flagArray
)
{
final
String
filename
,
final
long
offset
,
final
long
length
,
final
Flag
[]
flagArray
,
Locale
locale
)
{
// Note: at the moment a binary dictionary is always of the "main" type.
// Initializing this here will help transitioning out of the scheme where
// the Suggest class knows everything about every single dictionary.
mDicTypeId
=
Suggest
.
DIC_MAIN
;
// TODO: Stop relying on the state of SubtypeSwitcher, get it as a parameter
mFlags
=
Flag
.
initFlags
(
null
==
flagArray
?
ALL_CONFIG_FLAGS
:
flagArray
,
context
,
SubtypeSwitcher
.
getInstance
());
final
RunInLocale
<
Void
>
job
=
new
RunInLocale
<
Void
>()
{
@Override
protected
Void
job
(
Resources
res
)
{
// TODO: remove this when all flags are moved to the native code
mFlags
=
Flag
.
initFlags
(
null
==
flagArray
?
ALL_CONFIG_FLAGS
:
flagArray
,
context
,
SubtypeSwitcher
.
getInstance
());
return
null
;
}
};
job
.
runInLocale
(
context
.
getResources
(),
locale
);
loadDictionary
(
filename
,
offset
,
length
);
}
...
...
This diff is collapsed.
Click to expand it.
java/src/com/android/inputmethod/latin/DictionaryFactory.java
+
4
−
3
View file @
43ebd8a0
...
...
@@ -59,7 +59,8 @@ public class DictionaryFactory {
if
(
null
!=
assetFileList
)
{
for
(
final
AssetFileAddress
f
:
assetFileList
)
{
final
BinaryDictionary
binaryDictionary
=
new
BinaryDictionary
(
context
,
f
.
mFilename
,
f
.
mOffset
,
f
.
mLength
,
flagArray
);
new
BinaryDictionary
(
context
,
f
.
mFilename
,
f
.
mOffset
,
f
.
mLength
,
flagArray
,
locale
);
if
(
binaryDictionary
.
isValidDictionary
())
{
dictList
.
add
(
binaryDictionary
);
}
...
...
@@ -119,7 +120,7 @@ public class DictionaryFactory {
return
null
;
}
return
new
BinaryDictionary
(
context
,
sourceDir
,
afd
.
getStartOffset
(),
afd
.
getLength
(),
null
);
sourceDir
,
afd
.
getStartOffset
(),
afd
.
getLength
(),
null
,
locale
);
}
catch
(
android
.
content
.
res
.
Resources
.
NotFoundException
e
)
{
Log
.
e
(
TAG
,
"Could not find the resource. resId="
+
resId
);
return
null
;
...
...
@@ -147,7 +148,7 @@ public class DictionaryFactory {
long
startOffset
,
long
length
,
Flag
[]
flagArray
)
{
if
(
dictionary
.
isFile
())
{
return
new
BinaryDictionary
(
context
,
dictionary
.
getAbsolutePath
(),
startOffset
,
length
,
flagArray
);
flagArray
,
null
);
}
else
{
Log
.
e
(
TAG
,
"Could not find the file. path="
+
dictionary
.
getAbsolutePath
());
return
null
;
...
...
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