am 08a5ba3a: am 3de8f34b: Code cleanup
Merge commit '08a5ba3a69bef5182128f90e49eae4548795e9c9' * commit '08a5ba3a69bef5182128f90e49eae4548795e9c9': Code cleanupmain
commit
40cff6faa2
|
@ -180,7 +180,6 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx
|
||||||
private Key[] mKeys;
|
private Key[] mKeys;
|
||||||
|
|
||||||
// Key preview popup
|
// Key preview popup
|
||||||
private final static boolean PREVIEW_CENTERED = false;
|
|
||||||
private TextView mPreviewText;
|
private TextView mPreviewText;
|
||||||
private PopupWindow mPreviewPopup;
|
private PopupWindow mPreviewPopup;
|
||||||
private int mPreviewTextSizeLarge;
|
private int mPreviewTextSizeLarge;
|
||||||
|
@ -188,8 +187,6 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx
|
||||||
private int mOldPreviewKeyIndex = NOT_A_KEY;
|
private int mOldPreviewKeyIndex = NOT_A_KEY;
|
||||||
private boolean mShowPreview = true;
|
private boolean mShowPreview = true;
|
||||||
private boolean mShowTouchPoints = true;
|
private boolean mShowTouchPoints = true;
|
||||||
private int mPopupPreviewX;
|
|
||||||
private int mPopupPreviewY;
|
|
||||||
private int mPopupPreviewOffsetX;
|
private int mPopupPreviewOffsetX;
|
||||||
private int mPopupPreviewOffsetY;
|
private int mPopupPreviewOffsetY;
|
||||||
private int mWindowY;
|
private int mWindowY;
|
||||||
|
@ -869,7 +866,6 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx
|
||||||
Key key = tracker.getKey(keyIndex);
|
Key key = tracker.getKey(keyIndex);
|
||||||
if (key == null)
|
if (key == null)
|
||||||
return;
|
return;
|
||||||
final PopupWindow previewPopup = mPreviewPopup;
|
|
||||||
if (key.icon != null) {
|
if (key.icon != null) {
|
||||||
mPreviewText.setCompoundDrawables(null, null, null,
|
mPreviewText.setCompoundDrawables(null, null, null,
|
||||||
key.iconPreview != null ? key.iconPreview : key.icon);
|
key.iconPreview != null ? key.iconPreview : key.icon);
|
||||||
|
@ -895,14 +891,10 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx
|
||||||
lp.width = popupWidth;
|
lp.width = popupWidth;
|
||||||
lp.height = popupHeight;
|
lp.height = popupHeight;
|
||||||
}
|
}
|
||||||
if (PREVIEW_CENTERED) {
|
|
||||||
// TODO: Fix this if centering is brought back
|
int popupPreviewX = key.x - mPreviewText.getPaddingLeft() + getPaddingLeft();
|
||||||
mPopupPreviewX = 160 - mPreviewText.getMeasuredWidth() / 2;
|
int popupPreviewY = key.y - popupHeight + mPreviewOffset;
|
||||||
mPopupPreviewY = - mPreviewText.getMeasuredHeight();
|
|
||||||
} else {
|
|
||||||
mPopupPreviewX = key.x - mPreviewText.getPaddingLeft() + getPaddingLeft();
|
|
||||||
mPopupPreviewY = key.y - popupHeight + mPreviewOffset;
|
|
||||||
}
|
|
||||||
mHandler.cancelDismissPreview();
|
mHandler.cancelDismissPreview();
|
||||||
if (mOffsetInWindow == null) {
|
if (mOffsetInWindow == null) {
|
||||||
mOffsetInWindow = new int[2];
|
mOffsetInWindow = new int[2];
|
||||||
|
@ -916,29 +908,28 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx
|
||||||
// Set the preview background state
|
// Set the preview background state
|
||||||
mPreviewText.getBackground().setState(
|
mPreviewText.getBackground().setState(
|
||||||
key.popupResId != 0 ? LONG_PRESSABLE_STATE_SET : EMPTY_STATE_SET);
|
key.popupResId != 0 ? LONG_PRESSABLE_STATE_SET : EMPTY_STATE_SET);
|
||||||
mPopupPreviewX += mOffsetInWindow[0];
|
popupPreviewX += mOffsetInWindow[0];
|
||||||
mPopupPreviewY += mOffsetInWindow[1];
|
popupPreviewY += mOffsetInWindow[1];
|
||||||
|
|
||||||
// If the popup cannot be shown above the key, put it on the side
|
// 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
|
// 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.
|
// the right, offset by enough to see at least one key to the left/right.
|
||||||
if (key.x + key.width <= getWidth() / 2) {
|
if (key.x + key.width <= getWidth() / 2) {
|
||||||
mPopupPreviewX += (int) (key.width * 2.5);
|
popupPreviewX += (int) (key.width * 2.5);
|
||||||
} else {
|
} else {
|
||||||
mPopupPreviewX -= (int) (key.width * 2.5);
|
popupPreviewX -= (int) (key.width * 2.5);
|
||||||
}
|
}
|
||||||
mPopupPreviewY += popupHeight;
|
popupPreviewY += popupHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (previewPopup.isShowing()) {
|
if (mPreviewPopup.isShowing()) {
|
||||||
previewPopup.update(mPopupPreviewX, mPopupPreviewY,
|
mPreviewPopup.update(popupPreviewX, popupPreviewY, popupWidth, popupHeight);
|
||||||
popupWidth, popupHeight);
|
|
||||||
} else {
|
} else {
|
||||||
previewPopup.setWidth(popupWidth);
|
mPreviewPopup.setWidth(popupWidth);
|
||||||
previewPopup.setHeight(popupHeight);
|
mPreviewPopup.setHeight(popupHeight);
|
||||||
previewPopup.showAtLocation(mMiniKeyboardParent, Gravity.NO_GRAVITY,
|
mPreviewPopup.showAtLocation(mMiniKeyboardParent, Gravity.NO_GRAVITY,
|
||||||
mPopupPreviewX, mPopupPreviewY);
|
popupPreviewX, popupPreviewY);
|
||||||
}
|
}
|
||||||
mPreviewText.setVisibility(VISIBLE);
|
mPreviewText.setVisibility(VISIBLE);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue