Merge "Split tablet symbols and symbols shifted layout into separated rows"
diff --git a/java/res/xml-sw600dp/rows_greek.xml b/java/res/xml-sw600dp/rows_greek.xml
index c77627e..dab7f90 100644
--- a/java/res/xml-sw600dp/rows_greek.xml
+++ b/java/res/xml-sw600dp/rows_greek.xml
@@ -27,7 +27,10 @@
         latin:keyWidth="9.0%p"
     >
         <Key
-            latin:keyLabel=";" />
+            latin:keyLabel=";"
+            latin:keyHintLabel=":"
+            latin:moreKeys=":"
+            latin:keyStyle="hasShiftedLetterHintStyle" />
         <!-- TODO: Should find a way to compound Greek dialytika tonos and other Greek letters. -->
         <!--
         <switch>
diff --git a/java/res/xml-sw768dp/rows_greek.xml b/java/res/xml-sw768dp/rows_greek.xml
index e9a76a5..7c90724 100644
--- a/java/res/xml-sw768dp/rows_greek.xml
+++ b/java/res/xml-sw768dp/rows_greek.xml
@@ -31,7 +31,10 @@
             latin:keyLabelFlags="alignLeft"
             latin:keyWidth="7.969%p" />
         <Key
-            latin:keyLabel=";" />
+            latin:keyLabel=";"
+            latin:keyHintLabel=":"
+            latin:moreKeys=":"
+            latin:keyStyle="hasShiftedLetterHintStyle" />
         <!-- TODO: Should find a way to compound Greek dialytika tonos and other Greek letters. -->
         <!--
         <switch>
diff --git a/java/res/xml/rows_greek.xml b/java/res/xml/rows_greek.xml
index 1602c50..24b5c18 100644
--- a/java/res/xml/rows_greek.xml
+++ b/java/res/xml/rows_greek.xml
@@ -26,10 +26,24 @@
     <Row
         latin:keyWidth="10%p"
     >
-        <Key
-            latin:keyLabel=";"
-            latin:keyHintLabel="1"
-            latin:additionalMoreKeys="1" />
+        <switch>
+            <case
+                latin:keyboardSetElement="alphabetManualShifted|alphabetShiftLockShifted"
+            >
+                <Key
+                    latin:keyLabel=":"
+                    latin:keyHintLabel="1"
+                    latin:moreKeys=";"
+                    latin:additionalMoreKeys="1" />
+            </case>
+            <default>
+                <Key
+                    latin:keyLabel=";"
+                    latin:keyHintLabel="1"
+                    latin:moreKeys=":"
+                    latin:additionalMoreKeys="1" />
+            </default>
+        </switch>
         <!-- TODO: Should find a way to compound Greek dialytika tonos and other Greek letters. -->
         <!--
         <switch>
