aboutsummaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
authorKurt Partridge <kep@google.com>2012-12-18 12:25:30 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-12-18 12:25:31 -0800
commitbaf73311cde23b2bc3b2d9e4d0fd5ba3ebda3687 (patch)
tree0393c5b8984ddd1e378b7ec2b4e1abbe4cafae42 /java
parentce8b139124b703ef4409520a721b77a6879cc82c (diff)
parent40417aed94a32dcd4d6a4c469320e2d6ddf83865 (diff)
downloadlatinime-baf73311cde23b2bc3b2d9e4d0fd5ba3ebda3687.tar.gz
latinime-baf73311cde23b2bc3b2d9e4d0fd5ba3ebda3687.tar.xz
latinime-baf73311cde23b2bc3b2d9e4d0fd5ba3ebda3687.zip
Merge "[Rlog6] ResearchLogger fix dictionary loading"
Diffstat (limited to 'java')
-rw-r--r--java/src/com/android/inputmethod/research/ResearchLogger.java18
1 files changed, 13 insertions, 5 deletions
diff --git a/java/src/com/android/inputmethod/research/ResearchLogger.java b/java/src/com/android/inputmethod/research/ResearchLogger.java
index 89cc8d751..38c30017d 100644
--- a/java/src/com/android/inputmethod/research/ResearchLogger.java
+++ b/java/src/com/android/inputmethod/research/ResearchLogger.java
@@ -136,7 +136,6 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
// used to check whether words are not unique
private Suggest mSuggest;
- private Dictionary mDictionary;
private MainKeyboardView mMainKeyboardView;
private InputMethodService mInputMethodService;
private final Statistics mStatistics;
@@ -597,6 +596,13 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
}
}
+ private Dictionary getDictionary() {
+ if (mSuggest == null) {
+ return null;
+ }
+ return mSuggest.getMainDictionary();
+ }
+
private void setIsPasswordView(boolean isPasswordView) {
mIsPasswordView = isPasswordView;
}
@@ -726,10 +732,11 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
private static final LogStatement LOGSTATEMENT_COMMIT_RECORD_SPLIT_WORDS =
new LogStatement("recordSplitWords", true, false);
private void onWordComplete(final String word, final long maxTime, final boolean isSplitWords) {
+ final Dictionary dictionary = getDictionary();
if (word != null && word.length() > 0 && hasLetters(word)) {
mCurrentLogUnit.setWord(word);
- final boolean isDictionaryWord = mDictionary != null
- && mDictionary.isValidWord(word);
+ final boolean isDictionaryWord = dictionary != null
+ && dictionary.isValidWord(word);
mStatistics.recordWordEntered(isDictionaryWord);
}
final LogUnit newLogUnit = mCurrentLogUnit.splitByTime(maxTime);
@@ -784,10 +791,11 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
}
private String scrubWord(String word) {
- if (mDictionary == null) {
+ final Dictionary dictionary = getDictionary();
+ if (dictionary == null) {
return WORD_REPLACEMENT_STRING;
}
- if (mDictionary.isValidWord(word)) {
+ if (dictionary.isValidWord(word)) {
return word;
}
return WORD_REPLACEMENT_STRING;