Add showing suggestion only on portrait mode and fixing the state of suggestion strip

Change-Id: I7babd1400a3516c87506a3ea4bd46ddaf89e19b4
diff --git a/java/res/values-xlarge/donottranslate.xml b/java/res/values-xlarge/donottranslate.xml
new file mode 100644
index 0000000..6f4e9b1
--- /dev/null
+++ b/java/res/values-xlarge/donottranslate.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+**
+** Copyright 2010, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+**     http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+-->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+    <!--  Default value of the visibility of the suggestion strip -->
+    <string name="prefs_suggestion_visibility_default_value" translatable="false">1</string>
+</resources>
diff --git a/java/res/values/donottranslate.xml b/java/res/values/donottranslate.xml
index a7c1fcd..ffd6cce 100644
--- a/java/res/values/donottranslate.xml
+++ b/java/res/values/donottranslate.xml
@@ -32,4 +32,14 @@
     <string name="settings_key_mode_always_show" translatable="false">1</string>
     <!-- Always hide the settings key -->
     <string name="settings_key_mode_always_hide" translatable="false">2</string>
+
+    <!--  Always show the suggestion strip -->
+    <string name="prefs_suggestion_visibility_show_value" translatable="false">0</string>
+    <!--  Show the suggestion strip only on portrait mode -->
+    <string name="prefs_suggestion_visibility_show_only_portrait_value" translatable="false">1</string>
+    <!--  Always hide the suggestion strip -->
+    <string name="prefs_suggestion_visibility_hide_value" translatable="false">2</string>
+    <!--  Default value of the visibility of the suggestion strip -->
+    <string name="prefs_suggestion_visibility_default_value" translatable="false">0</string>
+
 </resources>
diff --git a/java/res/values/strings.xml b/java/res/values/strings.xml
index a1a8112..005fe5e 100644
--- a/java/res/values/strings.xml
+++ b/java/res/values/strings.xml
@@ -82,10 +82,24 @@
     <string name="quick_fixes_summary">Corrects commonly typed mistakes</string>
     
     <!-- Option to enable showing suggestions -->
-    <string name="show_suggestions">Show suggestions</string>
+    <string name="prefs_show_suggestions">Show suggestions</string>
     <!-- Description for show suggestions -->
-    <string name="show_suggestions_summary">Display suggested words while typing</string>
-    
+    <string name="prefs_show_suggestions_summary">Display suggested words while typing</string>
+    <!--  Option to show/hide the suggestion strip -->
+    <string-array name="prefs_suggestion_visibility_values" translatable="false">
+       <item>@string/prefs_suggestion_visibility_show_value</item>
+       <item>@string/prefs_suggestion_visibility_show_only_portrait_value</item>
+       <item>@string/prefs_suggestion_visibility_hide_value</item>
+    </string-array>
+    <string name="prefs_suggestion_visibility_show_name">Always show</string>
+    <string name="prefs_suggestion_visibility_show_only_portrait_name">Show on portrait mode</string>
+    <string name="prefs_suggestion_visibility_hide_name">Always hide</string>
+    <string-array name="prefs_suggestion_visibilities" translatable="false">
+       <item>@string/prefs_suggestion_visibility_show_name</item>
+       <item>@string/prefs_suggestion_visibility_show_only_portrait_name</item>
+       <item>@string/prefs_suggestion_visibility_hide_name</item>
+    </string-array>
+
     <!-- Option to show/hide the settings key -->
     <string name="prefs_settings_key">Show settings key</string>
     <!-- Array of the settings key mode values -->
diff --git a/java/res/xml/prefs.xml b/java/res/xml/prefs.xml
index af1396c..2ca1af9 100644
--- a/java/res/xml/prefs.xml
+++ b/java/res/xml/prefs.xml
@@ -90,12 +90,14 @@
             android:defaultValue="true"
             />
 
-        <CheckBoxPreference
-            android:key="show_suggestions"
-            android:title="@string/show_suggestions"
-            android:summary="@string/show_suggestions_summary"
+        <ListPreference
+            android:key="show_suggestions_setting"
+            android:summary="@string/prefs_show_suggestions_summary"
+            android:title="@string/prefs_show_suggestions"
             android:persistent="true"
-            android:defaultValue="true"
+            android:entryValues="@array/prefs_suggestion_visibility_values"
+            android:entries="@array/prefs_suggestion_visibilities"
+            android:defaultValue="@string/prefs_suggestion_visibility_default_value"
             />
 
         <ListPreference