diff options
author | 2010-10-12 03:15:36 +0900 | |
---|---|---|
committer | 2010-10-12 03:15:36 +0900 | |
commit | 39004972b145065bf52e32d1d1cb361f96ed4501 (patch) | |
tree | 485c9ff27c3661888dde6c4543eebb8055451c9d /java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java | |
parent | 3de6ba6ab9713db4b617e46fa8daa559a816fdea (diff) | |
parent | fd64e47c2b00a6ac7eb73a6a6601d9248bad6b84 (diff) | |
download | latinime-39004972b145065bf52e32d1d1cb361f96ed4501.tar.gz latinime-39004972b145065bf52e32d1d1cb361f96ed4501.tar.xz latinime-39004972b145065bf52e32d1d1cb361f96ed4501.zip |
resolved conflicts for merge of fd64e47c to master
Change-Id: I07434c251fafa5eee548a54dae30d91df3a24085
Diffstat (limited to 'java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java b/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java index b160da231..3d107198e 100644 --- a/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java +++ b/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java @@ -1101,8 +1101,7 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx return container; } - private static boolean isOneRowKeyboard(BaseKeyboard keyboard) { - final List<Key> keys = keyboard.getKeys(); + private static boolean isOneRowKeys(List<Key> keys) { if (keys.size() == 0) return false; final int edgeFlags = keys.get(0).edgeFlags; // HACK: The first key of mini keyboard which was inflated from xml and has multiple rows, @@ -1140,24 +1139,35 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx getLocationInWindow(mWindowOffset); } + // Get width of a key in the mini popup keyboard = "miniKeyWidth". + // On the other hand, "popupKey.width" is width of the pressed key on the main keyboard. + // We adjust the position of mini popup keyboard with the edge key in it: + // a) When we have the leftmost key in popup keyboard directly above the pressed key + // Right edges of both keys should be aligned for consistent default selection + // b) When we have the rightmost key in popup keyboard directly above the pressed key + // Left edges of both keys should be aligned for consistent default selection + final List<Key> miniKeys = mMiniKeyboard.getKeyboard().getKeys(); + final int miniKeyWidth = miniKeys.size() > 0 ? miniKeys.get(0).width : 0; + // HACK: Have the leftmost number in the popup characters right above the key boolean isNumberAtLeftmost = hasMultiplePopupChars(popupKey) && isNumberAtLeftmostPopupChar(popupKey); int popupX = popupKey.x + mWindowOffset[0]; - int popupY = popupKey.y + mWindowOffset[1]; + popupX += getPaddingLeft(); if (isNumberAtLeftmost) { + popupX += popupKey.width - miniKeyWidth; // adjustment for a) described above popupX -= container.getPaddingLeft(); } else { - popupX += popupKey.width + getPaddingLeft(); + popupX += miniKeyWidth; // adjustment for b) described above popupX -= container.getMeasuredWidth(); popupX += container.getPaddingRight(); } + int popupY = popupKey.y + mWindowOffset[1]; popupY += getPaddingTop(); popupY -= container.getMeasuredHeight(); popupY += container.getPaddingBottom(); final int x = popupX; - final int y = mShowPreview && isOneRowKeyboard(mMiniKeyboard.getKeyboard()) - ? mPopupPreviewDisplayedY : popupY; + final int y = mShowPreview && isOneRowKeys(miniKeys) ? mPopupPreviewDisplayedY : popupY; int adjustedX = x; if (x < 0) { |