Dismiss more keys keyboard before statring more suggestionsview to show

Bug: 13204690
Change-Id: I9188edd0e99ca8acdcb0f0e045be7d267d56b12d
diff --git a/java/src/com/android/inputmethod/keyboard/MoreKeysPanel.java b/java/src/com/android/inputmethod/keyboard/MoreKeysPanel.java
index 4a33e65..b3422d1 100644
--- a/java/src/com/android/inputmethod/keyboard/MoreKeysPanel.java
+++ b/java/src/com/android/inputmethod/keyboard/MoreKeysPanel.java
@@ -31,12 +31,14 @@
          * Remove the current {@link MoreKeysPanel} from the target view.
          * @param panel the panel to be dismissed.
          */
+        // TODO: Remove unused {@link MoreKeysPanel} argument.
         public void onDismissMoreKeysPanel(final MoreKeysPanel panel);
 
         /**
          * Instructs the parent to cancel the panel (e.g., when entering a different input mode).
          * @param panel the panel to be canceled.
          */
+        // TODO: Remove unused {@link MoreKeysPanel} argument.
         public void onCancelMoreKeysPanel(final MoreKeysPanel panel);
     }
 
diff --git a/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripView.java b/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripView.java
index 4ef562d..be457ca 100644
--- a/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripView.java
+++ b/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripView.java
@@ -35,7 +35,6 @@
 import android.widget.TextView;
 
 import com.android.inputmethod.keyboard.Keyboard;
-import com.android.inputmethod.keyboard.KeyboardSwitcher;
 import com.android.inputmethod.keyboard.MainKeyboardView;
 import com.android.inputmethod.keyboard.MoreKeysPanel;
 import com.android.inputmethod.latin.AudioAndHapticFeedbackManager;
@@ -312,7 +311,7 @@
     }
 
     boolean showMoreSuggestions() {
-        final Keyboard parentKeyboard = KeyboardSwitcher.getInstance().getKeyboard();
+        final Keyboard parentKeyboard = mMainKeyboardView.getKeyboard();
         if (parentKeyboard == null) {
             return false;
         }
@@ -320,6 +319,10 @@
         if (!layoutHelper.mMoreSuggestionsAvailable) {
             return false;
         }
+        // Dismiss another {@link MoreKeysPanel} that may be being showed, for example
+        // {@link MoreKeysKeyboardView}.
+        // TODO: Remove unused null argument.
+        mMainKeyboardView.onDismissMoreKeysPanel(null /* unused */);
         final int stripWidth = getWidth();
         final View container = mMoreSuggestionsContainer;
         final int maxWidth = stripWidth - container.getPaddingLeft() - container.getPaddingRight();