Loading java/src/com/android/inputmethod/accessibility/AccessibilityEntityProvider.java +4 −4 Original line number Diff line number Diff line Loading @@ -172,7 +172,7 @@ public final class AccessibilityEntityProvider extends AccessibilityNodeProvider return null; } final String keyDescription = getKeyDescription(key); final Rect boundsInParent = key.mHitBox; final Rect boundsInParent = key.getHitBox(); // Calculate the key's in-screen bounds. mTempBoundsInScreen.set(boundsInParent); Loading Loading @@ -208,8 +208,8 @@ public final class AccessibilityEntityProvider extends AccessibilityNodeProvider * @param key The key to press. */ void simulateKeyPress(final Key key) { final int x = key.mHitBox.centerX(); final int y = key.mHitBox.centerY(); final int x = key.getHitBox().centerX(); final int y = key.getHitBox().centerY(); final long downTime = SystemClock.uptimeMillis(); final MotionEvent downEvent = MotionEvent.obtain( downTime, downTime, MotionEvent.ACTION_DOWN, x, y, 0); Loading Loading @@ -325,6 +325,6 @@ public final class AccessibilityEntityProvider extends AccessibilityNodeProvider // The key x- and y-coordinates are stable between layout changes. // Generate an identifier by bit-shifting the x-coordinate to the // left-half of the integer and OR'ing with the y-coordinate. return ((0xFFFF & key.mX) << (Integer.SIZE / 2)) | (0xFFFF & key.mY); return ((0xFFFF & key.getX()) << (Integer.SIZE / 2)) | (0xFFFF & key.getY()); } } java/src/com/android/inputmethod/accessibility/KeyCodeDescriptionMapper.java +9 −9 Original line number Diff line number Diff line Loading @@ -97,7 +97,7 @@ public final class KeyCodeDescriptionMapper { */ public String getDescriptionForKey(final Context context, final Keyboard keyboard, final Key key, final boolean shouldObscure) { final int code = key.mCode; final int code = key.getCode(); if (code == Constants.CODE_SWITCH_ALPHA_SYMBOL) { final String description = getDescriptionForSwitchAlphaSymbol(context, keyboard); Loading @@ -116,8 +116,8 @@ public final class KeyCodeDescriptionMapper { return getDescriptionForActionKey(context, keyboard, key); } if (!TextUtils.isEmpty(key.mLabel)) { final String label = key.mLabel.toString().trim(); if (!TextUtils.isEmpty(key.getLabel())) { final String label = key.getLabel().trim(); // First, attempt to map the label to a pre-defined description. if (mKeyLabelMap.containsKey(label)) { Loading @@ -126,7 +126,7 @@ public final class KeyCodeDescriptionMapper { } // Just attempt to speak the description. if (key.mCode != Constants.CODE_UNSPECIFIED) { if (key.getCode() != Constants.CODE_UNSPECIFIED) { return getDescriptionForKeyCode(context, keyboard, key, shouldObscure); } return null; Loading Loading @@ -215,8 +215,8 @@ public final class KeyCodeDescriptionMapper { final int resId; // Always use the label, if available. if (!TextUtils.isEmpty(key.mLabel)) { return key.mLabel.toString().trim(); if (!TextUtils.isEmpty(key.getLabel())) { return key.getLabel().trim(); } // Otherwise, use the action ID. Loading Loading @@ -267,7 +267,7 @@ public final class KeyCodeDescriptionMapper { */ private String getDescriptionForKeyCode(final Context context, final Keyboard keyboard, final Key key, final boolean shouldObscure) { final int code = key.mCode; final int code = key.getCode(); // If the key description should be obscured, now is the time to do it. final boolean isDefinedNonCtrl = Character.isDefined(code) && !Character.isISOControl(code); Loading @@ -280,8 +280,8 @@ public final class KeyCodeDescriptionMapper { if (isDefinedNonCtrl) { return Character.toString((char) code); } if (!TextUtils.isEmpty(key.mLabel)) { return key.mLabel; if (!TextUtils.isEmpty(key.getLabel())) { return key.getLabel(); } return context.getString(R.string.spoken_description_unknown, code); } Loading java/src/com/android/inputmethod/keyboard/Key.java +98 −27 Original line number Diff line number Diff line Loading @@ -58,12 +58,12 @@ public class Key implements Comparable<Key> { /** * The key code (unicode or custom code) that this key generates. */ public final int mCode; private final int mCode; /** Label to display */ public final String mLabel; private final String mLabel; /** Hint label to display on the key in conjunction with the label */ public final String mHintLabel; private final String mHintLabel; /** Flags of the label */ private final int mLabelFlags; private static final int LABEL_FLAGS_ALIGN_LEFT = 0x01; Loading Loading @@ -95,18 +95,18 @@ public class Key implements Comparable<Key> { private final int mIconId; /** Width of the key, not including the gap */ public final int mWidth; private final int mWidth; /** Height of the key, not including the gap */ public final int mHeight; private final int mHeight; /** X coordinate of the key in the keyboard layout */ public final int mX; private final int mX; /** Y coordinate of the key in the keyboard layout */ public final int mY; private final int mY; /** Hit bounding box of the key */ public final Rect mHitBox = new Rect(); private final Rect mHitBox = new Rect(); /** More keys. It is guaranteed that this is null or an array of one or more elements */ public final MoreKeySpec[] mMoreKeys; private final MoreKeySpec[] mMoreKeys; /** More keys column number and flags */ private final int mMoreKeysColumnAndFlags; private static final int MORE_KEYS_COLUMN_MASK = 0x000000ff; Loading @@ -121,7 +121,7 @@ public class Key implements Comparable<Key> { private static final String MORE_KEYS_NO_PANEL_AUTO_MORE_KEY = "!noPanelAutoMoreKey!"; /** Background type that represents different key background visual than normal one. */ public final int mBackgroundType; private final int mBackgroundType; public static final int BACKGROUND_TYPE_EMPTY = 0; public static final int BACKGROUND_TYPE_NORMAL = 1; public static final int BACKGROUND_TYPE_FUNCTIONAL = 2; Loading @@ -135,7 +135,7 @@ public class Key implements Comparable<Key> { private static final int ACTION_FLAGS_ALT_CODE_WHILE_TYPING = 0x04; private static final int ACTION_FLAGS_ENABLE_LONG_PRESS = 0x08; public final KeyVisualAttributes mKeyVisualAttributes; private final KeyVisualAttributes mKeyVisualAttributes; private final OptionalAttributes mOptionalAttributes; Loading @@ -151,7 +151,7 @@ public class Key implements Comparable<Key> { public final int mVisualInsetsLeft; public final int mVisualInsetsRight; public OptionalAttributes(final String outputText, final int altCode, private OptionalAttributes(final String outputText, final int altCode, final int disabledIconId, final int previewIconId, final int visualInsetsLeft, final int visualInsetsRight) { mOutputText = outputText; Loading @@ -161,6 +161,18 @@ public class Key implements Comparable<Key> { mVisualInsetsLeft = visualInsetsLeft; mVisualInsetsRight = visualInsetsRight; } public static OptionalAttributes newInstance(final String outputText, final int altCode, final int disabledIconId, final int previewIconId, final int visualInsetsLeft, final int visualInsetsRight) { if (outputText == null && altCode == CODE_UNSPECIFIED && disabledIconId == ICON_UNDEFINED && previewIconId == ICON_UNDEFINED && visualInsetsLeft == 0 && visualInsetsRight == 0) { return null; } return new OptionalAttributes(outputText, altCode, disabledIconId, previewIconId, visualInsetsLeft, visualInsetsRight); } } private final int mHashCode; Loading Loading @@ -194,12 +206,9 @@ public class Key implements Comparable<Key> { mMoreKeys = null; mMoreKeysColumnAndFlags = 0; mLabel = label; if (outputText == null) { mOptionalAttributes = null; } else { mOptionalAttributes = new OptionalAttributes(outputText, CODE_UNSPECIFIED, ICON_UNDEFINED, ICON_UNDEFINED, 0, 0); } mOptionalAttributes = OptionalAttributes.newInstance(outputText, CODE_UNSPECIFIED, ICON_UNDEFINED, ICON_UNDEFINED, 0 /* visualInsetsLeft */, 0 /* visualInsetsRight */); mCode = code; mEnabled = (code != CODE_UNSPECIFIED); mIconId = iconId; Loading Loading @@ -360,15 +369,8 @@ public class Key implements Comparable<Key> { KeySpecParser.parseCode(style.getString(keyAttr, R.styleable.Keyboard_Key_altCode), params.mCodesSet, CODE_UNSPECIFIED), needsToUpperCase, locale); if (outputText == null && altCode == CODE_UNSPECIFIED && disabledIconId == ICON_UNDEFINED && previewIconId == ICON_UNDEFINED && visualInsetsLeft == 0 && visualInsetsRight == 0) { mOptionalAttributes = null; } else { mOptionalAttributes = new OptionalAttributes(outputText, altCode, disabledIconId, previewIconId, visualInsetsLeft, visualInsetsRight); } mOptionalAttributes = OptionalAttributes.newInstance(outputText, altCode, disabledIconId, previewIconId, visualInsetsLeft, visualInsetsRight); mKeyVisualAttributes = KeyVisualAttributes.newInstance(keyAttr); keyAttr.recycle(); mHashCode = computeHashCode(this); Loading @@ -377,6 +379,35 @@ public class Key implements Comparable<Key> { } } /** * Copy constructor. * * @param key the original key. */ protected Key(final Key key) { // Final attributes. mCode = key.mCode; mLabel = key.mLabel; mHintLabel = key.mHintLabel; mLabelFlags = key.mLabelFlags; mIconId = key.mIconId; mWidth = key.mWidth; mHeight = key.mHeight; mX = key.mX; mY = key.mY; mHitBox.set(key.mHitBox); mMoreKeys = key.mMoreKeys; mMoreKeysColumnAndFlags = key.mMoreKeysColumnAndFlags; mBackgroundType = key.mBackgroundType; mActionFlags = key.mActionFlags; mKeyVisualAttributes = key.mKeyVisualAttributes; mOptionalAttributes = key.mOptionalAttributes; mHashCode = key.mHashCode; // Key state. mPressed = key.mPressed; mEnabled = key.mEnabled; } private static boolean needsToUpperCase(final int labelFlags, final int keyboardElementId) { if ((labelFlags & LABEL_FLAGS_PRESERVE_CASE) != 0) return false; switch (keyboardElementId) { Loading Loading @@ -476,6 +507,22 @@ public class Key implements Comparable<Key> { } } public int getCode() { return mCode; } public String getLabel() { return mLabel; } public String getHintLabel() { return mHintLabel; } public MoreKeySpec[] getMoreKeys() { return mMoreKeys; } public void markAsLeftEdge(final KeyboardParams params) { mHitBox.left = params.mLeftPadding; } Loading Loading @@ -522,6 +569,10 @@ public class Key implements Comparable<Key> { && (mLabelFlags & LABEL_FLAGS_SHIFTED_LETTER_ACTIVATED) == 0; } public KeyVisualAttributes getVisualAttributes() { return mKeyVisualAttributes; } public final Typeface selectTypeface(final KeyDrawParams params) { // TODO: Handle "bold" here too? if ((mLabelFlags & LABEL_FLAGS_FONT_NORMAL) != 0) { Loading Loading @@ -696,6 +747,22 @@ public class Key implements Comparable<Key> { ? iconSet.getIconDrawable(previewIconId) : iconSet.getIconDrawable(mIconId); } public int getWidth() { return mWidth; } public int getHeight() { return mHeight; } public int getX() { return mX; } public int getY() { return mY; } public final int getDrawX() { final OptionalAttributes attrs = mOptionalAttributes; return (attrs == null) ? mX : mX + attrs.mVisualInsetsLeft; Loading Loading @@ -733,6 +800,10 @@ public class Key implements Comparable<Key> { mEnabled = enabled; } public Rect getHitBox() { return mHitBox; } /** * Detects if a point falls on this key. * @param x the x-coordinate of the point Loading java/src/com/android/inputmethod/keyboard/KeyDetector.java +4 −3 Original line number Diff line number Diff line Loading @@ -108,8 +108,9 @@ public class KeyDetector { if (distance > minDistance) { continue; } // To take care of hitbox overlaps, we compare mCode here too. if (primaryKey == null || distance < minDistance || key.mCode > primaryKey.mCode) { // To take care of hitbox overlaps, we compare key's code here too. if (primaryKey == null || distance < minDistance || key.getCode() > primaryKey.getCode()) { minDistance = distance; primaryKey = key; } Loading @@ -118,7 +119,7 @@ public class KeyDetector { } public static String printableCode(Key key) { return key != null ? Constants.printableCode(key.mCode) : "none"; return key != null ? Constants.printableCode(key.getCode()) : "none"; } public static String printableCodes(int[] codes) { Loading java/src/com/android/inputmethod/keyboard/Keyboard.java +2 −2 Original line number Diff line number Diff line Loading @@ -131,7 +131,7 @@ public class Keyboard { } for (final Key key : mKeys) { if (key.mCode == code) { if (key.getCode() == code) { mKeyCache.put(code, key); return key; } Loading @@ -148,7 +148,7 @@ public class Keyboard { for (final Key key : mKeys) { if (key == aKey) { mKeyCache.put(key.mCode, key); mKeyCache.put(key.getCode(), key); return true; } } Loading Loading
java/src/com/android/inputmethod/accessibility/AccessibilityEntityProvider.java +4 −4 Original line number Diff line number Diff line Loading @@ -172,7 +172,7 @@ public final class AccessibilityEntityProvider extends AccessibilityNodeProvider return null; } final String keyDescription = getKeyDescription(key); final Rect boundsInParent = key.mHitBox; final Rect boundsInParent = key.getHitBox(); // Calculate the key's in-screen bounds. mTempBoundsInScreen.set(boundsInParent); Loading Loading @@ -208,8 +208,8 @@ public final class AccessibilityEntityProvider extends AccessibilityNodeProvider * @param key The key to press. */ void simulateKeyPress(final Key key) { final int x = key.mHitBox.centerX(); final int y = key.mHitBox.centerY(); final int x = key.getHitBox().centerX(); final int y = key.getHitBox().centerY(); final long downTime = SystemClock.uptimeMillis(); final MotionEvent downEvent = MotionEvent.obtain( downTime, downTime, MotionEvent.ACTION_DOWN, x, y, 0); Loading Loading @@ -325,6 +325,6 @@ public final class AccessibilityEntityProvider extends AccessibilityNodeProvider // The key x- and y-coordinates are stable between layout changes. // Generate an identifier by bit-shifting the x-coordinate to the // left-half of the integer and OR'ing with the y-coordinate. return ((0xFFFF & key.mX) << (Integer.SIZE / 2)) | (0xFFFF & key.mY); return ((0xFFFF & key.getX()) << (Integer.SIZE / 2)) | (0xFFFF & key.getY()); } }
java/src/com/android/inputmethod/accessibility/KeyCodeDescriptionMapper.java +9 −9 Original line number Diff line number Diff line Loading @@ -97,7 +97,7 @@ public final class KeyCodeDescriptionMapper { */ public String getDescriptionForKey(final Context context, final Keyboard keyboard, final Key key, final boolean shouldObscure) { final int code = key.mCode; final int code = key.getCode(); if (code == Constants.CODE_SWITCH_ALPHA_SYMBOL) { final String description = getDescriptionForSwitchAlphaSymbol(context, keyboard); Loading @@ -116,8 +116,8 @@ public final class KeyCodeDescriptionMapper { return getDescriptionForActionKey(context, keyboard, key); } if (!TextUtils.isEmpty(key.mLabel)) { final String label = key.mLabel.toString().trim(); if (!TextUtils.isEmpty(key.getLabel())) { final String label = key.getLabel().trim(); // First, attempt to map the label to a pre-defined description. if (mKeyLabelMap.containsKey(label)) { Loading @@ -126,7 +126,7 @@ public final class KeyCodeDescriptionMapper { } // Just attempt to speak the description. if (key.mCode != Constants.CODE_UNSPECIFIED) { if (key.getCode() != Constants.CODE_UNSPECIFIED) { return getDescriptionForKeyCode(context, keyboard, key, shouldObscure); } return null; Loading Loading @@ -215,8 +215,8 @@ public final class KeyCodeDescriptionMapper { final int resId; // Always use the label, if available. if (!TextUtils.isEmpty(key.mLabel)) { return key.mLabel.toString().trim(); if (!TextUtils.isEmpty(key.getLabel())) { return key.getLabel().trim(); } // Otherwise, use the action ID. Loading Loading @@ -267,7 +267,7 @@ public final class KeyCodeDescriptionMapper { */ private String getDescriptionForKeyCode(final Context context, final Keyboard keyboard, final Key key, final boolean shouldObscure) { final int code = key.mCode; final int code = key.getCode(); // If the key description should be obscured, now is the time to do it. final boolean isDefinedNonCtrl = Character.isDefined(code) && !Character.isISOControl(code); Loading @@ -280,8 +280,8 @@ public final class KeyCodeDescriptionMapper { if (isDefinedNonCtrl) { return Character.toString((char) code); } if (!TextUtils.isEmpty(key.mLabel)) { return key.mLabel; if (!TextUtils.isEmpty(key.getLabel())) { return key.getLabel(); } return context.getString(R.string.spoken_description_unknown, code); } Loading
java/src/com/android/inputmethod/keyboard/Key.java +98 −27 Original line number Diff line number Diff line Loading @@ -58,12 +58,12 @@ public class Key implements Comparable<Key> { /** * The key code (unicode or custom code) that this key generates. */ public final int mCode; private final int mCode; /** Label to display */ public final String mLabel; private final String mLabel; /** Hint label to display on the key in conjunction with the label */ public final String mHintLabel; private final String mHintLabel; /** Flags of the label */ private final int mLabelFlags; private static final int LABEL_FLAGS_ALIGN_LEFT = 0x01; Loading Loading @@ -95,18 +95,18 @@ public class Key implements Comparable<Key> { private final int mIconId; /** Width of the key, not including the gap */ public final int mWidth; private final int mWidth; /** Height of the key, not including the gap */ public final int mHeight; private final int mHeight; /** X coordinate of the key in the keyboard layout */ public final int mX; private final int mX; /** Y coordinate of the key in the keyboard layout */ public final int mY; private final int mY; /** Hit bounding box of the key */ public final Rect mHitBox = new Rect(); private final Rect mHitBox = new Rect(); /** More keys. It is guaranteed that this is null or an array of one or more elements */ public final MoreKeySpec[] mMoreKeys; private final MoreKeySpec[] mMoreKeys; /** More keys column number and flags */ private final int mMoreKeysColumnAndFlags; private static final int MORE_KEYS_COLUMN_MASK = 0x000000ff; Loading @@ -121,7 +121,7 @@ public class Key implements Comparable<Key> { private static final String MORE_KEYS_NO_PANEL_AUTO_MORE_KEY = "!noPanelAutoMoreKey!"; /** Background type that represents different key background visual than normal one. */ public final int mBackgroundType; private final int mBackgroundType; public static final int BACKGROUND_TYPE_EMPTY = 0; public static final int BACKGROUND_TYPE_NORMAL = 1; public static final int BACKGROUND_TYPE_FUNCTIONAL = 2; Loading @@ -135,7 +135,7 @@ public class Key implements Comparable<Key> { private static final int ACTION_FLAGS_ALT_CODE_WHILE_TYPING = 0x04; private static final int ACTION_FLAGS_ENABLE_LONG_PRESS = 0x08; public final KeyVisualAttributes mKeyVisualAttributes; private final KeyVisualAttributes mKeyVisualAttributes; private final OptionalAttributes mOptionalAttributes; Loading @@ -151,7 +151,7 @@ public class Key implements Comparable<Key> { public final int mVisualInsetsLeft; public final int mVisualInsetsRight; public OptionalAttributes(final String outputText, final int altCode, private OptionalAttributes(final String outputText, final int altCode, final int disabledIconId, final int previewIconId, final int visualInsetsLeft, final int visualInsetsRight) { mOutputText = outputText; Loading @@ -161,6 +161,18 @@ public class Key implements Comparable<Key> { mVisualInsetsLeft = visualInsetsLeft; mVisualInsetsRight = visualInsetsRight; } public static OptionalAttributes newInstance(final String outputText, final int altCode, final int disabledIconId, final int previewIconId, final int visualInsetsLeft, final int visualInsetsRight) { if (outputText == null && altCode == CODE_UNSPECIFIED && disabledIconId == ICON_UNDEFINED && previewIconId == ICON_UNDEFINED && visualInsetsLeft == 0 && visualInsetsRight == 0) { return null; } return new OptionalAttributes(outputText, altCode, disabledIconId, previewIconId, visualInsetsLeft, visualInsetsRight); } } private final int mHashCode; Loading Loading @@ -194,12 +206,9 @@ public class Key implements Comparable<Key> { mMoreKeys = null; mMoreKeysColumnAndFlags = 0; mLabel = label; if (outputText == null) { mOptionalAttributes = null; } else { mOptionalAttributes = new OptionalAttributes(outputText, CODE_UNSPECIFIED, ICON_UNDEFINED, ICON_UNDEFINED, 0, 0); } mOptionalAttributes = OptionalAttributes.newInstance(outputText, CODE_UNSPECIFIED, ICON_UNDEFINED, ICON_UNDEFINED, 0 /* visualInsetsLeft */, 0 /* visualInsetsRight */); mCode = code; mEnabled = (code != CODE_UNSPECIFIED); mIconId = iconId; Loading Loading @@ -360,15 +369,8 @@ public class Key implements Comparable<Key> { KeySpecParser.parseCode(style.getString(keyAttr, R.styleable.Keyboard_Key_altCode), params.mCodesSet, CODE_UNSPECIFIED), needsToUpperCase, locale); if (outputText == null && altCode == CODE_UNSPECIFIED && disabledIconId == ICON_UNDEFINED && previewIconId == ICON_UNDEFINED && visualInsetsLeft == 0 && visualInsetsRight == 0) { mOptionalAttributes = null; } else { mOptionalAttributes = new OptionalAttributes(outputText, altCode, disabledIconId, previewIconId, visualInsetsLeft, visualInsetsRight); } mOptionalAttributes = OptionalAttributes.newInstance(outputText, altCode, disabledIconId, previewIconId, visualInsetsLeft, visualInsetsRight); mKeyVisualAttributes = KeyVisualAttributes.newInstance(keyAttr); keyAttr.recycle(); mHashCode = computeHashCode(this); Loading @@ -377,6 +379,35 @@ public class Key implements Comparable<Key> { } } /** * Copy constructor. * * @param key the original key. */ protected Key(final Key key) { // Final attributes. mCode = key.mCode; mLabel = key.mLabel; mHintLabel = key.mHintLabel; mLabelFlags = key.mLabelFlags; mIconId = key.mIconId; mWidth = key.mWidth; mHeight = key.mHeight; mX = key.mX; mY = key.mY; mHitBox.set(key.mHitBox); mMoreKeys = key.mMoreKeys; mMoreKeysColumnAndFlags = key.mMoreKeysColumnAndFlags; mBackgroundType = key.mBackgroundType; mActionFlags = key.mActionFlags; mKeyVisualAttributes = key.mKeyVisualAttributes; mOptionalAttributes = key.mOptionalAttributes; mHashCode = key.mHashCode; // Key state. mPressed = key.mPressed; mEnabled = key.mEnabled; } private static boolean needsToUpperCase(final int labelFlags, final int keyboardElementId) { if ((labelFlags & LABEL_FLAGS_PRESERVE_CASE) != 0) return false; switch (keyboardElementId) { Loading Loading @@ -476,6 +507,22 @@ public class Key implements Comparable<Key> { } } public int getCode() { return mCode; } public String getLabel() { return mLabel; } public String getHintLabel() { return mHintLabel; } public MoreKeySpec[] getMoreKeys() { return mMoreKeys; } public void markAsLeftEdge(final KeyboardParams params) { mHitBox.left = params.mLeftPadding; } Loading Loading @@ -522,6 +569,10 @@ public class Key implements Comparable<Key> { && (mLabelFlags & LABEL_FLAGS_SHIFTED_LETTER_ACTIVATED) == 0; } public KeyVisualAttributes getVisualAttributes() { return mKeyVisualAttributes; } public final Typeface selectTypeface(final KeyDrawParams params) { // TODO: Handle "bold" here too? if ((mLabelFlags & LABEL_FLAGS_FONT_NORMAL) != 0) { Loading Loading @@ -696,6 +747,22 @@ public class Key implements Comparable<Key> { ? iconSet.getIconDrawable(previewIconId) : iconSet.getIconDrawable(mIconId); } public int getWidth() { return mWidth; } public int getHeight() { return mHeight; } public int getX() { return mX; } public int getY() { return mY; } public final int getDrawX() { final OptionalAttributes attrs = mOptionalAttributes; return (attrs == null) ? mX : mX + attrs.mVisualInsetsLeft; Loading Loading @@ -733,6 +800,10 @@ public class Key implements Comparable<Key> { mEnabled = enabled; } public Rect getHitBox() { return mHitBox; } /** * Detects if a point falls on this key. * @param x the x-coordinate of the point Loading
java/src/com/android/inputmethod/keyboard/KeyDetector.java +4 −3 Original line number Diff line number Diff line Loading @@ -108,8 +108,9 @@ public class KeyDetector { if (distance > minDistance) { continue; } // To take care of hitbox overlaps, we compare mCode here too. if (primaryKey == null || distance < minDistance || key.mCode > primaryKey.mCode) { // To take care of hitbox overlaps, we compare key's code here too. if (primaryKey == null || distance < minDistance || key.getCode() > primaryKey.getCode()) { minDistance = distance; primaryKey = key; } Loading @@ -118,7 +119,7 @@ public class KeyDetector { } public static String printableCode(Key key) { return key != null ? Constants.printableCode(key.mCode) : "none"; return key != null ? Constants.printableCode(key.getCode()) : "none"; } public static String printableCodes(int[] codes) { Loading
java/src/com/android/inputmethod/keyboard/Keyboard.java +2 −2 Original line number Diff line number Diff line Loading @@ -131,7 +131,7 @@ public class Keyboard { } for (final Key key : mKeys) { if (key.mCode == code) { if (key.getCode() == code) { mKeyCache.put(code, key); return key; } Loading @@ -148,7 +148,7 @@ public class Keyboard { for (final Key key : mKeys) { if (key == aKey) { mKeyCache.put(key.mCode, key); mKeyCache.put(key.getCode(), key); return true; } } Loading