From 2013bab89ca2f82589f99d98d9cf3b41ea5aac65 Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Wed, 30 Nov 2011 17:54:58 +0900 Subject: Add Key.altCode attribute * Registering alternate code and while key is typing. * Showing press/release graphics of the key that has the above altenate code. * Showing press/release graphics of all shift keys. * Renaming Key.ignoreWhileTyping to Key.altCodeWhileTyping. Bug: 5639503 Change-Id: I67fb45bae76284a1f0deb6fd12ae5fb781d06cc3 --- java/src/com/android/inputmethod/keyboard/Key.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'java/src/com/android/inputmethod/keyboard/Key.java') diff --git a/java/src/com/android/inputmethod/keyboard/Key.java b/java/src/com/android/inputmethod/keyboard/Key.java index 84f2be585..b2b68f0ad 100644 --- a/java/src/com/android/inputmethod/keyboard/Key.java +++ b/java/src/com/android/inputmethod/keyboard/Key.java @@ -46,6 +46,7 @@ public class Key { * The key code (unicode or custom code) that this key generates. */ public final int mCode; + public final int mAltCode; /** Label to display */ public final CharSequence mLabel; @@ -108,7 +109,7 @@ public class Key { private final int mActionFlags; private static final int ACTION_FLAGS_IS_REPEATABLE = 0x01; private static final int ACTION_FLAGS_NO_KEY_PREVIEW = 0x02; - private static final int ACTION_FLAGS_IGNORE_WHILE_TYPING = 0x04; + private static final int ACTION_FLAGS_ALT_CODE_WHILE_TYPING = 0x04; /** The current pressed state of this key */ private boolean mPressed; @@ -191,6 +192,7 @@ public class Key { mLabel = label; mOutputText = outputText; mCode = code; + mAltCode = Keyboard.CODE_DUMMY; mIcon = icon; // Horizontal gap is divided equally to both sides of the key. mX = x + mHorizontalGap / 2; @@ -290,6 +292,8 @@ public class Key { } else { mCode = Keyboard.CODE_DUMMY; } + mAltCode = style.getInt(keyAttr, + R.styleable.Keyboard_Key_altCode, Keyboard.CODE_DUMMY); keyAttr.recycle(); } @@ -334,8 +338,8 @@ public class Key { return (mActionFlags & ACTION_FLAGS_NO_KEY_PREVIEW) != 0; } - public boolean ignoreWhileTyping() { - return (mActionFlags & ACTION_FLAGS_IGNORE_WHILE_TYPING) != 0; + public boolean altCodeWhileTyping() { + return (mActionFlags & ACTION_FLAGS_ALT_CODE_WHILE_TYPING) != 0; } public Typeface selectTypeface(Typeface defaultTypeface) { -- cgit v1.2.3