aboutsummaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2012-06-28 20:34:06 +0900
committerJean Chalard <jchalard@google.com>2012-07-04 11:51:51 +0900
commitc5e911c06b2ab21d3fd2026a307727dccdca911c (patch)
tree934f8f27e02884b20915b7b2e9469bbaf8c07e06 /java
parentf72b8f5662afb42b08eb88e92731d52f99df13e3 (diff)
downloadlatinime-c5e911c06b2ab21d3fd2026a307727dccdca911c.tar.gz
latinime-c5e911c06b2ab21d3fd2026a307727dccdca911c.tar.xz
latinime-c5e911c06b2ab21d3fd2026a307727dccdca911c.zip
Consolidate a method inside another (A45)
It's simpler to check the safety net directly inside the function that checks for auto-correction threshold. This introduces one very slight change in behavior. The value checked by the safety net is not any more the "typed word" but the "considered word", the difference being any possibly appended single quotes. E.g. the user types "this'''" : the typed word is "this'''" but the considered word is "this". This change in behavior can be considered a bugfix. Change-Id: Ia7ab4bc933183dfbd41bb00328e4c0b5ab76bc63
Diffstat (limited to 'java')
-rw-r--r--java/src/com/android/inputmethod/latin/AutoCorrection.java3
-rw-r--r--java/src/com/android/inputmethod/latin/Suggest.java3
2 files changed, 3 insertions, 3 deletions
diff --git a/java/src/com/android/inputmethod/latin/AutoCorrection.java b/java/src/com/android/inputmethod/latin/AutoCorrection.java
index 8fa346953..c78974dac 100644
--- a/java/src/com/android/inputmethod/latin/AutoCorrection.java
+++ b/java/src/com/android/inputmethod/latin/AutoCorrection.java
@@ -108,7 +108,8 @@ public class AutoCorrection {
if (DBG) {
Log.d(TAG, "Auto corrected by S-threshold.");
}
- return true;
+ return !shouldBlockAutoCorrectionBySafetyNet(consideredWord.toString(),
+ suggestion.mWord);
}
}
return false;
diff --git a/java/src/com/android/inputmethod/latin/Suggest.java b/java/src/com/android/inputmethod/latin/Suggest.java
index ccbb84f35..dcfda86ea 100644
--- a/java/src/com/android/inputmethod/latin/Suggest.java
+++ b/java/src/com/android/inputmethod/latin/Suggest.java
@@ -241,8 +241,7 @@ public class Suggest {
hasAutoCorrection = false;
} else if (AutoCorrection.suggestionExceedsAutoCorrectionThreshold(suggestionsSet.first(),
consideredWord, mAutoCorrectionThreshold)) {
- hasAutoCorrection = !AutoCorrection.shouldBlockAutoCorrectionBySafetyNet(typedWord,
- suggestionsSet.first().mWord);
+ hasAutoCorrection = true;
} else {
hasAutoCorrection = false;
}