From e87fd4d2826734a931d7d6f019ee36212b5b060a Mon Sep 17 00:00:00 2001 From: Alan Viverette Date: Mon, 21 Nov 2011 17:56:03 -0800 Subject: [PATCH] Fixed typing uppercase letters when touch exploration is enabled. Bug: 5652774 Change-Id: Id8cd37b3ff93b45f4f18198bbbb827aadf945b02 --- .../KeyCodeDescriptionMapper.java | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/java/src/com/android/inputmethod/accessibility/KeyCodeDescriptionMapper.java b/java/src/com/android/inputmethod/accessibility/KeyCodeDescriptionMapper.java index 7302830d4..e01262c20 100644 --- a/java/src/com/android/inputmethod/accessibility/KeyCodeDescriptionMapper.java +++ b/java/src/com/android/inputmethod/accessibility/KeyCodeDescriptionMapper.java @@ -136,16 +136,14 @@ public class KeyCodeDescriptionMapper { if (!TextUtils.isEmpty(key.mLabel)) { final String label = key.mLabel.toString().trim(); + // First, attempt to map the label to a pre-defined description. if (mKeyLabelMap.containsKey(label)) { return context.getString(mKeyLabelMap.get(label)); - } else if (label.length() == 1 - || (keyboard.isManualTemporaryUpperCase() && !TextUtils - .isEmpty(key.mHintLabel))) { - return getDescriptionForKeyCode(context, keyboard, key, shouldObscure); - } else { - return label; } - } else if (key.mCode != Keyboard.CODE_DUMMY) { + } + + // Just attempt to speak the description. + if (key.mCode != Keyboard.CODE_DUMMY) { return getDescriptionForKeyCode(context, keyboard, key, shouldObscure); } @@ -187,11 +185,14 @@ public class KeyCodeDescriptionMapper { * @return the key code for the specified key */ private int getCorrectKeyCode(Keyboard keyboard, Key key) { - if (keyboard.isManualTemporaryUpperCase() && !TextUtils.isEmpty(key.mHintLabel)) { + // If keyboard is in manual temporary upper case state and key has + // manual temporary uppercase letter as key hint letter, alternate + // character code should be sent. + if (keyboard.isManualTemporaryUpperCase() && key.hasUppercaseLetter() + && !TextUtils.isEmpty(key.mHintLabel)) { return key.mHintLabel.charAt(0); - } else { - return key.mCode; } + return key.mCode; } /**