diff --git a/java/src/com/android/inputmethod/latin/AutoCorrection.java b/java/src/com/android/inputmethod/latin/AutoCorrection.java
index c4c9446..9754d15 100644
--- a/java/src/com/android/inputmethod/latin/AutoCorrection.java
+++ b/java/src/com/android/inputmethod/latin/AutoCorrection.java
@@ -25,30 +25,25 @@
 public class AutoCorrection {
     private static final boolean DBG = LatinImeLogger.sDBG;
     private static final String TAG = AutoCorrection.class.getSimpleName();
-    private CharSequence mAutoCorrectionWord;
 
-    public void init() {
-        mAutoCorrectionWord = null;
+    private AutoCorrection() {
+        // Purely static class: can't instantiate.
     }
 
-    public boolean hasAutoCorrection() {
-        return null != mAutoCorrectionWord;
-    }
-
-    public CharSequence updateAutoCorrectionStatus(Map<String, Dictionary> dictionaries,
+    public static CharSequence computeAutoCorrectionWord(Map<String, Dictionary> dictionaries,
             WordComposer wordComposer, ArrayList<CharSequence> suggestions, int[] sortedScores,
             CharSequence typedWord, double autoCorrectionThreshold, int correctionMode,
             CharSequence whitelistedWord) {
         if (hasAutoCorrectionForWhitelistedWord(whitelistedWord)) {
-            mAutoCorrectionWord = whitelistedWord;
+            return whitelistedWord;
         } else if (hasAutoCorrectionForTypedWord(
                 dictionaries, wordComposer, suggestions, typedWord, correctionMode)) {
-            mAutoCorrectionWord = typedWord;
+            return typedWord;
         } else if (hasAutoCorrectionForBinaryDictionary(wordComposer, suggestions, correctionMode,
                 sortedScores, typedWord, autoCorrectionThreshold)) {
-            mAutoCorrectionWord = suggestions.get(0);
+            return suggestions.get(0);
         }
-        return mAutoCorrectionWord;
+        return null;
     }
 
     public static boolean isValidWord(
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index 73a9689..e1ca854 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -1869,7 +1869,8 @@
                 builder.addTypedWordAndPreviousSuggestions(typedWord, previousSuggestions);
             }
         }
-        if (Suggest.shouldBlockAutoCorrectionBySafetyNet(builder, mSuggest)) {
+        if (Suggest.shouldBlockAutoCorrectionBySafetyNet(builder, mSuggest,
+                mSettingsValues.mAutoCorrectionThreshold)) {
             builder.setShouldBlockAutoCorrectionBySafetyNet();
         }
         showSuggestions(builder.build(), typedWord);
diff --git a/java/src/com/android/inputmethod/latin/Suggest.java b/java/src/com/android/inputmethod/latin/Suggest.java
index 19655f2..a213160 100644
--- a/java/src/com/android/inputmethod/latin/Suggest.java
+++ b/java/src/com/android/inputmethod/latin/Suggest.java
@@ -83,7 +83,7 @@
 
     private static final boolean DBG = LatinImeLogger.sDBG;
 
-    private AutoCorrection mAutoCorrection;
+    private boolean mHasAutoCorrection;
 
     private Dictionary mMainDict;
     private ContactsDictionary mContactsDict;
@@ -124,7 +124,6 @@
     private void initWhitelistAndAutocorrectAndPool(final Context context, final Locale locale) {
         mWhiteListDictionary = new WhitelistDictionary(context, locale);
         addOrReplaceDictionary(mUnigramDictionaries, DICT_KEY_WHITELIST, mWhiteListDictionary);
-        mAutoCorrection = new AutoCorrection();
         StringBuilderPool.ensureCapacity(mPrefMaxSuggestions, getApproxMaxWordLength());
     }
 
@@ -219,10 +218,6 @@
         mAutoCorrectionThreshold = threshold;
     }
 
-    public boolean isAggressiveAutoCorrectionMode() {
-        return (mAutoCorrectionThreshold == 0);
-    }
-
     /**
      * Number of suggestions to generate from the input key sequence. This has
      * to be a number between 1 and 100 (inclusive).
@@ -272,7 +267,6 @@
             final WordComposer wordComposer, CharSequence prevWordForBigram,
             final ProximityInfo proximityInfo, final int correctionMode) {
         LatinImeLogger.onStartSuggestion(prevWordForBigram);
-        mAutoCorrection.init();
         mIsFirstCharCapitalized = wordComposer.isFirstCharCapitalized();
         mIsAllUpperCase = wordComposer.isAllUpperCase();
         mTrailingSingleQuotesCount = wordComposer.trailingSingleQuotesCount();
@@ -352,9 +346,11 @@
         CharSequence whitelistedWord = capitalizeWord(mIsAllUpperCase, mIsFirstCharCapitalized,
                 mWhiteListDictionary.getWhitelistedWord(consideredWordString));
 
-        mAutoCorrection.updateAutoCorrectionStatus(mUnigramDictionaries, wordComposer,
+        final CharSequence autoCorrection =
+                AutoCorrection.computeAutoCorrectionWord(mUnigramDictionaries, wordComposer,
                 mSuggestions, mScores, consideredWord, mAutoCorrectionThreshold, correctionMode,
                 whitelistedWord);
+        mHasAutoCorrection = (null != autoCorrection);
 
         if (whitelistedWord != null) {
             if (mTrailingSingleQuotesCount > 0) {
@@ -403,7 +399,7 @@
     }
 
     public boolean hasAutoCorrection() {
-        return mAutoCorrection.hasAutoCorrection();
+        return mHasAutoCorrection;
     }
 
     @Override
@@ -554,7 +550,8 @@
     // TODO: Resolve the inconsistencies between the native auto correction algorithms and
     // this safety net
     public static boolean shouldBlockAutoCorrectionBySafetyNet(
-            SuggestedWords.Builder suggestedWordsBuilder, Suggest suggest) {
+            final SuggestedWords.Builder suggestedWordsBuilder, final Suggest suggest,
+            final double autoCorrectionThreshold) {
         // Safety net for auto correction.
         // Actually if we hit this safety net, it's actually a bug.
         if (suggestedWordsBuilder.size() <= 1 || suggestedWordsBuilder.isTypedWordValid()) {
@@ -562,7 +559,7 @@
         }
         // If user selected aggressive auto correction mode, there is no need to use the safety
         // net.
-        if (suggest.isAggressiveAutoCorrectionMode()) {
+        if (0 == autoCorrectionThreshold) {
             return false;
         }
         final CharSequence typedWord = suggestedWordsBuilder.getWord(0);