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
fba1bd0e
Commit
fba1bd0e
authored
11 years ago
by
Ken Wakasa
Browse files
Options
Downloads
Patches
Plain Diff
Suppress exceptions that have always been happening.
Change-Id: I5f85a7a0f94ea9ecbe0c4a8caebcf551fa9c9669
parent
6ec0cf12
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/res/values/config.xml
+1
-1
1 addition, 1 deletion
java/res/values/config.xml
java/src/com/android/inputmethod/latin/settings/SettingsValues.java
+11
-6
11 additions, 6 deletions
...om/android/inputmethod/latin/settings/SettingsValues.java
with
12 additions
and
7 deletions
java/res/values/config.xml
+
1
−
1
View file @
fba1bd0e
...
...
@@ -103,7 +103,7 @@
-->
<string-array
name=
"auto_correction_threshold_values"
translatable=
"false"
>
<!-- Off, When auto correction setting is Off, this value is not used. -->
<item></item>
<item>
floatMaxValue
</item>
<!-- Modest : Suggestion whose normalized score is greater than this value
will be subject to auto-correction. -->
<item>
0.185
</item>
...
...
This diff is collapsed.
Click to expand it.
java/src/com/android/inputmethod/latin/settings/SettingsValues.java
+
11
−
6
View file @
fba1bd0e
...
...
@@ -45,8 +45,9 @@ import java.util.Locale;
*/
public
final
class
SettingsValues
{
private
static
final
String
TAG
=
SettingsValues
.
class
.
getSimpleName
();
// "floatNegativeInfinity" is a special marker string for Float.NEGATIVE_INFINITE
// currently used for auto-correction
// "floatMaxValue" and "floatNegativeInfinity" are special marker strings for
// Float.NEGATIVE_INFINITE and Float.MAX_VALUE. Currently used for auto-correction settings.
private
static
final
String
FLOAT_MAX_VALUE_MARKER_STRING
=
"floatMaxValue"
;
private
static
final
String
FLOAT_NEGATIVE_INFINITY_MARKER_STRING
=
"floatNegativeInfinity"
;
// From resources:
...
...
@@ -343,24 +344,28 @@ public final class SettingsValues {
final
String
[]
autoCorrectionThresholdValues
=
res
.
getStringArray
(
R
.
array
.
auto_correction_threshold_values
);
// When autoCorrectionThreshold is greater than 1.0, it's like auto correction is off.
float
autoCorrectionThreshold
=
Float
.
MAX_VALUE
;
final
float
autoCorrectionThreshold
;
try
{
final
int
arrayIndex
=
Integer
.
valueOf
(
currentAutoCorrectionSetting
);
if
(
arrayIndex
>=
0
&&
arrayIndex
<
autoCorrectionThresholdValues
.
length
)
{
final
String
val
=
autoCorrectionThresholdValues
[
arrayIndex
];
if
(
FLOAT_NEGATIVE_INFINITY_MARKER_STRING
.
equals
(
val
))
{
if
(
FLOAT_MAX_VALUE_MARKER_STRING
.
equals
(
val
))
{
autoCorrectionThreshold
=
Float
.
MAX_VALUE
;
}
else
if
(
FLOAT_NEGATIVE_INFINITY_MARKER_STRING
.
equals
(
val
))
{
autoCorrectionThreshold
=
Float
.
NEGATIVE_INFINITY
;
}
else
{
autoCorrectionThreshold
=
Float
.
parseFloat
(
val
);
}
}
else
{
autoCorrectionThreshold
=
Float
.
MAX_VALUE
;
}
}
catch
(
NumberFormatException
e
)
{
}
catch
(
final
NumberFormatException
e
)
{
// Whenever the threshold settings are correct, never come here.
autoCorrectionThreshold
=
Float
.
MAX_VALUE
;
Log
.
w
(
TAG
,
"Cannot load auto correction threshold setting."
+
" currentAutoCorrectionSetting: "
+
currentAutoCorrectionSetting
+
", autoCorrectionThresholdValues: "
+
Arrays
.
toString
(
autoCorrectionThresholdValues
),
e
);
return
Float
.
MAX_VALUE
;
}
return
autoCorrectionThreshold
;
}
...
...
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