diff options
Diffstat (limited to 'java/src')
3 files changed, 4 insertions, 54 deletions
diff --git a/java/src/com/android/inputmethod/keyboard/Key.java b/java/src/com/android/inputmethod/keyboard/Key.java index 3cfecf5ef..5e58821d0 100644 --- a/java/src/com/android/inputmethod/keyboard/Key.java +++ b/java/src/com/android/inputmethod/keyboard/Key.java @@ -36,8 +36,6 @@ import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; /** * Class for describing the position and characteristics of a single key in the keyboard. @@ -129,45 +127,6 @@ public class Key { /** Key is enabled and responds on press */ private boolean mEnabled = true; - // RTL parenthesis character swapping map. - private static final Map<Integer, Integer> sRtlParenthesisMap = new HashMap<Integer, Integer>(); - - static { - // The all letters need to be mirrored are found at - // http://www.unicode.org/Public/6.0.0/ucd/extracted/DerivedBinaryProperties.txt - addRtlParenthesisPair('(', ')'); - addRtlParenthesisPair('[', ']'); - addRtlParenthesisPair('{', '}'); - addRtlParenthesisPair('<', '>'); - // \u00ab: LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - // \u00bb: RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - addRtlParenthesisPair('\u00ab', '\u00bb'); - // \u2039: SINGLE LEFT-POINTING ANGLE QUOTATION MARK - // \u203a: SINGLE RIGHT-POINTING ANGLE QUOTATION MARK - addRtlParenthesisPair('\u2039', '\u203a'); - // \u2264: LESS-THAN OR EQUAL TO - // \u2265: GREATER-THAN OR EQUAL TO - addRtlParenthesisPair('\u2264', '\u2265'); - } - - private static void addRtlParenthesisPair(int left, int right) { - sRtlParenthesisMap.put(left, right); - sRtlParenthesisMap.put(right, left); - } - - public static int getRtlParenthesisCode(int code, boolean isRtl) { - if (isRtl && sRtlParenthesisMap.containsKey(code)) { - return sRtlParenthesisMap.get(code); - } else { - return code; - } - } - - private static int getCode(Resources res, Keyboard.Params params, String moreKeySpec) { - return getRtlParenthesisCode( - MoreKeySpecParser.getCode(res, moreKeySpec), params.mIsRtlKeyboard); - } - private static Drawable getIcon(Keyboard.Params params, String moreKeySpec) { final int iconAttrId = MoreKeySpecParser.getIconAttrId(moreKeySpec); if (iconAttrId == KeyboardIconsSet.ICON_UNDEFINED) { @@ -183,7 +142,8 @@ public class Key { public Key(Resources res, Keyboard.Params params, String moreKeySpec, int x, int y, int width, int height) { this(params, MoreKeySpecParser.getLabel(moreKeySpec), null, getIcon(params, moreKeySpec), - getCode(res, params, moreKeySpec), MoreKeySpecParser.getOutputText(moreKeySpec), + MoreKeySpecParser.getCode(res, moreKeySpec), + MoreKeySpecParser.getOutputText(moreKeySpec), x, y, width, height); } @@ -311,16 +271,14 @@ public class Key { if (code == Keyboard.CODE_UNSPECIFIED && TextUtils.isEmpty(outputText) && !TextUtils.isEmpty(mLabel)) { if (mLabel.codePointCount(0, mLabel.length()) == 1) { - final int activatedCode; // Use the first letter of the hint label if shiftedLetterActivated flag is // specified. if (hasShiftedLetterHint() && isShiftedLetterActivated() && !TextUtils.isEmpty(mHintLabel)) { - activatedCode = mHintLabel.codePointAt(0); + mCode = mHintLabel.codePointAt(0); } else { - activatedCode = mLabel.codePointAt(0); + mCode = mLabel.codePointAt(0); } - mCode = getRtlParenthesisCode(activatedCode, params.mIsRtlKeyboard); } else { // In some locale and case, the character might be represented by multiple code // points, such as upper case Eszett of German alphabet. diff --git a/java/src/com/android/inputmethod/keyboard/Keyboard.java b/java/src/com/android/inputmethod/keyboard/Keyboard.java index 1e1f439d4..6653dec4b 100644 --- a/java/src/com/android/inputmethod/keyboard/Keyboard.java +++ b/java/src/com/android/inputmethod/keyboard/Keyboard.java @@ -121,9 +121,6 @@ public class Keyboard { /** Maximum column for mini keyboard */ public final int mMaxMiniKeyboardColumn; - /** True if Right-To-Left keyboard */ - public final boolean mIsRtlKeyboard; - /** List of keys and icons in this keyboard */ public final Set<Key> mKeys; public final Set<Key> mShiftKeys; @@ -140,7 +137,6 @@ public class Keyboard { mOccupiedWidth = params.mOccupiedWidth; mMostCommonKeyHeight = params.mMostCommonKeyHeight; mMostCommonKeyWidth = params.mMostCommonKeyWidth; - mIsRtlKeyboard = params.mIsRtlKeyboard; mMoreKeysTemplate = params.mMoreKeysTemplate; mMaxMiniKeyboardColumn = params.mMaxMiniKeyboardColumn; @@ -222,7 +218,6 @@ public class Keyboard { public int mHorizontalGap; public int mVerticalGap; - public boolean mIsRtlKeyboard; public int mMoreKeysTemplate; public int mMaxMiniKeyboardColumn; @@ -739,8 +734,6 @@ public class Keyboard { R.styleable.Keyboard_rowHeight, params.mBaseHeight, params.mBaseHeight / DEFAULT_KEYBOARD_ROWS); - params.mIsRtlKeyboard = keyboardAttr.getBoolean( - R.styleable.Keyboard_isRtlKeyboard, false); params.mMoreKeysTemplate = keyboardAttr.getResourceId( R.styleable.Keyboard_moreKeysTemplate, 0); params.mMaxMiniKeyboardColumn = keyAttr.getInt( diff --git a/java/src/com/android/inputmethod/keyboard/MiniKeyboard.java b/java/src/com/android/inputmethod/keyboard/MiniKeyboard.java index 974291373..433bd0d75 100644 --- a/java/src/com/android/inputmethod/keyboard/MiniKeyboard.java +++ b/java/src/com/android/inputmethod/keyboard/MiniKeyboard.java @@ -210,7 +210,6 @@ public class MiniKeyboard extends Keyboard { // TODO: Mini keyboard's vertical gap is currently calculated heuristically. // Should revise the algorithm. mParams.mVerticalGap = parentKeyboard.mVerticalGap / 2; - mParams.mIsRtlKeyboard = parentKeyboard.mIsRtlKeyboard; mMoreKeys = parentKey.mMoreKeys; final int previewWidth = view.mKeyPreviewDrawParams.mPreviewBackgroundWidth; |