From ab17fca519fa27af01d29a38c553e250c9e92a9e Mon Sep 17 00:00:00 2001
From: Amith Yamasani <>
Date: Thu, 9 Apr 2009 22:15:20 -0700
Subject: [PATCH] AI 145663: Disable auto-correction for Dream. Also fixes bug
 # 1776404.   Have a boolean resource to specify auto correction default: Will
 be turned on/off for different targets   and languages.   Move English
 dictionary to raw-en so that French locale doesn't get the English
 suggestions.   Make the LatinIME the default for supported latin languages.  
 BUG=1776404

Automated import of CL 145663
---
 res/values-cs/bools.xml                       | 22 ++++++++++++++++
 res/values-de/bools.xml                       | 22 ++++++++++++++++
 res/values-es/bools.xml                       | 22 ++++++++++++++++
 res/values-fr/bools.xml                       | 22 ++++++++++++++++
 res/values-it/bools.xml                       | 22 ++++++++++++++++
 res/values-nl/bools.xml                       | 22 ++++++++++++++++
 res/values-pl/bools.xml                       | 22 ++++++++++++++++
 res/values/bools.xml                          | 26 +++++++++++++++++++
 res/xml/prefs.xml                             |  2 +-
 .../android/inputmethod/latin/LatinIME.java   |  3 ++-
 10 files changed, 183 insertions(+), 2 deletions(-)
 create mode 100644 res/values-cs/bools.xml
 create mode 100644 res/values-de/bools.xml
 create mode 100644 res/values-es/bools.xml
 create mode 100644 res/values-fr/bools.xml
 create mode 100644 res/values-it/bools.xml
 create mode 100644 res/values-nl/bools.xml
 create mode 100644 res/values-pl/bools.xml
 create mode 100644 res/values/bools.xml

diff --git a/res/values-cs/bools.xml b/res/values-cs/bools.xml
new file mode 100644
index 0000000000..897f4b3db0
--- /dev/null
+++ b/res/values-cs/bools.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/* 
+**
+** Copyright 2008, 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>
+	<bool name="im_is_default">true</bool>
+</resources>
diff --git a/res/values-de/bools.xml b/res/values-de/bools.xml
new file mode 100644
index 0000000000..897f4b3db0
--- /dev/null
+++ b/res/values-de/bools.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/* 
+**
+** Copyright 2008, 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>
+	<bool name="im_is_default">true</bool>
+</resources>
diff --git a/res/values-es/bools.xml b/res/values-es/bools.xml
new file mode 100644
index 0000000000..897f4b3db0
--- /dev/null
+++ b/res/values-es/bools.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/* 
+**
+** Copyright 2008, 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>
+	<bool name="im_is_default">true</bool>
+</resources>
diff --git a/res/values-fr/bools.xml b/res/values-fr/bools.xml
new file mode 100644
index 0000000000..897f4b3db0
--- /dev/null
+++ b/res/values-fr/bools.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/* 
+**
+** Copyright 2008, 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>
+	<bool name="im_is_default">true</bool>
+</resources>
diff --git a/res/values-it/bools.xml b/res/values-it/bools.xml
new file mode 100644
index 0000000000..897f4b3db0
--- /dev/null
+++ b/res/values-it/bools.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/* 
+**
+** Copyright 2008, 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>
+	<bool name="im_is_default">true</bool>
+</resources>
diff --git a/res/values-nl/bools.xml b/res/values-nl/bools.xml
new file mode 100644
index 0000000000..897f4b3db0
--- /dev/null
+++ b/res/values-nl/bools.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/* 
+**
+** Copyright 2008, 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>
+	<bool name="im_is_default">true</bool>
+</resources>
diff --git a/res/values-pl/bools.xml b/res/values-pl/bools.xml
new file mode 100644
index 0000000000..897f4b3db0
--- /dev/null
+++ b/res/values-pl/bools.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/* 
+**
+** Copyright 2008, 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>
+	<bool name="im_is_default">true</bool>
+</resources>
diff --git a/res/values/bools.xml b/res/values/bools.xml
new file mode 100644
index 0000000000..06aa8f308c
--- /dev/null
+++ b/res/values/bools.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/* 
+**
+** Copyright 2008, 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>
+    <!-- Whether or not auto-correction should be enabled by default -->
+    <bool name="enable_autocorrect">false</bool>
+    <!-- Whether this input method should be used as the default for a locale. Override it
+         for latin languages. -->
+    <bool name="im_is_default">false</bool>
+</resources>
diff --git a/res/xml/prefs.xml b/res/xml/prefs.xml
index 8652699077..2fc82aadbe 100644
--- a/res/xml/prefs.xml
+++ b/res/xml/prefs.xml
@@ -62,7 +62,7 @@
             android:title="@string/auto_complete"
             android:summary="@string/auto_complete_summary"
             android:persistent="true" 
-            android:defaultValue="true"
+            android:defaultValue="@bool/enable_autocorrect"
             android:dependency="show_suggestions"
             />
             
diff --git a/src/com/android/inputmethod/latin/LatinIME.java b/src/com/android/inputmethod/latin/LatinIME.java
index a36ff57472..f816375809 100644
--- a/src/com/android/inputmethod/latin/LatinIME.java
+++ b/src/com/android/inputmethod/latin/LatinIME.java
@@ -1005,7 +1005,8 @@ public class LatinIME extends InputMethodService
         // will continue to work
         if (AutoText.getSize(mInputView) < 1) mQuickFixes = true;
         mShowSuggestions = sp.getBoolean(PREF_SHOW_SUGGESTIONS, true) & mQuickFixes;
-        mAutoComplete = sp.getBoolean(PREF_AUTO_COMPLETE, true) & mShowSuggestions;
+        mAutoComplete = sp.getBoolean(PREF_AUTO_COMPLETE, 
+                getResources().getBoolean(R.bool.enable_autocorrect)) & mShowSuggestions;
         mAutoCorrectOn = mSuggest != null && (mAutoComplete || mQuickFixes);
         mCorrectionMode = mAutoComplete ? 2 : (mQuickFixes ? 1 : 0);
     }
-- 
GitLab