Add an auto complete's threshold option.

Change-Id: I3a6821ced8642ab8f954e79a25e31766e4a18eb8
diff --git a/java/res/values/config.xml b/java/res/values/config.xml
index 6e941ba..5b5656d 100644
--- a/java/res/values/config.xml
+++ b/java/res/values/config.xml
@@ -25,4 +25,14 @@
     <integer name="config_preview_fadeout_anim_time">90</integer>
     <integer name="config_mini_keyboard_fadein_anim_time">0</integer>
     <integer name="config_mini_keyboard_fadeout_anim_time">100</integer>
+    <string-array name="auto_complete_threshold_values">
+        <!-- Off, When auto completing setting is Off, this value is not used. -->
+        <item></item>
+        <!-- Modest : Suggestion whose normalized score is greater than this value
+             will be subject to auto-completion. -->
+        <item>0.22</item>
+        <!-- Aggressive : Suggestion whose normalized score is greater than this value
+             will be subject to auto-completion. -->
+        <item>0</item>
+    </string-array>
 </resources>
diff --git a/java/res/values/strings.xml b/java/res/values/strings.xml
index a4ebe46..94fe76d 100644
--- a/java/res/values/strings.xml
+++ b/java/res/values/strings.xml
@@ -86,11 +86,6 @@
     <!-- Description for show suggestions -->
     <string name="show_suggestions_summary">Display suggested words while typing</string>
     
-    <!-- Option to enable auto completion -->
-    <string name="auto_complete">Auto-complete</string>
-    <!-- Description for auto completion -->
-    <string name="auto_complete_summary">Spacebar and punctuation automatically insert highlighted word</string>
-    
     <!-- Option to show/hide the settings key -->
     <string name="prefs_settings_key">Show settings key</string>
     <!-- Array of the settings key mode values -->
@@ -112,6 +107,31 @@
         <item>@string/settings_key_mode_always_hide_name</item>
     </string-array>
 
+    <!-- Option to decide the auto completion threshold score -->
+    <!-- Option to enable auto completion -->
+    <string name="auto_complete">Auto-complete</string>
+    <!-- Description for auto completion -->
+    <string name="auto_complete_summary">Spacebar and punctuation automatically insert highlighted word</string>
+    <string name="auto_completion_threshold_mode_value_off" translatable="false">0</string>
+    <string name="auto_completion_threshold_mode_value_modest" translatable="false">1</string>
+    <string name="auto_completion_threshold_mode_value_aggeressive" translatable="false">2</string>
+    <string-array name="auto_completion_threshold_mode_values" translatable="false">
+      <item>@string/auto_completion_threshold_mode_value_off</item>
+      <item>@string/auto_completion_threshold_mode_value_modest</item>
+      <item>@string/auto_completion_threshold_mode_value_aggeressive</item>
+    </string-array>
+    <!-- Option to disable auto completion. -->
+    <string name="auto_completion_threshold_mode_off">Off</string>
+    <!-- Option to use modest auto completion. -->
+    <string name="auto_completion_threshold_mode_modest">Modest</string>
+    <!-- Option to use aggressive auto completion. -->
+    <string name="auto_completion_threshold_mode_aggeressive">Aggressive</string>
+    <string-array name="auto_completion_threshold_modes">
+      <item>@string/auto_completion_threshold_mode_off</item>
+      <item>@string/auto_completion_threshold_mode_modest</item>
+      <item>@string/auto_completion_threshold_mode_aggeressive</item>
+    </string-array>
+
     <!-- Option to enable bigram completion -->
     <string name="bigram_suggestion">Bigram Suggestions</string>
     <!-- Description for auto completion -->
diff --git a/java/res/xml/prefs.xml b/java/res/xml/prefs.xml
index 8a97109..e7a3945 100644
--- a/java/res/xml/prefs.xml
+++ b/java/res/xml/prefs.xml
@@ -97,13 +97,14 @@
             android:defaultValue="true"
             />
 
-        <CheckBoxPreference
-            android:key="auto_complete"
+        <ListPreference
+            android:key="auto_completion_threshold"
             android:title="@string/auto_complete"
             android:summary="@string/auto_complete_summary"
-            android:persistent="true" 
-            android:defaultValue="@bool/enable_autocorrect"
-            android:dependency="show_suggestions"
+            android:persistent="true"
+            android:entryValues="@array/auto_completion_threshold_mode_values"
+            android:entries="@array/auto_completion_threshold_modes"
+            android:defaultValue="@string/auto_completion_threshold_mode_value_modest"
             />
 
         <CheckBoxPreference
@@ -112,7 +113,6 @@
             android:summary="@string/bigram_suggestion_summary"
             android:persistent="true"
             android:defaultValue="true"
-            android:dependency="auto_complete"
             />
     </PreferenceCategory>