From c5e911c06b2ab21d3fd2026a307727dccdca911c Mon Sep 17 00:00:00 2001 From: Jean Chalard <jchalard@google.com> Date: Thu, 28 Jun 2012 20:34:06 +0900 Subject: [PATCH] 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 --- java/src/com/android/inputmethod/latin/AutoCorrection.java | 3 ++- java/src/com/android/inputmethod/latin/Suggest.java | 3 +-- 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 8fa3469538..c78974dac1 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 ccbb84f356..dcfda86ea4 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; } -- GitLab