Fix : Bouncing Extract Text when correcting multiple lines of text.

Bug: 2996887

Override the methods in InputMethodService that hide the candidates view, since
it was just an optimization to show more lines of text when editing, which
conflicts with the re-correct feature.

Change-Id: Ibfed5ccd9efa048d0b69297a5cf8a638a0d00c72
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index 4e8723c..f80ecc6 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 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
@@ -262,7 +262,7 @@
         List<String> candidates;
         Map<String, List<CharSequence>> alternatives;
     }
-    
+
     public abstract static class WordAlternatives {
         protected CharSequence mChosenWord;
 
@@ -795,6 +795,37 @@
         }
     }
 
+    /**
+     * This is called when the user has clicked on the extracted text view,
+     * when running in fullscreen mode.  The default implementation hides
+     * the candidates view when this happens, but only if the extracted text
+     * editor has a vertical scroll bar because its text doesn't fit.
+     * Here we override the behavior due to the possibility that a re-correction could
+     * cause the candidate strip to disappear and re-appear.
+     */
+    @Override
+    public void onExtractedTextClicked() {
+        if (mReCorrectionEnabled && isPredictionOn()) return;
+
+        super.onExtractedTextClicked();
+    }
+
+    /**
+     * This is called when the user has performed a cursor movement in the
+     * extracted text view, when it is running in fullscreen mode.  The default
+     * implementation hides the candidates view when a vertical movement
+     * happens, but only if the extracted text editor has a vertical scroll bar
+     * because its text doesn't fit.
+     * Here we override the behavior due to the possibility that a re-correction could
+     * cause the candidate strip to disappear and re-appear.
+     */
+    @Override
+    public void onExtractedCursorMovement(int dx, int dy) {
+        if (mReCorrectionEnabled && isPredictionOn()) return;
+
+        super.onExtractedCursorMovement(dx, dy);
+    }
+
     @Override
     public void hideWindow() {
         LatinImeLogger.commit();