aboutsummaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
authorBaligh Uddin <baligh@google.com>2013-05-15 11:40:41 -0700
committerBaligh Uddin <baligh@google.com>2013-05-15 11:40:41 -0700
commitc363302eb7ee43c8ab025a799b84b85c2069b2f7 (patch)
treee96d70dcff952ec923910747eda6f2e40bd413ce /java
parent1e08d3d25930696e4614db53765d063a67e2b09a (diff)
parent3ac40c6ae4c6288fec50ed09549cb7a39c816ee0 (diff)
downloadlatinime-c363302eb7ee43c8ab025a799b84b85c2069b2f7.tar.gz
latinime-c363302eb7ee43c8ab025a799b84b85c2069b2f7.tar.xz
latinime-c363302eb7ee43c8ab025a799b84b85c2069b2f7.zip
Merge commit '3ac40c6a' into jb-mr2-dev-plus-aosp
Conflicts: java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java Conflict resolved by matching code with jb-mr2-dev.
Diffstat (limited to 'java')
-rw-r--r--java/res/values/config.xml3
-rw-r--r--java/src/com/android/inputmethod/latin/JniUtils.java14
-rw-r--r--java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java13
3 files changed, 12 insertions, 18 deletions
diff --git a/java/res/values/config.xml b/java/res/values/config.xml
index 5b11e0711..33e6a868c 100644
--- a/java/res/values/config.xml
+++ b/java/res/values/config.xml
@@ -119,9 +119,6 @@
<!-- Threshold of the normalized score of the best suggestion for the spell checker to declare
a word to be "recommended" -->
<string name="spellchecker_recommended_threshold_value" translatable="false">0.11</string>
- <!-- Threshold of the normalized score of any dictionary lookup to be offered as a suggestion
- by the spell checker -->
- <string name="spellchecker_suggestion_threshold_value" translatable="false">0.03</string>
<!-- Screen metrics for logging.
0 = "mdpi phone screen"
1 = "hdpi phone screen"
diff --git a/java/src/com/android/inputmethod/latin/JniUtils.java b/java/src/com/android/inputmethod/latin/JniUtils.java
index f9305991a..8aedee576 100644
--- a/java/src/com/android/inputmethod/latin/JniUtils.java
+++ b/java/src/com/android/inputmethod/latin/JniUtils.java
@@ -23,15 +23,19 @@ import com.android.inputmethod.latin.define.JniLibName;
public final class JniUtils {
private static final String TAG = JniUtils.class.getSimpleName();
- private JniUtils() {
- // This utility class is not publicly instantiable.
- }
-
- public static void loadNativeLibrary() {
+ static {
try {
System.loadLibrary(JniLibName.JNI_LIB_NAME);
} catch (UnsatisfiedLinkError ule) {
Log.e(TAG, "Could not load native library " + JniLibName.JNI_LIB_NAME, ule);
}
}
+
+ private JniUtils() {
+ // This utility class is not publicly instantiable.
+ }
+
+ public static void loadNativeLibrary() {
+ // Ensures the static initializer is called
+ }
}
diff --git a/java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java b/java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java
index 166705954..aa60496ae 100644
--- a/java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java
+++ b/java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java
@@ -64,8 +64,6 @@ public final class AndroidSpellCheckerService extends SpellCheckerService
CollectionUtils.newSynchronizedTreeMap();
private ContactsBinaryDictionary mContactsDictionary;
- // The threshold for a candidate to be offered as a suggestion.
- private float mSuggestionThreshold;
// The threshold for a suggestion to be considered "recommended".
private float mRecommendedThreshold;
// Whether to use the contacts dictionary
@@ -112,8 +110,6 @@ public final class AndroidSpellCheckerService extends SpellCheckerService
@Override public void onCreate() {
super.onCreate();
- mSuggestionThreshold =
- Float.parseFloat(getString(R.string.spellchecker_suggestion_threshold_value));
mRecommendedThreshold =
Float.parseFloat(getString(R.string.spellchecker_recommended_threshold_value));
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
@@ -198,8 +194,7 @@ public final class AndroidSpellCheckerService extends SpellCheckerService
}
public SuggestionsGatherer newSuggestionsGatherer(final String text, int maxLength) {
- return new SuggestionsGatherer(
- text, mSuggestionThreshold, mRecommendedThreshold, maxLength);
+ return new SuggestionsGatherer(text, mRecommendedThreshold, maxLength);
}
// TODO: remove this class and replace it by storage local to the session.
@@ -217,7 +212,6 @@ public final class AndroidSpellCheckerService extends SpellCheckerService
private final ArrayList<String> mSuggestions;
private final int[] mScores;
private final String mOriginalText;
- private final float mSuggestionThreshold;
private final float mRecommendedThreshold;
private final int mMaxLength;
private int mLength = 0;
@@ -227,10 +221,9 @@ public final class AndroidSpellCheckerService extends SpellCheckerService
private String mBestSuggestion = null;
private int mBestScore = Integer.MIN_VALUE; // As small as possible
- SuggestionsGatherer(final String originalText, final float suggestionThreshold,
- final float recommendedThreshold, final int maxLength) {
+ SuggestionsGatherer(final String originalText, final float recommendedThreshold,
+ final int maxLength) {
mOriginalText = originalText;
- mSuggestionThreshold = suggestionThreshold;
mRecommendedThreshold = recommendedThreshold;
mMaxLength = maxLength;
mSuggestions = CollectionUtils.newArrayList(maxLength + 1);