Add an option for using bigram prediction.

This change adds the option for bigram prediction under the option
for bigram suggestion. The "prediction" option depends on the
"suggestion" option.
This change also reorders a tad bit the settings screen. Namely, it
sticks both bigram options under a "bigram" category, and groups the
options that did not have a group under a "other options", or misc,
category.
Finally this change also renames the internal name of the "text
corrections" option category to "correction_category" instead of
"prediction_category" which was misleading.

Change-Id: I2d8787c8a391fd8202ed3a686c613494b7260a1e
diff --git a/java/res/values/config.xml b/java/res/values/config.xml
index 300aaa4..77259b1 100644
--- a/java/res/values/config.xml
+++ b/java/res/values/config.xml
@@ -37,7 +37,12 @@
     <bool name="config_default_popup_preview">true</bool>
     <!-- Default values for whether quick fixes and bigram suggestions are activated -->
     <bool name="config_default_quick_fixes">true</bool>
+    <!-- Default value for bigram suggestion: while showing candidates for a word should we weigh
+         in the previous word? -->
     <bool name="config_default_bigram_suggestions">true</bool>
+    <!-- Default value for bigram prediction: after entering a word and a space only, should we look
+         at input history to suggest a hopefully helpful candidate for the next word? -->
+    <bool name="config_default_bigram_prediction">false</bool>
     <bool name="config_default_recorrection_enabled">true</bool>
     <bool name="config_default_sound_enabled">false</bool>
     <bool name="config_use_spacebar_language_switcher">true</bool>
diff --git a/java/res/values/strings.xml b/java/res/values/strings.xml
index 66dc7d7..cfad5b1 100644
--- a/java/res/values/strings.xml
+++ b/java/res/values/strings.xml
@@ -38,7 +38,13 @@
     <string name="general_category">General</string>
 
     <!-- Category title for text prediction -->
-    <string name="prediction_category">Text correction</string>
+    <string name="correction_category">Text correction</string>
+
+    <!-- Category title for ngrams  -->
+    <string name="ngram_category">Suggestions based on previous words</string>
+
+    <!-- Category title for misc options  -->
+    <string name="misc_category">Other options</string>
 
     <!-- Option to enable auto capitalization of sentences -->
     <string name="auto_cap">Auto-capitalization</string>
@@ -78,9 +84,13 @@
     <string name="auto_correction_threshold_mode_aggeressive">Aggressive</string>
 
     <!-- Option to enable bigram correction -->
-    <string name="bigram_suggestion">Bigram Suggestions</string>
+    <string name="bigram_suggestion">Bigram suggestions</string>
     <!-- Description for auto correction -->
     <string name="bigram_suggestion_summary">Use previous word to improve suggestion</string>
+    <!-- Option to enable using user-history bigram when no input -->
+    <string name="bigram_prediction">Bigram prediction</string>
+    <!-- Description for auto correction -->
+    <string name="bigram_prediction_summary">Use previous word also for prediction</string>
 
     <!-- Indicates that a word has been added to the dictionary -->
     <string name="added_word"><xliff:g id="word">%s</xliff:g> : Saved</string>
diff --git a/java/res/xml/prefs.xml b/java/res/xml/prefs.xml
index cbfc3c3..24a1d45 100644
--- a/java/res/xml/prefs.xml
+++ b/java/res/xml/prefs.xml
@@ -66,8 +66,8 @@
             android:summary="@string/language_selection_summary" />
     </PreferenceCategory>
     <PreferenceCategory
-        android:title="@string/prediction_category"
-        android:key="prediction_settings">
+        android:title="@string/correction_category"
+        android:key="correction_settings">
         <CheckBoxPreference
             android:key="quick_fixes"
             android:title="@string/quick_fixes"
@@ -90,31 +90,46 @@
             android:entryValues="@array/prefs_suggestion_visibility_values"
             android:entries="@array/prefs_suggestion_visibilities"
             android:defaultValue="@string/prefs_suggestion_visibility_default_value" />
+    </PreferenceCategory>
+    <PreferenceCategory
+        android:title="@string/ngram_category"
+        android:key="ngram_settings">
         <CheckBoxPreference
             android:key="bigram_suggestion"
             android:title="@string/bigram_suggestion"
             android:summary="@string/bigram_suggestion_summary"
             android:persistent="true"
             android:defaultValue="true" />
+        <CheckBoxPreference
+            android:key="bigram_prediction"
+            android:dependency="bigram_suggestion"
+            android:title="@string/bigram_prediction"
+            android:summary="@string/bigram_prediction_summary"
+            android:persistent="true"
+            android:defaultValue="false" />
     </PreferenceCategory>
-    <CheckBoxPreference
-        android:key="usability_study_mode"
-        android:title="@string/prefs_usability_study_mode"
-        android:persistent="true"
-        android:defaultValue="false" />
-    <CheckBoxPreference
-        android:key="enable_logging"
-        android:title="@string/prefs_enable_log"
-        android:summary="@string/prefs_description_log"
-        android:persistent="true"
-        android:defaultValue="true" />
-    <ListPreference
-        android:key="pref_keyboard_layout_20100902"
-        android:title="@string/keyboard_layout"
-        android:persistent="true"
-        android:entryValues="@array/keyboard_layout_modes_values"
-        android:entries="@array/keyboard_layout_modes"
-        android:defaultValue="@string/config_default_keyboard_theme_id" />
+    <PreferenceCategory
+        android:title="@string/misc_category"
+        android:key="misc_settings">
+      <CheckBoxPreference
+          android:key="usability_study_mode"
+          android:title="@string/prefs_usability_study_mode"
+          android:persistent="true"
+          android:defaultValue="false" />
+      <CheckBoxPreference
+          android:key="enable_logging"
+          android:title="@string/prefs_enable_log"
+          android:summary="@string/prefs_description_log"
+          android:persistent="true"
+          android:defaultValue="true" />
+      <ListPreference
+          android:key="pref_keyboard_layout_20100902"
+          android:title="@string/keyboard_layout"
+          android:persistent="true"
+          android:entryValues="@array/keyboard_layout_modes_values"
+          android:entries="@array/keyboard_layout_modes"
+          android:defaultValue="@string/config_default_keyboard_theme_id" />
+    </PreferenceCategory>
     <!-- <Preference
         android:title="Debug Settings"
         android:key="debug_settings">