Wrap up popup mini keyboard

Bug: 5218641
Change-Id: I88b3e7efa1f7c009c8a8e4f5453a5c4df2f91cfc
This commit is contained in:
Tadashi G. Takaoka 2011-08-26 15:45:05 +09:00
parent de4e8dedcc
commit f3f3189adb

View file

@ -213,9 +213,10 @@ public class PopupMiniKeyboardView extends KeyboardView implements PopupPanel {
final int pointY = parentKey.mY;
final int miniKeyboardLeft = pointX - miniKeyboard.getDefaultCoordX()
+ parentKeyboardView.getPaddingLeft();
final int x = Math.max(0, Math.min(miniKeyboardLeft,
final int x = wrapUp(Math.max(0, Math.min(miniKeyboardLeft,
parentKeyboardView.getWidth() - miniKeyboard.mOccupiedWidth))
- container.getPaddingLeft() + mCoordinates[0];
- container.getPaddingLeft() + mCoordinates[0],
container.getMeasuredWidth(), 0, parentKeyboardView.getWidth());
final int y = pointY - parentKeyboard.mVerticalGap
- (container.getMeasuredHeight() - container.getPaddingBottom())
+ parentKeyboardView.getPaddingTop() + mCoordinates[1];
@ -232,6 +233,14 @@ public class PopupMiniKeyboardView extends KeyboardView implements PopupPanel {
mOriginY = y + container.getPaddingTop() - mCoordinates[1];
}
private static int wrapUp(int x, int width, int left, int right) {
if (x < left)
return left;
if (x + width > right)
return right - width;
return x;
}
@Override
public boolean dismissPopupPanel() {
return mParentKeyboardView.dismissPopupPanel();