From 6ffb5018c1355f70230d19899124633c92ce64f0 Mon Sep 17 00:00:00 2001 From: Jean Chalard Date: Tue, 13 Mar 2012 20:26:47 +0900 Subject: [PATCH] Straighten out the last bastion of the Builder ...and go for the kill Change-Id: I5ad57211b250d2578ca22a5dae93344d52f9da80 --- java/src/com/android/inputmethod/latin/Suggest.java | 11 +++++++++-- .../com/android/inputmethod/latin/SuggestedWords.java | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/java/src/com/android/inputmethod/latin/Suggest.java b/java/src/com/android/inputmethod/latin/Suggest.java index 28d3b4437..4dee4f3b4 100644 --- a/java/src/com/android/inputmethod/latin/Suggest.java +++ b/java/src/com/android/inputmethod/latin/Suggest.java @@ -437,13 +437,20 @@ public class Suggest implements Dictionary.WordCallback { } // Don't auto-correct words with multiple capital letter autoCorrectionAvailable &= !wordComposer.isMostlyCaps(); + final boolean shouldBlockAutoCorrectionBySatefyNet; + if (allowsToBeAutoCorrected && scoreInfoList.size() > 1 && mAutoCorrectionThreshold > 0 + && Suggest.shouldBlockAutoCorrectionBySafetyNet(typedWord, + scoreInfoList.get(1).mWord)) { + shouldBlockAutoCorrectionBySatefyNet = true; + } else { + shouldBlockAutoCorrectionBySatefyNet = false; + } builder = new SuggestedWords.Builder(scoreInfoList, !allowsToBeAutoCorrected /* typedWordValid */, autoCorrectionAvailable /* hasMinimalSuggestion */, allowsToBeAutoCorrected /* allowsToBeAutoCorrected */, false /* isPunctuationSuggestions */); - if (allowsToBeAutoCorrected && builder.size() > 1 && mAutoCorrectionThreshold > 0 - && Suggest.shouldBlockAutoCorrectionBySafetyNet(typedWord, builder.getWord(1))) { + if (shouldBlockAutoCorrectionBySatefyNet) { builder.setShouldBlockAutoCorrectionBySafetyNet(); } return builder; diff --git a/java/src/com/android/inputmethod/latin/SuggestedWords.java b/java/src/com/android/inputmethod/latin/SuggestedWords.java index feb26db5a..bc89941a1 100644 --- a/java/src/com/android/inputmethod/latin/SuggestedWords.java +++ b/java/src/com/android/inputmethod/latin/SuggestedWords.java @@ -170,7 +170,7 @@ public class SuggestedWords { } public static class SuggestedWordInfo { - private final CharSequence mWord; + public final CharSequence mWord; private final CharSequence mDebugString; private final boolean mPreviousSuggestedWord;