Reset vertical correction when more suggestions are in modal mode
Bug: 8605150
Change-Id: Iadbebfb80e765c97e58e8524eb87419f2a9e41d4
diff --git a/java/src/com/android/inputmethod/keyboard/MoreKeysKeyboardView.java b/java/src/com/android/inputmethod/keyboard/MoreKeysKeyboardView.java
index a356eb1..a82fb79 100644
--- a/java/src/com/android/inputmethod/keyboard/MoreKeysKeyboardView.java
+++ b/java/src/com/android/inputmethod/keyboard/MoreKeysKeyboardView.java
@@ -33,7 +33,7 @@
public class MoreKeysKeyboardView extends KeyboardView implements MoreKeysPanel {
private final int[] mCoordinates = CoordinateUtils.newInstance();
- private final KeyDetector mKeyDetector;
+ protected final KeyDetector mKeyDetector;
private Controller mController;
protected KeyboardActionListener mListener;
private int mOriginX;
diff --git a/java/src/com/android/inputmethod/latin/suggestions/MoreSuggestionsView.java b/java/src/com/android/inputmethod/latin/suggestions/MoreSuggestionsView.java
index 94715cd..6509f39 100644
--- a/java/src/com/android/inputmethod/latin/suggestions/MoreSuggestionsView.java
+++ b/java/src/com/android/inputmethod/latin/suggestions/MoreSuggestionsView.java
@@ -46,6 +46,12 @@
updateKeyDrawParams(keyHeight);
}
+ public void adjustVerticalCorrectionForModalMode() {
+ // Set vertical correction to zero (Reset more keys keyboard sliding allowance
+ // {@link R#dimen.more_keys_keyboard_slide_allowance}).
+ mKeyDetector.setKeyboard(getKeyboard(), -getPaddingLeft(), -getPaddingTop());
+ }
+
@Override
public void onCodeInput(final int code, final int x, final int y) {
final int index = code - MoreSuggestions.SUGGESTION_CODE_BASE;
diff --git a/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripView.java b/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripView.java
index 4ef36fa..2a21ec2 100644
--- a/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripView.java
+++ b/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripView.java
@@ -755,8 +755,7 @@
@Override
public boolean dispatchTouchEvent(final MotionEvent me) {
- if (!mMoreSuggestionsView.isShowingInParent()
- || mMoreSuggestionsMode == MORE_SUGGESTIONS_IN_MODAL_MODE) {
+ if (!mMoreSuggestionsView.isShowingInParent()) {
mLastX = (int)me.getX();
mLastY = (int)me.getY();
if (mMoreSuggestionsSlidingDetector.onTouchEvent(me)) {
@@ -784,6 +783,7 @@
} else if (action == MotionEvent.ACTION_UP || action == MotionEvent.ACTION_POINTER_UP) {
// Decided to be in the modal input mode
mMoreSuggestionsMode = MORE_SUGGESTIONS_IN_MODAL_MODE;
+ mMoreSuggestionsView.adjustVerticalCorrectionForModalMode();
}
return true;
}