am dc0c1e40: Merge "Add EmojiPageKeyboardAccessibilityDelegate"

* commit 'dc0c1e40be53e8657634cf77bd6fe3edb1b14441':
  Add EmojiPageKeyboardAccessibilityDelegate
main
Tadashi G. Takaoka 2014-06-13 07:55:36 +00:00 committed by Android Git Automerger
commit c2cabf48b6
2 changed files with 21 additions and 5 deletions

View File

@ -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 {

View File

@ -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);
}
}