Fix a bug in y-axis offset for sliding finger key detection for mini popup keyboard.
Also, tentatively added key detection allowance for below of the keys in mini popup keyboard. bug: 2979407 Change-Id: I84794969facd929c84df23e0120d46dff71c6efbmain
parent
f62166c13b
commit
aed0122734
|
@ -46,6 +46,9 @@
|
||||||
<!-- Amount to offset the touch Y coordinate by, for bias correction. -->
|
<!-- Amount to offset the touch Y coordinate by, for bias correction. -->
|
||||||
<attr name="verticalCorrection" format="dimension" />
|
<attr name="verticalCorrection" format="dimension" />
|
||||||
|
|
||||||
|
<!-- Amount of allowance for selecting keys in a mini popup keyboard by sliding finger. -->
|
||||||
|
<attr name="miniKeyboardSlideAllowance" format="dimension" />
|
||||||
|
|
||||||
<!-- Layout resource for popup keyboards. -->
|
<!-- Layout resource for popup keyboards. -->
|
||||||
<attr name="popupLayout" format="reference" />
|
<attr name="popupLayout" format="reference" />
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
<item name="labelTextSize">14sp</item>
|
<item name="labelTextSize">14sp</item>
|
||||||
<item name="popupLayout">@layout/keyboard_popup_keyboard</item>
|
<item name="popupLayout">@layout/keyboard_popup_keyboard</item>
|
||||||
<item name="verticalCorrection">-10dip</item>
|
<item name="verticalCorrection">-10dip</item>
|
||||||
|
<item name="miniKeyboardSlideAllowance">30dip</item>
|
||||||
<item name="shadowColor">#BB000000</item>
|
<item name="shadowColor">#BB000000</item>
|
||||||
<item name="shadowRadius">2.75</item>
|
<item name="shadowRadius">2.75</item>
|
||||||
<item name="backgroundDimAmount">0.5</item>
|
<item name="backgroundDimAmount">0.5</item>
|
||||||
|
|
|
@ -200,6 +200,7 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx
|
||||||
private int mMiniKeyboardOriginY;
|
private int mMiniKeyboardOriginY;
|
||||||
private long mMiniKeyboardPopupTime;
|
private long mMiniKeyboardPopupTime;
|
||||||
private int[] mWindowOffset;
|
private int[] mWindowOffset;
|
||||||
|
private float mMiniKeyboardSlideAllowance;
|
||||||
|
|
||||||
/** Listener for {@link OnKeyboardActionListener}. */
|
/** Listener for {@link OnKeyboardActionListener}. */
|
||||||
private OnKeyboardActionListener mKeyboardActionListener;
|
private OnKeyboardActionListener mKeyboardActionListener;
|
||||||
|
@ -388,6 +389,9 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx
|
||||||
case R.styleable.LatinKeyboardBaseView_verticalCorrection:
|
case R.styleable.LatinKeyboardBaseView_verticalCorrection:
|
||||||
mVerticalCorrection = a.getDimensionPixelOffset(attr, 0);
|
mVerticalCorrection = a.getDimensionPixelOffset(attr, 0);
|
||||||
break;
|
break;
|
||||||
|
case R.styleable.LatinKeyboardBaseView_miniKeyboardSlideAllowance:
|
||||||
|
mMiniKeyboardSlideAllowance = a.getDimensionPixelOffset(attr, 0);
|
||||||
|
break;
|
||||||
case R.styleable.LatinKeyboardBaseView_keyPreviewLayout:
|
case R.styleable.LatinKeyboardBaseView_keyPreviewLayout:
|
||||||
previewLayout = a.getResourceId(attr, 0);
|
previewLayout = a.getResourceId(attr, 0);
|
||||||
break;
|
break;
|
||||||
|
@ -1091,8 +1095,8 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx
|
||||||
} else if (x > (getMeasuredWidth() - container.getMeasuredWidth())) {
|
} else if (x > (getMeasuredWidth() - container.getMeasuredWidth())) {
|
||||||
adjustedX = getMeasuredWidth() - container.getMeasuredWidth();
|
adjustedX = getMeasuredWidth() - container.getMeasuredWidth();
|
||||||
}
|
}
|
||||||
mMiniKeyboardOriginX = adjustedX + container.getPaddingLeft();
|
mMiniKeyboardOriginX = adjustedX + container.getPaddingLeft() - mWindowOffset[0];
|
||||||
mMiniKeyboardOriginY = y + container.getPaddingTop();
|
mMiniKeyboardOriginY = y + container.getPaddingTop() - mWindowOffset[1];
|
||||||
mMiniKeyboard.setPopupOffset(adjustedX, y);
|
mMiniKeyboard.setPopupOffset(adjustedX, y);
|
||||||
mMiniKeyboard.setShifted(isShifted());
|
mMiniKeyboard.setShifted(isShifted());
|
||||||
// Mini keyboard needs no pop-up key preview displayed.
|
// Mini keyboard needs no pop-up key preview displayed.
|
||||||
|
@ -1116,7 +1120,12 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx
|
||||||
|
|
||||||
private MotionEvent generateMiniKeyboardMotionEvent(int action, int x, int y, long eventTime) {
|
private MotionEvent generateMiniKeyboardMotionEvent(int action, int x, int y, long eventTime) {
|
||||||
return MotionEvent.obtain(mMiniKeyboardPopupTime, eventTime, action,
|
return MotionEvent.obtain(mMiniKeyboardPopupTime, eventTime, action,
|
||||||
x - mMiniKeyboardOriginX, y - mMiniKeyboardOriginY, 0);
|
x - mMiniKeyboardOriginX,
|
||||||
|
// TODO: Currently just taking care of "below" of the keys in a mini popup keyboard
|
||||||
|
// for key detection by sliding finger. Need to take care of left, right, and
|
||||||
|
// upper of "edge" keys.
|
||||||
|
y - mMiniKeyboardOriginY - (int)mMiniKeyboardSlideAllowance,
|
||||||
|
0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private PointerTracker getPointerTracker(final int id) {
|
private PointerTracker getPointerTracker(final int id) {
|
||||||
|
|
Loading…
Reference in New Issue