am 4b813f56: am bd1cc1da: Fix bug that upper case mini-keyboard does not work
Merge commit '4b813f56bbe11210835a31de7fd73bfe5a566ead' * commit '4b813f56bbe11210835a31de7fd73bfe5a566ead': Fix bug that upper case mini-keyboard does not workmain
commit
1e445ed2af
|
@ -41,19 +41,19 @@ class MiniKeyboardKeyDetector extends KeyDetector {
|
||||||
final Key[] keys = getKeys();
|
final Key[] keys = getKeys();
|
||||||
final int touchX = getTouchX(x);
|
final int touchX = getTouchX(x);
|
||||||
final int touchY = getTouchY(y);
|
final int touchY = getTouchY(y);
|
||||||
int closestKey = LatinKeyboardBaseView.NOT_A_KEY;
|
int closestKeyIndex = LatinKeyboardBaseView.NOT_A_KEY;
|
||||||
int closestKeyDist = (y < 0) ? mSlideAllowanceSquareTop : mSlideAllowanceSquare;
|
int closestKeyDist = (y < 0) ? mSlideAllowanceSquareTop : mSlideAllowanceSquare;
|
||||||
final int keyCount = keys.length;
|
final int keyCount = keys.length;
|
||||||
for (int i = 0; i < keyCount; i++) {
|
for (int i = 0; i < keyCount; i++) {
|
||||||
final Key key = keys[i];
|
final Key key = keys[i];
|
||||||
int dist = key.squaredDistanceFrom(touchX, touchY);
|
int dist = key.squaredDistanceFrom(touchX, touchY);
|
||||||
if (dist < closestKeyDist) {
|
if (dist < closestKeyDist) {
|
||||||
closestKey = i;
|
closestKeyIndex = i;
|
||||||
closestKeyDist = dist;
|
closestKeyDist = dist;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (allKeys != null && closestKey != LatinKeyboardBaseView.NOT_A_KEY)
|
if (allKeys != null && closestKeyIndex != LatinKeyboardBaseView.NOT_A_KEY)
|
||||||
allKeys[0] = closestKey;
|
allKeys[0] = keys[closestKeyIndex].codes[0];
|
||||||
return closestKey;
|
return closestKeyIndex;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue