aboutsummaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
authorKen Wakasa <kwakasa@google.com>2010-09-10 13:15:45 +0900
committerKen Wakasa <kwakasa@google.com>2010-09-10 13:15:45 +0900
commit3de8f34b8c8c7113386b6cd7c9101ef20df6ec7d (patch)
tree80d32ad367aa629f333067c294260e8c2e0de098 /java/src
parentefc4a437942f0bccd8815059c5f9d823023cfac1 (diff)
downloadlatinime-3de8f34b8c8c7113386b6cd7c9101ef20df6ec7d.tar.gz
latinime-3de8f34b8c8c7113386b6cd7c9101ef20df6ec7d.tar.xz
latinime-3de8f34b8c8c7113386b6cd7c9101ef20df6ec7d.zip
Code cleanup
Change-Id: I333693ab8e4088180cc25768d874ad7320d9da8b
Diffstat (limited to 'java/src')
-rw-r--r--java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java41
1 files changed, 16 insertions, 25 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java b/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java
index 8f1ec6591..45ecca35e 100644
--- a/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java
+++ b/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java
@@ -180,7 +180,6 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx
private Key[] mKeys;
// Key preview popup
- private final static boolean PREVIEW_CENTERED = false;
private TextView mPreviewText;
private PopupWindow mPreviewPopup;
private int mPreviewTextSizeLarge;
@@ -188,8 +187,6 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx
private int mOldPreviewKeyIndex = NOT_A_KEY;
private boolean mShowPreview = true;
private boolean mShowTouchPoints = true;
- private int mPopupPreviewX;
- private int mPopupPreviewY;
private int mPopupPreviewOffsetX;
private int mPopupPreviewOffsetY;
private int mWindowY;
@@ -869,7 +866,6 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx
Key key = tracker.getKey(keyIndex);
if (key == null)
return;
- final PopupWindow previewPopup = mPreviewPopup;
if (key.icon != null) {
mPreviewText.setCompoundDrawables(null, null, null,
key.iconPreview != null ? key.iconPreview : key.icon);
@@ -895,14 +891,10 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx
lp.width = popupWidth;
lp.height = popupHeight;
}
- if (PREVIEW_CENTERED) {
- // TODO: Fix this if centering is brought back
- mPopupPreviewX = 160 - mPreviewText.getMeasuredWidth() / 2;
- mPopupPreviewY = - mPreviewText.getMeasuredHeight();
- } else {
- mPopupPreviewX = key.x - mPreviewText.getPaddingLeft() + getPaddingLeft();
- mPopupPreviewY = key.y - popupHeight + mPreviewOffset;
- }
+
+ int popupPreviewX = key.x - mPreviewText.getPaddingLeft() + getPaddingLeft();
+ int popupPreviewY = key.y - popupHeight + mPreviewOffset;
+
mHandler.cancelDismissPreview();
if (mOffsetInWindow == null) {
mOffsetInWindow = new int[2];
@@ -916,29 +908,28 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx
// Set the preview background state
mPreviewText.getBackground().setState(
key.popupResId != 0 ? LONG_PRESSABLE_STATE_SET : EMPTY_STATE_SET);
- mPopupPreviewX += mOffsetInWindow[0];
- mPopupPreviewY += mOffsetInWindow[1];
+ popupPreviewX += mOffsetInWindow[0];
+ popupPreviewY += mOffsetInWindow[1];
// If the popup cannot be shown above the key, put it on the side
- if (mPopupPreviewY + mWindowY < 0) {
+ if (popupPreviewY + mWindowY < 0) {
// If the key you're pressing is on the left side of the keyboard, show the popup on
// the right, offset by enough to see at least one key to the left/right.
if (key.x + key.width <= getWidth() / 2) {
- mPopupPreviewX += (int) (key.width * 2.5);
+ popupPreviewX += (int) (key.width * 2.5);
} else {
- mPopupPreviewX -= (int) (key.width * 2.5);
+ popupPreviewX -= (int) (key.width * 2.5);
}
- mPopupPreviewY += popupHeight;
+ popupPreviewY += popupHeight;
}
- if (previewPopup.isShowing()) {
- previewPopup.update(mPopupPreviewX, mPopupPreviewY,
- popupWidth, popupHeight);
+ if (mPreviewPopup.isShowing()) {
+ mPreviewPopup.update(popupPreviewX, popupPreviewY, popupWidth, popupHeight);
} else {
- previewPopup.setWidth(popupWidth);
- previewPopup.setHeight(popupHeight);
- previewPopup.showAtLocation(mMiniKeyboardParent, Gravity.NO_GRAVITY,
- mPopupPreviewX, mPopupPreviewY);
+ mPreviewPopup.setWidth(popupWidth);
+ mPreviewPopup.setHeight(popupHeight);
+ mPreviewPopup.showAtLocation(mMiniKeyboardParent, Gravity.NO_GRAVITY,
+ popupPreviewX, popupPreviewY);
}
mPreviewText.setVisibility(VISIBLE);
}