From f03883025fa35e4335984bd7536363b18351b5cb Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Fri, 3 Jun 2011 21:28:24 +0900 Subject: [PATCH] Fix mini keyboard position This change adjusts popup mini keyboard X-coordinate not to be clipped out of the display. Bug: 4442045 Cherry-Pick: Ibdf4e2d0a79cddbeb89ed8ded81a2db9af9797b8 Change-Id: I1c3ce7b1c6a6d247b796a1cdcd821bf88321ddef --- .../inputmethod/keyboard/PopupMiniKeyboardView.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/java/src/com/android/inputmethod/keyboard/PopupMiniKeyboardView.java b/java/src/com/android/inputmethod/keyboard/PopupMiniKeyboardView.java index fa2aa874c..60d87f789 100644 --- a/java/src/com/android/inputmethod/keyboard/PopupMiniKeyboardView.java +++ b/java/src/com/android/inputmethod/keyboard/PopupMiniKeyboardView.java @@ -76,9 +76,11 @@ public class PopupMiniKeyboardView extends KeyboardView implements PopupPanel { final int pointX = (mConfigShowMiniKeyboardAtTouchedPoint) ? tracker.getLastX() : parentKey.mX + parentKey.mWidth / 2; final int pointY = parentKey.mY; - final int miniKeyboardX = pointX - miniKeyboard.getDefaultCoordX() - - container.getPaddingLeft() - + parentKeyboardView.getPaddingLeft() + mCoordinates[0]; + final int miniKeyboardLeft = pointX - miniKeyboard.getDefaultCoordX() + + parentKeyboardView.getPaddingLeft(); + final int miniKeyboardX = Math.max(0, Math.min(miniKeyboardLeft, + parentKeyboardView.getWidth() - miniKeyboard.getMinWidth())) + - container.getPaddingLeft() + mCoordinates[0]; final int miniKeyboardY = pointY - parentKeyboard.getVerticalGap() - (container.getMeasuredHeight() - container.getPaddingBottom()) + parentKeyboardView.getPaddingTop() + mCoordinates[1];