Merge "Add EmojiPageKeyboardAccessibilityDelegate"
This commit is contained in:
commit
dc0c1e40be
2 changed files with 21 additions and 5 deletions
|
@ -55,7 +55,22 @@ final class EmojiPageKeyboardView extends KeyboardView implements
|
|||
private OnKeyEventListener mListener = EMPTY_LISTENER;
|
||||
private final KeyDetector mKeyDetector = new KeyDetector();
|
||||
private final GestureDetector mGestureDetector;
|
||||
private KeyboardAccessibilityDelegate<EmojiPageKeyboardView> mAccessibilityDelegate;
|
||||
private EmojiPageKeyboardAccessibilityDelegate mAccessibilityDelegate;
|
||||
|
||||
private static final class EmojiPageKeyboardAccessibilityDelegate
|
||||
extends KeyboardAccessibilityDelegate<EmojiPageKeyboardView> {
|
||||
public EmojiPageKeyboardAccessibilityDelegate(final EmojiPageKeyboardView keyboardView,
|
||||
final KeyDetector keyDetector) {
|
||||
super(keyboardView, keyDetector);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void simulateTouchEvent(int touchAction, MotionEvent hoverEvent) {
|
||||
final MotionEvent touchEvent = synthesizeTouchEvent(touchAction, hoverEvent);
|
||||
mKeyboardView.onTouchEvent(touchEvent);
|
||||
touchEvent.recycle();
|
||||
}
|
||||
}
|
||||
|
||||
public EmojiPageKeyboardView(final Context context, final AttributeSet attrs) {
|
||||
this(context, attrs, R.attr.keyboardViewStyle);
|
||||
|
@ -82,7 +97,8 @@ final class EmojiPageKeyboardView extends KeyboardView implements
|
|||
mKeyDetector.setKeyboard(keyboard, 0 /* correctionX */, 0 /* correctionY */);
|
||||
if (AccessibilityUtils.getInstance().isAccessibilityEnabled()) {
|
||||
if (mAccessibilityDelegate == null) {
|
||||
mAccessibilityDelegate = new KeyboardAccessibilityDelegate<>(this, mKeyDetector);
|
||||
mAccessibilityDelegate = new EmojiPageKeyboardAccessibilityDelegate(
|
||||
this, mKeyDetector);
|
||||
}
|
||||
mAccessibilityDelegate.setKeyboard(keyboard);
|
||||
} else {
|
||||
|
|
|
@ -263,10 +263,10 @@ public final class Constants {
|
|||
case CODE_ENTER: return "enter";
|
||||
case CODE_SPACE: return "space";
|
||||
default:
|
||||
if (code < CODE_SPACE) return String.format("\\u%02x", code);
|
||||
if (code < CODE_SPACE) return String.format("\\u%02X", code);
|
||||
if (code < 0x100) return String.format("%c", code);
|
||||
if (code < 0x10000) return String.format("\\u04x", code);
|
||||
return String.format("\\U%05x", code);
|
||||
if (code < 0x10000) return String.format("\\u%04X", code);
|
||||
return String.format("\\U%05X", code);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue