From ac6dfaf80bb280cbc9afb2d6e697379b3fd1f373 Mon Sep 17 00:00:00 2001
From: Jean Chalard <jchalard@google.com>
Date: Wed, 25 Dec 2013 21:48:48 +0900
Subject: [PATCH] [IL58] Simplification

No need to test multiple times for this. Let's just never do useless
stuff, and only test for that once.

Bug: 8636060
Change-Id: I50a9e4da769fbec44fbb12eedfed03aad924cc2c
---
 java/src/com/android/inputmethod/latin/LatinIME.java   | 10 +++++-----
 .../inputmethod/latin/inputlogic/InputLogic.java       |  2 --
 2 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index fd2cd30b6b..f99a8b5008 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -234,6 +234,9 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
         }
 
         public void postResumeSuggestions() {
+            if (!getOwnerInstance().mSettings.getCurrent().isSuggestionStripVisible()) {
+                return;
+            }
             removeMessages(MSG_RESUME_SUGGESTIONS);
             sendMessageDelayed(obtainMessage(MSG_RESUME_SUGGESTIONS), mDelayUpdateSuggestions);
         }
@@ -959,11 +962,8 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
                         newSelStart, newSelEnd, false /* shouldFinishComposition */);
             }
 
-            // We moved the cursor. If we are touching a word, we need to resume suggestion,
-            // unless suggestions are off.
-            if (isSuggestionsStripVisible()) {
-                mHandler.postResumeSuggestions();
-            }
+            // We moved the cursor. If we are touching a word, we need to resume suggestion.
+            mHandler.postResumeSuggestions();
             // Reset the last recapitalization.
             mInputLogic.mRecapitalizeStatus.deactivate();
             mKeyboardSwitcher.updateShiftState();
diff --git a/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java b/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
index beef7612b0..73a144d94c 100644
--- a/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
+++ b/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
@@ -1061,8 +1061,6 @@ public final class InputLogic {
         // recorrection. This is a temporary, stopgap measure that will be removed later.
         // TODO: remove this.
         if (settingsValues.isBrokenByRecorrection()) return;
-        // A simple way to test for support from the TextView.
-        if (!mLatinIME.isSuggestionsStripVisible()) return;
         // Recorrection is not supported in languages without spaces because we don't know
         // how to segment them yet.
         if (!settingsValues.mSpacingAndPunctuations.mCurrentLanguageHasSpaces) return;
-- 
GitLab