From 9b2192bfd2d3a06df3c685ed4287e192dbaabf32 Mon Sep 17 00:00:00 2001
From: Ken Wakasa <kwakasa@google.com>
Date: Fri, 29 Apr 2011 17:06:17 +0900
Subject: [PATCH] Revert the suggestion update delay to the original value
 (100msec) for phones.

This is actually a follow-up to I385f9eb2

bug: 4361287
Change-Id: I4c4a0a96a7fa28f4f96dd984453d2c9f3fa7d6c2
---
 java/res/values-xlarge/config.xml             |  3 +--
 java/res/values/config.xml                    |  3 +++
 .../android/inputmethod/latin/LatinIME.java   | 20 ++++++++++++-------
 3 files changed, 17 insertions(+), 9 deletions(-)

diff --git a/java/res/values-xlarge/config.xml b/java/res/values-xlarge/config.xml
index 2c125dc7e3..80ef3cd8ef 100644
--- a/java/res/values-xlarge/config.xml
+++ b/java/res/values-xlarge/config.xml
@@ -37,8 +37,7 @@
     <bool name="config_use_spacebar_language_switcher">false</bool>
     <!-- Showing mini keyboard, just above the touched point if true, aligned to the key if false -->
     <bool name="config_show_mini_keyboard_at_touched_point">true</bool>
-    <!-- The language is never displayed if == 0, always displayed if < 0 -->
-    <integer name="config_delay_before_fadeout_language_on_spacebar">1200</integer>
+    <integer name="config_delay_update_suggestions">180</integer>
     <!-- This configuration is the index of the array {@link KeyboardSwitcher.KEYBOARD_THEMES}. -->
     <string name="config_default_keyboard_theme_id" translatable="false">5</string>
     <string name="config_text_size_of_language_on_spacebar" translatable="false">medium</string>
diff --git a/java/res/values/config.xml b/java/res/values/config.xml
index 4651de7854..ee86fbd590 100644
--- a/java/res/values/config.xml
+++ b/java/res/values/config.xml
@@ -50,6 +50,9 @@
     <bool name="config_show_mini_keyboard_at_touched_point">false</bool>
     <!-- The language is never displayed if == 0, always displayed if < 0 -->
     <integer name="config_delay_before_fadeout_language_on_spacebar">1200</integer>
+    <integer name="config_delay_update_suggestions">100</integer>
+    <integer name="config_delay_update_old_suggestions">300</integer>
+    <integer name="config_delay_update_shift_state">100</integer>
     <integer name="config_duration_of_fadeout_language_on_spacebar">50</integer>
     <integer name="config_final_fadeout_percentage_of_language_on_spacebar">50</integer>
     <integer name="config_delay_before_preview">0</integer>
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index 105ec5a62b..3c0aec7626 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -110,9 +110,6 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
      */
     public static final String IME_OPTION_NO_SETTINGS_KEY = "noSettingsKey";
 
-    private static final int DELAY_UPDATE_SUGGESTIONS = 180;
-    private static final int DELAY_UPDATE_OLD_SUGGESTIONS = 300;
-    private static final int DELAY_UPDATE_SHIFT_STATE = 100;
     private static final int EXTENDED_TOUCHABLE_REGION_HEIGHT = 100;
 
     // How many continuous deletes at which to start deleting at a higher speed.
@@ -190,6 +187,9 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
     private boolean mConfigEnableShowSubtypeSettings;
     private boolean mConfigSwipeDownDismissKeyboardEnabled;
     private int mConfigDelayBeforeFadeoutLanguageOnSpacebar;
+    private int mConfigDelayUpdateSuggestions;
+    private int mConfigDelayUpdateOldSuggestions;
+    private int mConfigDelayUpdateShiftState;
     private int mConfigDurationOfFadeoutLanguageOnSpacebar;
     private float mConfigFinalFadeoutFactorOfLanguageOnSpacebar;
     private long mConfigDoubleSpacesTurnIntoPeriodTimeout;
@@ -310,7 +310,8 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
 
         public void postUpdateSuggestions() {
             removeMessages(MSG_UPDATE_SUGGESTIONS);
-            sendMessageDelayed(obtainMessage(MSG_UPDATE_SUGGESTIONS), DELAY_UPDATE_SUGGESTIONS);
+            sendMessageDelayed(obtainMessage(MSG_UPDATE_SUGGESTIONS),
+                    mConfigDelayUpdateSuggestions);
         }
 
         public void cancelUpdateSuggestions() {
@@ -324,7 +325,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
         public void postUpdateOldSuggestions() {
             removeMessages(MSG_UPDATE_OLD_SUGGESTIONS);
             sendMessageDelayed(obtainMessage(MSG_UPDATE_OLD_SUGGESTIONS),
-                    DELAY_UPDATE_OLD_SUGGESTIONS);
+                    mConfigDelayUpdateOldSuggestions);
         }
 
         public void cancelUpdateOldSuggestions() {
@@ -333,7 +334,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
 
         public void postUpdateShiftKeyState() {
             removeMessages(MSG_UPDATE_SHIFT_STATE);
-            sendMessageDelayed(obtainMessage(MSG_UPDATE_SHIFT_STATE), DELAY_UPDATE_SHIFT_STATE);
+            sendMessageDelayed(obtainMessage(MSG_UPDATE_SHIFT_STATE), mConfigDelayUpdateShiftState);
         }
 
         public void cancelUpdateShiftState() {
@@ -342,7 +343,8 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
 
         public void postUpdateBigramPredictions() {
             removeMessages(MSG_SET_BIGRAM_PREDICTIONS);
-            sendMessageDelayed(obtainMessage(MSG_SET_BIGRAM_PREDICTIONS), DELAY_UPDATE_SUGGESTIONS);
+            sendMessageDelayed(obtainMessage(MSG_SET_BIGRAM_PREDICTIONS),
+                    mConfigDelayUpdateSuggestions);
         }
 
         public void cancelUpdateBigramPredictions() {
@@ -425,6 +427,10 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
                 R.bool.config_swipe_down_dismiss_keyboard_enabled);
         mConfigDelayBeforeFadeoutLanguageOnSpacebar = res.getInteger(
                 R.integer.config_delay_before_fadeout_language_on_spacebar);
+        mConfigDelayUpdateSuggestions = res.getInteger(R.integer.config_delay_update_suggestions);
+        mConfigDelayUpdateOldSuggestions = res.getInteger(
+                R.integer.config_delay_update_old_suggestions);
+        mConfigDelayUpdateShiftState = res.getInteger(R.integer.config_delay_update_shift_state);
         mConfigDurationOfFadeoutLanguageOnSpacebar = res.getInteger(
                 R.integer.config_duration_of_fadeout_language_on_spacebar);
         mConfigFinalFadeoutFactorOfLanguageOnSpacebar = res.getInteger(
-- 
GitLab