Disable pop-up preview on mini keyboard
This change also disable the special behavior of long press a key that has only one digit alternate. If the visual design of both the pop-up preview and the mini keyboard will look like same, I think that showing mini keyboard is enough for the key that has one digit alternate. Bug: 2973546 Change-Id: I04f138c120aa58526fe054626dac856171fb7a58
This commit is contained in:
parent
12659d4c0c
commit
8d7ffcb2ac
2 changed files with 2 additions and 19 deletions
|
@ -1073,7 +1073,8 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx
|
||||||
mMiniKeyboardOriginY = y + container.getPaddingTop();
|
mMiniKeyboardOriginY = y + container.getPaddingTop();
|
||||||
mMiniKeyboard.setPopupOffset((x < 0) ? 0 : x, y);
|
mMiniKeyboard.setPopupOffset((x < 0) ? 0 : x, y);
|
||||||
mMiniKeyboard.setShifted(isShifted());
|
mMiniKeyboard.setShifted(isShifted());
|
||||||
mMiniKeyboard.setPreviewEnabled(isPreviewEnabled());
|
// Mini keyboard needs no pop-up key preview displayed.
|
||||||
|
mMiniKeyboard.setPreviewEnabled(false);
|
||||||
mMiniKeyboardPopup.setContentView(container);
|
mMiniKeyboardPopup.setContentView(container);
|
||||||
mMiniKeyboardPopup.setWidth(container.getMeasuredWidth());
|
mMiniKeyboardPopup.setWidth(container.getMeasuredWidth());
|
||||||
mMiniKeyboardPopup.setHeight(container.getMeasuredHeight());
|
mMiniKeyboardPopup.setHeight(container.getMeasuredHeight());
|
||||||
|
|
|
@ -78,17 +78,6 @@ public class LatinKeyboardView extends LatinKeyboardBaseView {
|
||||||
setKeyboardLocal(k);
|
setKeyboardLocal(k);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean hasOneDigitAlternate(Key key) {
|
|
||||||
final CharSequence alternates = key.popupCharacters;
|
|
||||||
if (alternates == null)
|
|
||||||
return false;
|
|
||||||
final String altChars = alternates.toString();
|
|
||||||
if (altChars.codePointCount(0, altChars.length()) != 1)
|
|
||||||
return false;
|
|
||||||
final int altCode = altChars.codePointAt(0);
|
|
||||||
return altCode >= '0' && altCode <= '9';
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean onLongPress(Key key) {
|
protected boolean onLongPress(Key key) {
|
||||||
int primaryCode = key.codes[0];
|
int primaryCode = key.codes[0];
|
||||||
|
@ -104,13 +93,6 @@ public class LatinKeyboardView extends LatinKeyboardBaseView {
|
||||||
LatinKeyboardBaseView.NOT_A_TOUCH_COORDINATE,
|
LatinKeyboardBaseView.NOT_A_TOUCH_COORDINATE,
|
||||||
LatinKeyboardBaseView.NOT_A_TOUCH_COORDINATE);
|
LatinKeyboardBaseView.NOT_A_TOUCH_COORDINATE);
|
||||||
return true;
|
return true;
|
||||||
} else if (hasOneDigitAlternate(key)) {
|
|
||||||
mKeyCodes[0] = primaryCode = key.popupCharacters.charAt(0);
|
|
||||||
// when there is only one alternate character, send it as key action.
|
|
||||||
getOnKeyboardActionListener().onKey(primaryCode, mKeyCodes,
|
|
||||||
LatinKeyboardBaseView.NOT_A_TOUCH_COORDINATE,
|
|
||||||
LatinKeyboardBaseView.NOT_A_TOUCH_COORDINATE);
|
|
||||||
return true;
|
|
||||||
} else {
|
} else {
|
||||||
return super.onLongPress(key);
|
return super.onLongPress(key);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue