diff --git a/java/res/drawable-xlarge-land/key_hint_at_large_holo.9.png b/java/res/drawable-xlarge-land/key_hint_at_large_holo.9.png new file mode 100644 index 0000000000000000000000000000000000000000..eaad0664cb0223f4c1fd616b15ced1d845584189 Binary files /dev/null and b/java/res/drawable-xlarge-land/key_hint_at_large_holo.9.png differ diff --git a/java/res/drawable-xlarge-land/key_hint_colon_large_holo.9.png b/java/res/drawable-xlarge-land/key_hint_colon_large_holo.9.png new file mode 100644 index 0000000000000000000000000000000000000000..bdf4ed5744d2f62aef577aad4484df9e38daa116 Binary files /dev/null and b/java/res/drawable-xlarge-land/key_hint_colon_large_holo.9.png differ diff --git a/java/res/drawable-xlarge-land/key_hint_exclamation_large_holo.9.png b/java/res/drawable-xlarge-land/key_hint_exclamation_large_holo.9.png new file mode 100644 index 0000000000000000000000000000000000000000..6511822aba6d5faec5f943550711cd97c5c2e913 Binary files /dev/null and b/java/res/drawable-xlarge-land/key_hint_exclamation_large_holo.9.png differ diff --git a/java/res/drawable-xlarge-land/key_hint_plus_large_holo.9.png b/java/res/drawable-xlarge-land/key_hint_plus_large_holo.9.png new file mode 100644 index 0000000000000000000000000000000000000000..206d990734f73f47b049921e716d2eb74b04209a Binary files /dev/null and b/java/res/drawable-xlarge-land/key_hint_plus_large_holo.9.png differ diff --git a/java/res/drawable-xlarge-land/key_hint_question_large_holo.9.png b/java/res/drawable-xlarge-land/key_hint_question_large_holo.9.png new file mode 100644 index 0000000000000000000000000000000000000000..d205ef83d53e97e20815369deb477a48b5f8819a Binary files /dev/null and b/java/res/drawable-xlarge-land/key_hint_question_large_holo.9.png differ diff --git a/java/res/drawable-xlarge-land/key_hint_quote_large_holo.9.png b/java/res/drawable-xlarge-land/key_hint_quote_large_holo.9.png new file mode 100644 index 0000000000000000000000000000000000000000..074d619c9ad3d1c223798387fb5a3af9a97531ed Binary files /dev/null and b/java/res/drawable-xlarge-land/key_hint_quote_large_holo.9.png differ diff --git a/java/res/drawable-xlarge-land/key_hint_slash_large_holo.9.png b/java/res/drawable-xlarge-land/key_hint_slash_large_holo.9.png new file mode 100644 index 0000000000000000000000000000000000000000..a3a02973cb3ef342c73232a952f0015c546a21c3 Binary files /dev/null and b/java/res/drawable-xlarge-land/key_hint_slash_large_holo.9.png differ diff --git a/java/res/drawable-xlarge/key_hint_at_large_holo.9.png b/java/res/drawable-xlarge/key_hint_at_large_holo.9.png new file mode 100644 index 0000000000000000000000000000000000000000..ff56845f88b7b5ae555a019d12f5038cc136a198 Binary files /dev/null and b/java/res/drawable-xlarge/key_hint_at_large_holo.9.png differ diff --git a/java/res/drawable-xlarge/key_hint_colon_large_holo.9.png b/java/res/drawable-xlarge/key_hint_colon_large_holo.9.png new file mode 100644 index 0000000000000000000000000000000000000000..91e788323a8a0aad06264b95e13c5b7858a02f4f Binary files /dev/null and b/java/res/drawable-xlarge/key_hint_colon_large_holo.9.png differ diff --git a/java/res/drawable-xlarge/key_hint_exclamation_large_holo.9.png b/java/res/drawable-xlarge/key_hint_exclamation_large_holo.9.png new file mode 100644 index 0000000000000000000000000000000000000000..0152ce21b63d58b62875506b8fb62f2193d80a92 Binary files /dev/null and b/java/res/drawable-xlarge/key_hint_exclamation_large_holo.9.png differ diff --git a/java/res/drawable-xlarge/key_hint_plus_large_holo.9.png b/java/res/drawable-xlarge/key_hint_plus_large_holo.9.png new file mode 100644 index 0000000000000000000000000000000000000000..5f7d315638b178297a7ed44ab70731383cf66226 Binary files /dev/null and b/java/res/drawable-xlarge/key_hint_plus_large_holo.9.png differ diff --git a/java/res/drawable-xlarge/key_hint_question_large_holo.9.png b/java/res/drawable-xlarge/key_hint_question_large_holo.9.png new file mode 100644 index 0000000000000000000000000000000000000000..8a9dffbe2739819015a648aa2b1fa1aab96397a6 Binary files /dev/null and b/java/res/drawable-xlarge/key_hint_question_large_holo.9.png differ diff --git a/java/res/drawable-xlarge/key_hint_quote_large_holo.9.png b/java/res/drawable-xlarge/key_hint_quote_large_holo.9.png new file mode 100644 index 0000000000000000000000000000000000000000..6514e0bf7f587a56376658957fd9beba16bf8d25 Binary files /dev/null and b/java/res/drawable-xlarge/key_hint_quote_large_holo.9.png differ diff --git a/java/res/drawable-xlarge/key_hint_slash_large_holo.9.png b/java/res/drawable-xlarge/key_hint_slash_large_holo.9.png new file mode 100644 index 0000000000000000000000000000000000000000..75c3bb1a65ba7404faafd89274e6ea3605cbb7d5 Binary files /dev/null and b/java/res/drawable-xlarge/key_hint_slash_large_holo.9.png differ diff --git a/java/res/values/attrs.xml b/java/res/values/attrs.xml index 72e3f0dd09c45568c89df9da43d7a686566fe848..815c7fd28ca4ec441368d81f94ac72cee508ae60 100644 --- a/java/res/values/attrs.xml +++ b/java/res/values/attrs.xml @@ -106,12 +106,15 @@ <attr name="keyOutputText" format="string" /> <!-- The label to display on the key. --> <attr name="keyLabel" format="string" /> - <!-- The label to display on the key when keyboard is in temporary shift mode. --> - <attr name="temporaryShiftKeyLabel" format="string" /> + <!-- The unicode that this key generates in manual temporary upper case mode. --> + <attr name="manualTemporaryUpperCaseCode" format="integer" /> <!-- The icon to display on the key instead of the label. --> <attr name="keyIcon" format="reference" /> <!-- The hint icon to display on the key in conjunction with the label --> <attr name="keyHintIcon" format="reference" /> + <!-- The hint icon to display on the key when keyboard is in manual temporary upper case + mode. --> + <attr name="manualTemporaryUpperCaseHintIcon" format="reference" /> </declare-styleable> <declare-styleable name="BaseKeyboard_Row"> diff --git a/java/res/xml-xlarge/kbd_qwerty_row2.xml b/java/res/xml-xlarge/kbd_qwerty_row2.xml index 96077306fa79ca842ec04d66dafeb83f5361aee7..71aa916c7a4cd9f42faa38ffa59dc33069404e09 100644 --- a/java/res/xml-xlarge/kbd_qwerty_row2.xml +++ b/java/res/xml-xlarge/kbd_qwerty_row2.xml @@ -66,8 +66,9 @@ <default> <Key latin:keyLabel="\'" - latin:temporaryShiftKeyLabel=""" + latin:manualTemporaryUpperCaseCode="34" latin:keyHintIcon="@drawable/key_hint_quote_holo" + latin:manualTemporaryUpperCaseHintIcon="@drawable/key_hint_quote_large_holo" latin:popupKeyboard="@xml/kbd_popup_template" latin:popupCharacters=""" /> </default> diff --git a/java/res/xml-xlarge/kbd_qwerty_row3.xml b/java/res/xml-xlarge/kbd_qwerty_row3.xml index 77a4d4815caf474b7639e2bb963b3ef1e653031d..24d1b1db9ebb0a0e8198e476c4dca46dcebe7d2b 100644 --- a/java/res/xml-xlarge/kbd_qwerty_row3.xml +++ b/java/res/xml-xlarge/kbd_qwerty_row3.xml @@ -64,14 +64,16 @@ <default> <Key latin:keyLabel="," - latin:temporaryShiftKeyLabel="!" + latin:manualTemporaryUpperCaseCode="33" latin:keyHintIcon="@drawable/key_hint_exclamation_holo" + latin:manualTemporaryUpperCaseHintIcon="@drawable/key_hint_exclamation_large_holo" latin:popupKeyboard="@xml/kbd_popup_template" latin:popupCharacters="!" /> <Key latin:keyLabel="." - latin:temporaryShiftKeyLabel="\?" + latin:manualTemporaryUpperCaseCode="63" latin:keyHintIcon="@drawable/key_hint_question_holo" + latin:manualTemporaryUpperCaseHintIcon="@drawable/key_hint_question_large_holo" latin:popupKeyboard="@xml/kbd_popup_template" latin:popupCharacters="\?" /> </default> diff --git a/java/res/xml-xlarge/kbd_qwerty_row4.xml b/java/res/xml-xlarge/kbd_qwerty_row4.xml index 4aae16d6dec393245191acfeaca632071417c88d..63b5c2c6ad44a5f46ce3b9878ab5b14063ddc023 100644 --- a/java/res/xml-xlarge/kbd_qwerty_row4.xml +++ b/java/res/xml-xlarge/kbd_qwerty_row4.xml @@ -55,10 +55,11 @@ latin:popupKeyboard="@xml/popup_smileys" /> <Key latin:keyLabel="=" - latin:temporaryShiftKeyLabel="+" + latin:manualTemporaryUpperCaseCode="43" latin:keyHintIcon="@drawable/key_hint_plus_holo" + latin:manualTemporaryUpperCaseHintIcon="@drawable/key_hint_plus_large_holo" latin:popupKeyboard="@xml/kbd_popup_template" - latin:popupCharacters=">" /> + latin:popupCharacters="+" /> </default> </switch> <Key @@ -77,8 +78,9 @@ <default> <Key latin:keyLabel="-" - latin:temporaryShiftKeyLabel="/" + latin:manualTemporaryUpperCaseCode="47" latin:keyHintIcon="@drawable/key_hint_slash_holo" + latin:manualTemporaryUpperCaseHintIcon="@drawable/key_hint_slash_large_holo" latin:popupKeyboard="@xml/kbd_popup_template" latin:popupCharacters="/" /> </default> @@ -95,16 +97,18 @@ > <Key latin:keyLabel="_" - latin:temporaryShiftKeyLabel=":" + latin:manualTemporaryUpperCaseCode="58" latin:keyHintIcon="@drawable/key_hint_colon_holo" + latin:manualTemporaryUpperCaseHintIcon="@drawable/key_hint_colon_large_holo" latin:popupKeyboard="@xml/kbd_popup_template" latin:popupCharacters=":" /> </case> <default> <Key latin:keyLabel="_" - latin:temporaryShiftKeyLabel="\@" + latin:manualTemporaryUpperCaseCode="64" latin:keyHintIcon="@drawable/key_hint_at_holo" + latin:manualTemporaryUpperCaseHintIcon="@drawable/key_hint_at_large_holo" latin:popupKeyboard="@xml/kbd_popup_template" latin:popupCharacters="\@" /> </default> diff --git a/java/src/com/android/inputmethod/latin/BaseKeyboard.java b/java/src/com/android/inputmethod/latin/BaseKeyboard.java index be0a6a28a55aeeecf7ab94cae631fe4a4191555b..0f8b75d457ee55e53431b0710e064515b5333aa0 100644 --- a/java/src/com/android/inputmethod/latin/BaseKeyboard.java +++ b/java/src/com/android/inputmethod/latin/BaseKeyboard.java @@ -178,17 +178,23 @@ public class BaseKeyboard { * being the most important. */ public int[] codes; + /** The unicode that this key generates in manual temporary upper case mode. */ + public int manualTemporaryUpperCaseCode; /** Label to display */ public CharSequence label; - /** Label to display when keyboard is in temporary shift mode */ - public CharSequence temporaryShiftLabel; /** Icon to display instead of a label. Icon takes precedence over a label */ public Drawable icon; /** Hint icon to display on the key in conjunction with the label */ public Drawable hintIcon; /** Preview version of the icon, for the preview popup */ + /** + * The hint icon to display on the key when keyboard is in manual temporary upper case + * mode. + */ + public Drawable manualTemporaryUpperCaseHintIcon; + public Drawable iconPreview; /** Width of the key, not including the gap */ public int width; @@ -320,9 +326,13 @@ public class BaseKeyboard { setDefaultBounds(icon); hintIcon = a.getDrawable(R.styleable.BaseKeyboard_Key_keyHintIcon); setDefaultBounds(hintIcon); + manualTemporaryUpperCaseHintIcon = a.getDrawable( + R.styleable.BaseKeyboard_Key_manualTemporaryUpperCaseHintIcon); + setDefaultBounds(manualTemporaryUpperCaseHintIcon); label = a.getText(R.styleable.BaseKeyboard_Key_keyLabel); - temporaryShiftLabel = a.getText(R.styleable.BaseKeyboard_Key_temporaryShiftKeyLabel); + manualTemporaryUpperCaseCode = a.getInt( + R.styleable.BaseKeyboard_Key_manualTemporaryUpperCaseCode, 0); text = a.getText(R.styleable.BaseKeyboard_Key_keyOutputText); if (codes == null && !TextUtils.isEmpty(label)) { diff --git a/java/src/com/android/inputmethod/latin/BaseKeyboardView.java b/java/src/com/android/inputmethod/latin/BaseKeyboardView.java index a31785f5074ab9986a35e00af0761fd23a58d148..f2edd6b04a8509305bf7eedfa97dd34f4e6550ce 100644 --- a/java/src/com/android/inputmethod/latin/BaseKeyboardView.java +++ b/java/src/com/android/inputmethod/latin/BaseKeyboardView.java @@ -772,6 +772,8 @@ public class BaseKeyboardView extends View implements PointerTracker.UIProxy { final int kbdPaddingTop = getPaddingTop(); final Key[] keys = mKeys; final Key invalidKey = mInvalidatedKey; + final boolean isTemporaryUpperCase = (mKeyboard instanceof LatinKeyboard + && ((LatinKeyboard)mKeyboard).isTemporaryUpperCase()); paint.setColor(mKeyTextColor); boolean drawSingleKey = false; @@ -807,17 +809,6 @@ public class BaseKeyboardView extends View implements PointerTracker.UIProxy { boolean drawHintIcon = true; if (label != null) { - // If keyboard is multi-touch capable and in temporary upper case state and key has - // tempoarary shift label, label should be hint character and hint icon should not - // be drawn. - if (mHasDistinctMultitouch - && mKeyboard instanceof LatinKeyboard - && ((LatinKeyboard)mKeyboard).isTemporaryUpperCase() - && key.temporaryShiftLabel != null) { - label = key.temporaryShiftLabel.toString(); - drawHintIcon = false; - } - // For characters, use large font. For labels like "Done", use small font. final int labelSize; if (label.length() > 1 && key.codes.length < 2) { @@ -862,7 +853,10 @@ public class BaseKeyboardView extends View implements PointerTracker.UIProxy { int drawableHeight = key.height; int drawableX = 0; int drawableY = HINT_ICON_VERTICAL_ADJUSTMENT_PIXEL; - drawIcon(canvas, key.hintIcon, drawableX, drawableY, drawableWidth, drawableHeight); + Drawable icon = (isTemporaryUpperCase + && key.manualTemporaryUpperCaseHintIcon != null) + ? key.manualTemporaryUpperCaseHintIcon : key.hintIcon; + drawIcon(canvas, icon, drawableX, drawableY, drawableWidth, drawableHeight); } canvas.translate(-key.x - kbdPaddingLeft, -key.y - kbdPaddingTop); } diff --git a/java/src/com/android/inputmethod/latin/PointerTracker.java b/java/src/com/android/inputmethod/latin/PointerTracker.java index c88a58d70f5674adf914b4a71a84b10a066071f9..e76f8c7056b19fc032243bce66282f98c51eb325 100644 --- a/java/src/com/android/inputmethod/latin/PointerTracker.java +++ b/java/src/com/android/inputmethod/latin/PointerTracker.java @@ -419,12 +419,6 @@ public class PointerTracker { if (key.codes[0] == BaseKeyboard.KEYCODE_SHIFT) { mHandler.startLongPressShiftTimer(mLongPressShiftKeyTimeout, keyIndex, this); } else { - // If keyboard is in temporary upper case state and the key has temporary shift label, - // non-shift long press should not be started. On distinct multi touch device, when - // pressing shift key (in temporary upper case), hint icon should not be drawn on key - // top. So we should disable long press for such key. - if (isTemporaryUpperCase() && key.temporaryShiftLabel != null) - return; mHandler.startLongPressTimer(mLongPressKeyTimeout, keyIndex, this); } } @@ -462,10 +456,10 @@ public class PointerTracker { code = key.codes[mTapCount]; } - // If keyboard is in temporary upper case state and key has temporary shift label, - // alternate character code should be sent. - if (isTemporaryUpperCase() && key.temporaryShiftLabel != null) { - code = key.temporaryShiftLabel.charAt(0); + // If keyboard is in manual temporary upper case state and key has manual temporary + // shift code, alternate character code should be sent. + if (isTemporaryUpperCase() && key.manualTemporaryUpperCaseCode != 0) { + code = key.manualTemporaryUpperCaseCode; codes[0] = code; }