aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/anysoftkeyboard
diff options
context:
space:
mode:
authorMenny Even Danan <menny@evendanan.net>2016-06-22 02:03:59 +0000
committerMenny Even Danan <menny@evendanan.net>2016-06-22 02:03:59 +0000
commitbd0b0ecfcd798d9ace2d4b45647c3e069449d3cc (patch)
tree1170d986491ecafb81634a02acbcbdb96482d8c3 /src/main/java/com/anysoftkeyboard
parent8ff86cce9e3d4e02453e17cb62dfe8bfd8c0310e (diff)
downloadAnySoftKeyboard-bd0b0ecfcd798d9ace2d4b45647c3e069449d3cc.tar.gz
AnySoftKeyboard-bd0b0ecfcd798d9ace2d4b45647c3e069449d3cc.tar.bz2
DEPLOY-CANARY: fix keyboard vertical-correction with popup keyboards
Diffstat (limited to 'src/main/java/com/anysoftkeyboard')
-rw-r--r--src/main/java/com/anysoftkeyboard/keyboards/views/AnyKeyboardBaseView.java22
-rw-r--r--src/main/java/com/anysoftkeyboard/keyboards/views/AnyKeyboardView.java3
-rw-r--r--src/main/java/com/anysoftkeyboard/keyboards/views/QuickKeysKeyboardView.java5
3 files changed, 20 insertions, 10 deletions
diff --git a/src/main/java/com/anysoftkeyboard/keyboards/views/AnyKeyboardBaseView.java b/src/main/java/com/anysoftkeyboard/keyboards/views/AnyKeyboardBaseView.java
index a4ad26bee..307b55332 100644
--- a/src/main/java/com/anysoftkeyboard/keyboards/views/AnyKeyboardBaseView.java
+++ b/src/main/java/com/anysoftkeyboard/keyboards/views/AnyKeyboardBaseView.java
@@ -171,6 +171,7 @@ public class AnyKeyboardBaseView extends View implements
private float mBackgroundDimAmount;
private float mKeyHysteresisDistance;
private float mVerticalCorrection;
+ private float mOriginalVerticalCorrection;
// Main keyboard
private AnyKeyboard mKeyboard;
private String mKeyboardName;
@@ -425,7 +426,7 @@ public class AnyKeyboardBaseView extends View implements
+ mKeyHysteresisDistance);
break;
case R.attr.verticalCorrection:
- mVerticalCorrection = remoteTypedArray.getDimensionPixelOffset(remoteTypedArrayIndex, 0);
+ mOriginalVerticalCorrection = mVerticalCorrection = remoteTypedArray.getDimensionPixelOffset(remoteTypedArrayIndex, 0);
Log.d(TAG, "AnySoftKeyboardTheme_verticalCorrection "
+ mVerticalCorrection);
break;
@@ -816,7 +817,7 @@ public class AnyKeyboardBaseView extends View implements
* @see #getKeyboard()
*/
public final void setKeyboard(AnyKeyboard keyboard) {
- setKeyboard(keyboard, mVerticalCorrection);
+ setKeyboard(keyboard, mOriginalVerticalCorrection);
}
/**
@@ -1617,10 +1618,15 @@ public class AnyKeyboardBaseView extends View implements
}
mChildKeyboardActionListener.setInOneShot(!isSticky);
- if (isSticky)
- mMiniKeyboard.setKeyboard(keyboard, mVerticalCorrection);
- else
+ if (isSticky) {
+ //using the vertical correction this keyboard has, since the input should behave
+ //just as the parent keyboard
+ mMiniKeyboard.setKeyboard(keyboard, mOriginalVerticalCorrection);
+ }
+ else {
+ //not passing vertical correction, so the popup keyboard will use its own correction
mMiniKeyboard.setKeyboard(keyboard);
+ }
mMiniKeyboard.measure(
MeasureSpec.makeMeasureSpec(getWidth(), MeasureSpec.AT_MOST),
@@ -1843,12 +1849,10 @@ public class AnyKeyboardBaseView extends View implements
// displayed the mini keyboard
if (mMiniKeyboard != null && mMiniKeyboardPopup.isShowing()) {
final int miniKeyboardPointerIndex = nativeMotionEvent.findPointerIndex(mMiniKeyboardTrackerId);
- if (miniKeyboardPointerIndex >= 0
- && miniKeyboardPointerIndex < pointerCount) {
+ if (miniKeyboardPointerIndex >= 0 && miniKeyboardPointerIndex < pointerCount) {
final int miniKeyboardX = (int) nativeMotionEvent.getX(miniKeyboardPointerIndex);
final int miniKeyboardY = (int) nativeMotionEvent.getY(miniKeyboardPointerIndex);
- MotionEvent translated = generateMiniKeyboardMotionEvent(
- action, miniKeyboardX, miniKeyboardY, eventTime);
+ MotionEvent translated = generateMiniKeyboardMotionEvent(action, miniKeyboardX, miniKeyboardY, eventTime);
mMiniKeyboard.onTouchEvent(translated);
translated.recycle();
}
diff --git a/src/main/java/com/anysoftkeyboard/keyboards/views/AnyKeyboardView.java b/src/main/java/com/anysoftkeyboard/keyboards/views/AnyKeyboardView.java
index c115c7552..cb675b776 100644
--- a/src/main/java/com/anysoftkeyboard/keyboards/views/AnyKeyboardView.java
+++ b/src/main/java/com/anysoftkeyboard/keyboards/views/AnyKeyboardView.java
@@ -204,7 +204,8 @@ public class AnyKeyboardView extends SizeSensitiveAnyKeyboardView {
if (System.currentTimeMillis() - mExtensionKeyboardAreaEntranceTime > DELAY_BEFORE_POPPING_UP_EXTENSION_KBD) {
KeyboardExtension extKbd = ((ExternalAnyKeyboard) getKeyboard()).getExtensionLayout();
- if (extKbd == null || extKbd.getKeyboardResId() == -1) {
+ if (extKbd == null || extKbd.getKeyboardResId() == AddOn.INVALID_RES_ID) {
+ Log.i(TAG, "No extension keyboard");
return super.onTouchEvent(me);
} else {
// telling the main keyboard that the last touch was
diff --git a/src/main/java/com/anysoftkeyboard/keyboards/views/QuickKeysKeyboardView.java b/src/main/java/com/anysoftkeyboard/keyboards/views/QuickKeysKeyboardView.java
index c01bbf100..d86acd731 100644
--- a/src/main/java/com/anysoftkeyboard/keyboards/views/QuickKeysKeyboardView.java
+++ b/src/main/java/com/anysoftkeyboard/keyboards/views/QuickKeysKeyboardView.java
@@ -45,6 +45,11 @@ public class QuickKeysKeyboardView extends SizeSensitiveAnyKeyboardView {
}
@Override
+ public void setKeyboard(AnyKeyboard keyboard, float verticalCorrection) {
+ super.setKeyboard(keyboard, 0/*no vertical correct here*/);
+ }
+
+ @Override
protected void setPaintForLabelText(Paint paint) {
super.setPaintForLabelText(paint);
if (mDoubleKeyFontSize) {