From 1cbfc6c968378f2e0a20b41677ec2a96bf69b621 Mon Sep 17 00:00:00 2001 From: Ken Wakasa <kwakasa@google.com> Date: Sat, 16 Oct 2010 02:15:04 +0900 Subject: [PATCH] DO NOT MERGE. Follow up change to I8b38e280 Add visual indicator that long press / or @ on F1 key will bring up Settings bug: 3084022 Change-Id: If925b546829ca8e8806e1f8f89eaf72fc8c220da --- java/res/xml-da/kbd_qwerty.xml | 8 +- java/res/xml-da/kbd_qwerty_black.xml | 8 +- java/res/xml-de/kbd_qwerty.xml | 8 +- java/res/xml-fr/kbd_qwerty.xml | 8 +- java/res/xml-fr/kbd_qwerty_black.xml | 8 +- java/res/xml-iw/kbd_qwerty.xml | 8 +- java/res/xml-iw/kbd_qwerty_black.xml | 8 +- java/res/xml-nb/kbd_qwerty.xml | 8 +- java/res/xml-nb/kbd_qwerty_black.xml | 8 +- java/res/xml-ru/kbd_qwerty.xml | 8 +- java/res/xml-ru/kbd_qwerty_black.xml | 8 +- java/res/xml-sr/kbd_qwerty.xml | 8 +- java/res/xml-sr/kbd_qwerty_black.xml | 8 +- java/res/xml-sv/kbd_qwerty.xml | 8 +- java/res/xml-sv/kbd_qwerty_black.xml | 8 +- java/res/xml/kbd_qwerty.xml | 8 +- java/res/xml/kbd_qwerty_black.xml | 8 +- java/res/xml/popup_at.xml | 39 +++++++++ java/res/xml/popup_slash.xml | 39 +++++++++ .../inputmethod/latin/LatinKeyboard.java | 79 ++++++++++++++----- .../latin/LatinKeyboardBaseView.java | 13 +-- 21 files changed, 214 insertions(+), 92 deletions(-) create mode 100644 java/res/xml/popup_at.xml create mode 100644 java/res/xml/popup_slash.xml diff --git a/java/res/xml-da/kbd_qwerty.xml b/java/res/xml-da/kbd_qwerty.xml index 6e2e692083..70eab096d8 100644 --- a/java/res/xml-da/kbd_qwerty.xml +++ b/java/res/xml-da/kbd_qwerty.xml @@ -209,7 +209,7 @@ android:isModifier="true" android:keyEdgeFlags="left" /> <Key - android:keyLabel="/" + android:codes="@integer/key_f1" android:isModifier="true" /> <Key android:codes="@integer/key_space" @@ -241,7 +241,7 @@ android:isModifier="true" android:keyEdgeFlags="left" /> <Key - android:keyLabel="\@" + android:codes="@integer/key_f1" android:isModifier="true" /> <Key android:codes="@integer/key_space" @@ -385,7 +385,7 @@ android:iconPreview="@drawable/sym_keyboard_feedback_settings" android:isModifier="true" /> <Key - android:keyLabel="/" + android:codes="@integer/key_f1" android:isModifier="true" /> <Key android:codes="@integer/key_space" @@ -422,7 +422,7 @@ android:iconPreview="@drawable/sym_keyboard_feedback_settings" android:isModifier="true" /> <Key - android:keyLabel="\@" + android:codes="@integer/key_f1" android:isModifier="true" /> <Key android:codes="@integer/key_space" diff --git a/java/res/xml-da/kbd_qwerty_black.xml b/java/res/xml-da/kbd_qwerty_black.xml index 36656ed24e..021f991c8a 100644 --- a/java/res/xml-da/kbd_qwerty_black.xml +++ b/java/res/xml-da/kbd_qwerty_black.xml @@ -202,7 +202,7 @@ android:keyWidth="20%p" android:keyEdgeFlags="left" /> <Key - android:keyLabel="/" /> + android:codes="@integer/key_f1" /> <Key android:codes="@integer/key_space" android:keyIcon="@drawable/sym_bkeyboard_space" @@ -229,7 +229,7 @@ android:keyWidth="20%p" android:keyEdgeFlags="left" /> <Key - android:keyLabel="\@" /> + android:codes="@integer/key_f1" /> <Key android:codes="@integer/key_space" android:keyIcon="@drawable/sym_bkeyboard_space" @@ -350,7 +350,7 @@ android:keyIcon="@drawable/sym_bkeyboard_settings" android:iconPreview="@drawable/sym_keyboard_feedback_settings" /> <Key - android:keyLabel="/" /> + android:codes="@integer/key_f1" /> <Key android:codes="@integer/key_space" android:keyIcon="@drawable/sym_bkeyboard_space" @@ -381,7 +381,7 @@ android:keyIcon="@drawable/sym_bkeyboard_settings" android:iconPreview="@drawable/sym_keyboard_feedback_settings" /> <Key - android:keyLabel="\@" /> + android:codes="@integer/key_f1" /> <Key android:codes="@integer/key_space" android:keyIcon="@drawable/sym_bkeyboard_space" diff --git a/java/res/xml-de/kbd_qwerty.xml b/java/res/xml-de/kbd_qwerty.xml index e74f137e5e..c28ec5e64b 100644 --- a/java/res/xml-de/kbd_qwerty.xml +++ b/java/res/xml-de/kbd_qwerty.xml @@ -188,7 +188,7 @@ android:isModifier="true" android:keyEdgeFlags="left" /> <Key - android:keyLabel="/" + android:codes="@integer/key_f1" android:isModifier="true" /> <Key android:codes="@integer/key_space" @@ -220,7 +220,7 @@ android:isModifier="true" android:keyEdgeFlags="left" /> <Key - android:keyLabel="\@" + android:codes="@integer/key_f1" android:isModifier="true" /> <Key android:codes="@integer/key_space" @@ -364,7 +364,7 @@ android:iconPreview="@drawable/sym_keyboard_feedback_settings" android:isModifier="true" /> <Key - android:keyLabel="/" + android:codes="@integer/key_f1" android:isModifier="true" /> <Key android:codes="@integer/key_space" @@ -401,7 +401,7 @@ android:iconPreview="@drawable/sym_keyboard_feedback_settings" android:isModifier="true" /> <Key - android:keyLabel="\@" + android:codes="@integer/key_f1" android:isModifier="true" /> <Key android:codes="@integer/key_space" diff --git a/java/res/xml-fr/kbd_qwerty.xml b/java/res/xml-fr/kbd_qwerty.xml index bded3e3b3f..aca06ea249 100644 --- a/java/res/xml-fr/kbd_qwerty.xml +++ b/java/res/xml-fr/kbd_qwerty.xml @@ -189,7 +189,7 @@ android:isModifier="true" android:keyEdgeFlags="left" /> <Key - android:keyLabel="/" + android:codes="@integer/key_f1" android:isModifier="true" /> <Key android:codes="@integer/key_space" @@ -221,7 +221,7 @@ android:isModifier="true" android:keyEdgeFlags="left" /> <Key - android:keyLabel="\@" + android:codes="@integer/key_f1" android:isModifier="true" /> <Key android:codes="@integer/key_space" @@ -365,7 +365,7 @@ android:iconPreview="@drawable/sym_keyboard_feedback_settings" android:isModifier="true" /> <Key - android:keyLabel="/" + android:codes="@integer/key_f1" android:isModifier="true" /> <Key android:codes="@integer/key_space" @@ -402,7 +402,7 @@ android:iconPreview="@drawable/sym_keyboard_feedback_settings" android:isModifier="true" /> <Key - android:keyLabel="\@" + android:codes="@integer/key_f1" android:isModifier="true" /> <Key android:codes="@integer/key_space" diff --git a/java/res/xml-fr/kbd_qwerty_black.xml b/java/res/xml-fr/kbd_qwerty_black.xml index 679d940f84..53eddaa40d 100644 --- a/java/res/xml-fr/kbd_qwerty_black.xml +++ b/java/res/xml-fr/kbd_qwerty_black.xml @@ -182,7 +182,7 @@ android:keyWidth="20%p" android:keyEdgeFlags="left" /> <Key - android:keyLabel="/" /> + android:codes="@integer/key_f1" /> <Key android:codes="@integer/key_space" android:keyIcon="@drawable/sym_bkeyboard_space" @@ -209,7 +209,7 @@ android:keyWidth="20%p" android:keyEdgeFlags="left" /> <Key - android:keyLabel="\@" /> + android:codes="@integer/key_f1" /> <Key android:codes="@integer/key_space" android:keyIcon="@drawable/sym_bkeyboard_space" @@ -330,7 +330,7 @@ android:keyIcon="@drawable/sym_bkeyboard_settings" android:iconPreview="@drawable/sym_keyboard_feedback_settings" /> <Key - android:keyLabel="/" /> + android:codes="@integer/key_f1" /> <Key android:codes="@integer/key_space" android:keyIcon="@drawable/sym_bkeyboard_space" @@ -361,7 +361,7 @@ android:keyIcon="@drawable/sym_bkeyboard_settings" android:iconPreview="@drawable/sym_keyboard_feedback_settings" /> <Key - android:keyLabel="\@" /> + android:codes="@integer/key_f1" /> <Key android:codes="@integer/key_space" android:keyIcon="@drawable/sym_bkeyboard_space" diff --git a/java/res/xml-iw/kbd_qwerty.xml b/java/res/xml-iw/kbd_qwerty.xml index 0ad2ca3c32..b652b82bdb 100644 --- a/java/res/xml-iw/kbd_qwerty.xml +++ b/java/res/xml-iw/kbd_qwerty.xml @@ -147,7 +147,7 @@ android:isModifier="true" android:keyEdgeFlags="left" /> <Key - android:keyLabel="/" + android:codes="@integer/key_f1" android:isModifier="true" /> <Key android:codes="@integer/key_space" @@ -179,7 +179,7 @@ android:isModifier="true" android:keyEdgeFlags="left" /> <Key - android:keyLabel="\@" + android:codes="@integer/key_f1" android:isModifier="true" /> <Key android:codes="@integer/key_space" @@ -323,7 +323,7 @@ android:iconPreview="@drawable/sym_keyboard_feedback_settings" android:isModifier="true" /> <Key - android:keyLabel="/" + android:codes="@integer/key_f1" android:isModifier="true" /> <Key android:codes="@integer/key_space" @@ -360,7 +360,7 @@ android:iconPreview="@drawable/sym_keyboard_feedback_settings" android:isModifier="true" /> <Key - android:keyLabel="\@" + android:codes="@integer/key_f1" android:isModifier="true" /> <Key android:codes="@integer/key_space" diff --git a/java/res/xml-iw/kbd_qwerty_black.xml b/java/res/xml-iw/kbd_qwerty_black.xml index 10ca0fc12f..f191133e0e 100644 --- a/java/res/xml-iw/kbd_qwerty_black.xml +++ b/java/res/xml-iw/kbd_qwerty_black.xml @@ -140,7 +140,7 @@ android:keyWidth="20%p" android:keyEdgeFlags="left" /> <Key - android:keyLabel="/" /> + android:codes="@integer/key_f1" /> <Key android:codes="@integer/key_space" android:keyIcon="@drawable/sym_bkeyboard_space" @@ -167,7 +167,7 @@ android:keyWidth="20%p" android:keyEdgeFlags="left" /> <Key - android:keyLabel="\@" /> + android:codes="@integer/key_f1" /> <Key android:codes="@integer/key_space" android:keyIcon="@drawable/sym_bkeyboard_space" @@ -288,7 +288,7 @@ android:keyIcon="@drawable/sym_bkeyboard_settings" android:iconPreview="@drawable/sym_keyboard_feedback_settings" /> <Key - android:keyLabel="/" /> + android:codes="@integer/key_f1" /> <Key android:codes="@integer/key_space" android:keyIcon="@drawable/sym_bkeyboard_space" @@ -319,7 +319,7 @@ android:keyIcon="@drawable/sym_bkeyboard_settings" android:iconPreview="@drawable/sym_keyboard_feedback_settings" /> <Key - android:keyLabel="\@" /> + android:codes="@integer/key_f1" /> <Key android:codes="@integer/key_space" android:keyIcon="@drawable/sym_bkeyboard_space" diff --git a/java/res/xml-nb/kbd_qwerty.xml b/java/res/xml-nb/kbd_qwerty.xml index 8377bbf3f2..632ee6d15a 100644 --- a/java/res/xml-nb/kbd_qwerty.xml +++ b/java/res/xml-nb/kbd_qwerty.xml @@ -209,7 +209,7 @@ android:isModifier="true" android:keyEdgeFlags="left" /> <Key - android:keyLabel="/" + android:codes="@integer/key_f1" android:isModifier="true" /> <Key android:codes="@integer/key_space" @@ -241,7 +241,7 @@ android:isModifier="true" android:keyEdgeFlags="left" /> <Key - android:keyLabel="\@" + android:codes="@integer/key_f1" android:isModifier="true" /> <Key android:codes="@integer/key_space" @@ -385,7 +385,7 @@ android:iconPreview="@drawable/sym_keyboard_feedback_settings" android:isModifier="true" /> <Key - android:keyLabel="/" + android:codes="@integer/key_f1" android:isModifier="true" /> <Key android:codes="@integer/key_space" @@ -422,7 +422,7 @@ android:iconPreview="@drawable/sym_keyboard_feedback_settings" android:isModifier="true" /> <Key - android:keyLabel="\@" + android:codes="@integer/key_f1" android:isModifier="true" /> <Key android:codes="@integer/key_space" diff --git a/java/res/xml-nb/kbd_qwerty_black.xml b/java/res/xml-nb/kbd_qwerty_black.xml index ab14984884..67d87500d8 100644 --- a/java/res/xml-nb/kbd_qwerty_black.xml +++ b/java/res/xml-nb/kbd_qwerty_black.xml @@ -202,7 +202,7 @@ android:keyWidth="20%p" android:keyEdgeFlags="left" /> <Key - android:keyLabel="/" /> + android:codes="@integer/key_f1" /> <Key android:codes="@integer/key_space" android:keyIcon="@drawable/sym_bkeyboard_space" @@ -229,7 +229,7 @@ android:keyWidth="20%p" android:keyEdgeFlags="left" /> <Key - android:keyLabel="\@" /> + android:codes="@integer/key_f1" /> <Key android:codes="@integer/key_space" android:keyIcon="@drawable/sym_bkeyboard_space" @@ -350,7 +350,7 @@ android:keyIcon="@drawable/sym_bkeyboard_settings" android:iconPreview="@drawable/sym_keyboard_feedback_settings" /> <Key - android:keyLabel="/" /> + android:codes="@integer/key_f1" /> <Key android:codes="@integer/key_space" android:keyIcon="@drawable/sym_bkeyboard_space" @@ -381,7 +381,7 @@ android:keyIcon="@drawable/sym_bkeyboard_settings" android:iconPreview="@drawable/sym_keyboard_feedback_settings" /> <Key - android:keyLabel="\@" /> + android:codes="@integer/key_f1" /> <Key android:codes="@integer/key_space" android:keyIcon="@drawable/sym_bkeyboard_space" diff --git a/java/res/xml-ru/kbd_qwerty.xml b/java/res/xml-ru/kbd_qwerty.xml index d40ccef10a..ed44e769b8 100644 --- a/java/res/xml-ru/kbd_qwerty.xml +++ b/java/res/xml-ru/kbd_qwerty.xml @@ -187,7 +187,7 @@ android:isModifier="true" android:keyEdgeFlags="left" /> <Key - android:keyLabel="/" + android:codes="@integer/key_f1" android:isModifier="true" /> <Key android:codes="@integer/key_space" @@ -219,7 +219,7 @@ android:isModifier="true" android:keyEdgeFlags="left" /> <Key - android:keyLabel="\@" + android:codes="@integer/key_f1" android:isModifier="true" /> <Key android:codes="@integer/key_space" @@ -363,7 +363,7 @@ android:iconPreview="@drawable/sym_keyboard_feedback_settings" android:isModifier="true" /> <Key - android:keyLabel="/" + android:codes="@integer/key_f1" android:isModifier="true" /> <Key android:codes="@integer/key_space" @@ -400,7 +400,7 @@ android:iconPreview="@drawable/sym_keyboard_feedback_settings" android:isModifier="true" /> <Key - android:keyLabel="\@" + android:codes="@integer/key_f1" android:isModifier="true" /> <Key android:codes="@integer/key_space" diff --git a/java/res/xml-ru/kbd_qwerty_black.xml b/java/res/xml-ru/kbd_qwerty_black.xml index cc71b0812d..62ce7d692d 100644 --- a/java/res/xml-ru/kbd_qwerty_black.xml +++ b/java/res/xml-ru/kbd_qwerty_black.xml @@ -180,7 +180,7 @@ android:keyWidth="20%p" android:keyEdgeFlags="left" /> <Key - android:keyLabel="/" /> + android:codes="@integer/key_f1" /> <Key android:codes="@integer/key_space" android:keyIcon="@drawable/sym_bkeyboard_space" @@ -207,7 +207,7 @@ android:keyWidth="20%p" android:keyEdgeFlags="left" /> <Key - android:keyLabel="\@" /> + android:codes="@integer/key_f1" /> <Key android:codes="@integer/key_space" android:keyIcon="@drawable/sym_bkeyboard_space" @@ -328,7 +328,7 @@ android:keyIcon="@drawable/sym_bkeyboard_settings" android:iconPreview="@drawable/sym_keyboard_feedback_settings" /> <Key - android:keyLabel="/" /> + android:codes="@integer/key_f1" /> <Key android:codes="@integer/key_space" android:keyIcon="@drawable/sym_bkeyboard_space" @@ -359,7 +359,7 @@ android:keyIcon="@drawable/sym_bkeyboard_settings" android:iconPreview="@drawable/sym_keyboard_feedback_settings" /> <Key - android:keyLabel="\@" /> + android:codes="@integer/key_f1" /> <Key android:codes="@integer/key_space" android:keyIcon="@drawable/sym_bkeyboard_space" diff --git a/java/res/xml-sr/kbd_qwerty.xml b/java/res/xml-sr/kbd_qwerty.xml index 835f8c166c..e3279dc5d9 100644 --- a/java/res/xml-sr/kbd_qwerty.xml +++ b/java/res/xml-sr/kbd_qwerty.xml @@ -180,7 +180,7 @@ android:isModifier="true" android:keyEdgeFlags="left" /> <Key - android:keyLabel="/" + android:codes="@integer/key_f1" android:isModifier="true" /> <Key android:codes="@integer/key_space" @@ -212,7 +212,7 @@ android:isModifier="true" android:keyEdgeFlags="left" /> <Key - android:keyLabel="\@" + android:codes="@integer/key_f1" android:isModifier="true" /> <Key android:codes="@integer/key_space" @@ -356,7 +356,7 @@ android:iconPreview="@drawable/sym_keyboard_feedback_settings" android:isModifier="true" /> <Key - android:keyLabel="/" + android:codes="@integer/key_f1" android:isModifier="true" /> <Key android:codes="@integer/key_space" @@ -393,7 +393,7 @@ android:iconPreview="@drawable/sym_keyboard_feedback_settings" android:isModifier="true" /> <Key - android:keyLabel="\@" + android:codes="@integer/key_f1" android:isModifier="true" /> <Key android:codes="@integer/key_space" diff --git a/java/res/xml-sr/kbd_qwerty_black.xml b/java/res/xml-sr/kbd_qwerty_black.xml index 76a9e55c10..b485360b04 100644 --- a/java/res/xml-sr/kbd_qwerty_black.xml +++ b/java/res/xml-sr/kbd_qwerty_black.xml @@ -173,7 +173,7 @@ android:keyWidth="20%p" android:keyEdgeFlags="left" /> <Key - android:keyLabel="/" /> + android:codes="@integer/key_f1" /> <Key android:codes="@integer/key_space" android:keyIcon="@drawable/sym_bkeyboard_space" @@ -200,7 +200,7 @@ android:keyWidth="20%p" android:keyEdgeFlags="left" /> <Key - android:keyLabel="\@" /> + android:codes="@integer/key_f1" /> <Key android:codes="@integer/key_space" android:keyIcon="@drawable/sym_bkeyboard_space" @@ -321,7 +321,7 @@ android:keyIcon="@drawable/sym_bkeyboard_settings" android:iconPreview="@drawable/sym_keyboard_feedback_settings" /> <Key - android:keyLabel="/" /> + android:codes="@integer/key_f1" /> <Key android:codes="@integer/key_space" android:keyIcon="@drawable/sym_bkeyboard_space" @@ -352,7 +352,7 @@ android:keyIcon="@drawable/sym_bkeyboard_settings" android:iconPreview="@drawable/sym_keyboard_feedback_settings" /> <Key - android:keyLabel="\@" /> + android:codes="@integer/key_f1" /> <Key android:codes="@integer/key_space" android:keyIcon="@drawable/sym_bkeyboard_space" diff --git a/java/res/xml-sv/kbd_qwerty.xml b/java/res/xml-sv/kbd_qwerty.xml index f88bd3c390..f8a7e94758 100644 --- a/java/res/xml-sv/kbd_qwerty.xml +++ b/java/res/xml-sv/kbd_qwerty.xml @@ -210,7 +210,7 @@ android:isModifier="true" android:keyEdgeFlags="left" /> <Key - android:keyLabel="/" + android:codes="@integer/key_f1" android:isModifier="true" /> <Key android:codes="@integer/key_space" @@ -242,7 +242,7 @@ android:isModifier="true" android:keyEdgeFlags="left" /> <Key - android:keyLabel="\@" + android:codes="@integer/key_f1" android:isModifier="true" /> <Key android:codes="@integer/key_space" @@ -386,7 +386,7 @@ android:iconPreview="@drawable/sym_keyboard_feedback_settings" android:isModifier="true" /> <Key - android:keyLabel="/" + android:codes="@integer/key_f1" android:isModifier="true" /> <Key android:codes="@integer/key_space" @@ -423,7 +423,7 @@ android:iconPreview="@drawable/sym_keyboard_feedback_settings" android:isModifier="true" /> <Key - android:keyLabel="\@" + android:codes="@integer/key_f1" android:isModifier="true" /> <Key android:codes="@integer/key_space" diff --git a/java/res/xml-sv/kbd_qwerty_black.xml b/java/res/xml-sv/kbd_qwerty_black.xml index 8493237b24..0141c2b05a 100644 --- a/java/res/xml-sv/kbd_qwerty_black.xml +++ b/java/res/xml-sv/kbd_qwerty_black.xml @@ -204,7 +204,7 @@ android:keyWidth="20%p" android:keyEdgeFlags="left" /> <Key - android:keyLabel="/" /> + android:codes="@integer/key_f1" /> <Key android:codes="@integer/key_space" android:keyIcon="@drawable/sym_bkeyboard_space" @@ -231,7 +231,7 @@ android:keyWidth="20%p" android:keyEdgeFlags="left" /> <Key - android:keyLabel="\@" /> + android:codes="@integer/key_f1" /> <Key android:codes="@integer/key_space" android:keyIcon="@drawable/sym_bkeyboard_space" @@ -352,7 +352,7 @@ android:keyIcon="@drawable/sym_bkeyboard_settings" android:iconPreview="@drawable/sym_keyboard_feedback_settings" /> <Key - android:keyLabel="/" /> + android:codes="@integer/key_f1" /> <Key android:codes="@integer/key_space" android:keyIcon="@drawable/sym_bkeyboard_space" @@ -383,7 +383,7 @@ android:keyIcon="@drawable/sym_bkeyboard_settings" android:iconPreview="@drawable/sym_keyboard_feedback_settings" /> <Key - android:keyLabel="\@" /> + android:codes="@integer/key_f1" /> <Key android:codes="@integer/key_space" android:keyIcon="@drawable/sym_bkeyboard_space" diff --git a/java/res/xml/kbd_qwerty.xml b/java/res/xml/kbd_qwerty.xml index a2c9b2b8ea..d5090b3c7d 100644 --- a/java/res/xml/kbd_qwerty.xml +++ b/java/res/xml/kbd_qwerty.xml @@ -186,7 +186,7 @@ android:isModifier="true" android:keyEdgeFlags="left" /> <Key - android:keyLabel="/" + android:codes="@integer/key_f1" android:isModifier="true" /> <Key android:codes="@integer/key_space" @@ -217,7 +217,7 @@ android:isModifier="true" android:keyEdgeFlags="left" /> <Key - android:keyLabel="\@" + android:codes="@integer/key_f1" android:isModifier="true" /> <Key android:codes="@integer/key_space" @@ -357,7 +357,7 @@ android:iconPreview="@drawable/sym_keyboard_feedback_settings" android:isModifier="true" /> <Key - android:keyLabel="/" + android:codes="@integer/key_f1" android:isModifier="true" /> <Key android:codes="@integer/key_space" @@ -393,7 +393,7 @@ android:iconPreview="@drawable/sym_keyboard_feedback_settings" android:isModifier="true" /> <Key - android:keyLabel="\@" + android:codes="@integer/key_f1" android:isModifier="true" /> <Key android:codes="@integer/key_space" diff --git a/java/res/xml/kbd_qwerty_black.xml b/java/res/xml/kbd_qwerty_black.xml index d9943a93fb..c5de4d4621 100644 --- a/java/res/xml/kbd_qwerty_black.xml +++ b/java/res/xml/kbd_qwerty_black.xml @@ -179,7 +179,7 @@ android:keyWidth="20%p" android:keyEdgeFlags="left" /> <Key - android:keyLabel="/" /> + android:codes="@integer/key_f1" /> <Key android:codes="@integer/key_space" android:keyIcon="@drawable/sym_bkeyboard_space" @@ -205,7 +205,7 @@ android:keyWidth="20%p" android:keyEdgeFlags="left" /> <Key - android:keyLabel="\@" /> + android:codes="@integer/key_f1" /> <Key android:codes="@integer/key_space" android:keyIcon="@drawable/sym_bkeyboard_space" @@ -322,7 +322,7 @@ android:keyIcon="@drawable/sym_bkeyboard_settings" android:iconPreview="@drawable/sym_keyboard_feedback_settings" /> <Key - android:keyLabel="/" /> + android:codes="@integer/key_f1" /> <Key android:codes="@integer/key_space" android:keyIcon="@drawable/sym_bkeyboard_space" @@ -352,7 +352,7 @@ android:keyIcon="@drawable/sym_bkeyboard_settings" android:iconPreview="@drawable/sym_keyboard_feedback_settings" /> <Key - android:keyLabel="\@" /> + android:codes="@integer/key_f1" /> <Key android:codes="@integer/key_space" android:keyIcon="@drawable/sym_bkeyboard_space" diff --git a/java/res/xml/popup_at.xml b/java/res/xml/popup_at.xml new file mode 100644 index 0000000000..197eea4450 --- /dev/null +++ b/java/res/xml/popup_at.xml @@ -0,0 +1,39 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 2010, The Android Open Source Project +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ +--> + +<Keyboard + xmlns:android="http://schemas.android.com/apk/res/android" + android:keyWidth="10%p" + android:horizontalGap="0px" + android:verticalGap="0px" + android:keyHeight="@dimen/popup_key_height" +> + <Row + android:rowEdgeFlags="top|bottom" + > + <Key + android:codes="@integer/key_settings" + android:keyIcon="@drawable/sym_keyboard_settings" + android:keyEdgeFlags="left" /> + <Key + android:keyLabel="\@" + android:keyEdgeFlags="right" /> + </Row> +</Keyboard> diff --git a/java/res/xml/popup_slash.xml b/java/res/xml/popup_slash.xml new file mode 100644 index 0000000000..a38fde0e47 --- /dev/null +++ b/java/res/xml/popup_slash.xml @@ -0,0 +1,39 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 2010, The Android Open Source Project +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ +--> + +<Keyboard + xmlns:android="http://schemas.android.com/apk/res/android" + android:keyWidth="10%p" + android:horizontalGap="0px" + android:verticalGap="0px" + android:keyHeight="@dimen/popup_key_height" +> + <Row + android:rowEdgeFlags="top|bottom" + > + <Key + android:codes="@integer/key_settings" + android:keyIcon="@drawable/sym_keyboard_settings" + android:keyEdgeFlags="left" /> + <Key + android:keyLabel="/" + android:keyEdgeFlags="right" /> + </Row> +</Keyboard> diff --git a/java/src/com/android/inputmethod/latin/LatinKeyboard.java b/java/src/com/android/inputmethod/latin/LatinKeyboard.java index e33ae145be..8060ac9966 100644 --- a/java/src/com/android/inputmethod/latin/LatinKeyboard.java +++ b/java/src/com/android/inputmethod/latin/LatinKeyboard.java @@ -74,6 +74,7 @@ public class LatinKeyboard extends Keyboard { private LanguageSwitcher mLanguageSwitcher; private final Resources mRes; private final Context mContext; + private int mMode; // Whether this keyboard has voice icon on it private boolean mHasVoiceButton; // Whether voice icon is enabled at all @@ -122,6 +123,7 @@ public class LatinKeyboard extends Keyboard { super(context, xmlLayoutResId, mode); final Resources res = context.getResources(); mContext = context; + mMode = mode; mRes = res; mShiftLockIcon = res.getDrawable(R.drawable.sym_keyboard_shift_locked); mShiftLockPreviewIcon = res.getDrawable(R.drawable.sym_keyboard_feedback_shift_locked); @@ -202,6 +204,7 @@ public class LatinKeyboard extends Keyboard { } void setImeOptions(Resources res, int mode, int options) { + mMode = mode; // TODO should clean up this method if (mEnterKey != null) { // Reset some of the rarely used attributes. @@ -354,6 +357,11 @@ public class LatinKeyboard extends Keyboard { } private void updateDynamicKeys() { + update123Key(); + updateF1Key(); + } + + private void update123Key() { // Update KEYCODE_MODE_CHANGE key only on alphabet mode, not on symbol mode. if (m123Key != null && mIsAlphaKeyboard) { if (mVoiceEnabled && !mHasVoiceButton) { @@ -366,30 +374,65 @@ public class LatinKeyboard extends Keyboard { m123Key.label = m123Label; } } + } + + private void updateF1Key() { + // Update KEYCODE_F1 key. Please note that some keyboard layouts have no F1 key. + if (mF1Key == null) + return; - // Update KEYCODE_F1 key. Please note that some keyboard layout has no F1 key. - if (mF1Key != null) { - if (mHasVoiceButton && mVoiceEnabled) { - mF1Key.codes = new int[] { LatinKeyboardView.KEYCODE_VOICE }; - mF1Key.label = null; - // HACK: draw mMicIcon and mF1HintIcon at the same time - mF1Key.icon = new BitmapDrawable(mRes, drawSynthesizedSettingsHintImage( - mF1Key.width, mF1Key.height + mVerticalGap, mMicIcon, mF1HintIcon)); - mF1Key.iconPreview = mMicPreviewIcon; - mF1Key.popupResId = R.xml.popup_mic; + if (mIsAlphaKeyboard) { + if (mMode == KeyboardSwitcher.MODE_URL) { + setNonMicF1Key(mF1Key, "/", R.xml.popup_slash); + } else if (mMode == KeyboardSwitcher.MODE_EMAIL) { + setNonMicF1Key(mF1Key, "@", R.xml.popup_at); + } else { + if (mVoiceEnabled && mHasVoiceButton) { + setMicF1Key(mF1Key); + } else { + setNonMicF1Key(mF1Key, ",", R.xml.popup_comma); + } + } + } else { // Symbols keyboard + if (mVoiceEnabled && mHasVoiceButton) { + setMicF1Key(mF1Key); } else { - mF1Key.label = ","; - mF1Key.codes = new int[] { ',' }; - // HACK: draw only mF1HintIcon on offscreen buffer to adjust position of '...' to - // the above synthesized icon - mF1Key.icon = new BitmapDrawable(mRes, drawSynthesizedSettingsHintImage( - mF1Key.width, mF1Key.height + mVerticalGap, null, mF1HintIcon)); - mF1Key.iconPreview = null; - mF1Key.popupResId = R.xml.popup_comma; + setNonMicF1Key(mF1Key, ",", R.xml.popup_comma); } } } + private void setMicF1Key(Key key) { + // HACK: draw mMicIcon and mF1HintIcon at the same time + final Drawable micWithSettingsHintDrawable = new BitmapDrawable(mRes, + drawSynthesizedSettingsHintImage(key.width, key.height + mVerticalGap, + mMicIcon, mF1HintIcon)); + + key.label = null; + key.codes = new int[] { LatinKeyboardView.KEYCODE_VOICE }; + key.popupResId = R.xml.popup_mic; + key.icon = micWithSettingsHintDrawable; + key.iconPreview = mMicPreviewIcon; + } + + private void setNonMicF1Key(Key key, String label, int popupResId) { + // HACK: draw only mF1HintIcon on offscreen buffer to adjust position of '...' to + // the mic+hint synthesized icon + final Drawable onlySettingsHintDrawable = new BitmapDrawable(mRes, + drawSynthesizedSettingsHintImage(key.width, key.height + mVerticalGap, + null, mF1HintIcon)); + + key.label = label; + key.codes = new int[] { label.charAt(0) }; + key.popupResId = popupResId; + key.icon = onlySettingsHintDrawable; + key.iconPreview = null; + } + + public boolean isF1Key(Key key) { + return key == mF1Key; + } + /** * @return a key which should be invalidated. */ diff --git a/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java b/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java index c1b1008b02..832c768805 100644 --- a/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java +++ b/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java @@ -850,7 +850,7 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx // Usually don't draw icon if label is not null, but we draw icon for the number // hint. - shouldDrawIcon = isCommaKeyLabelOrNumberAtEdgeOfPopupChars(key); + shouldDrawIcon = isNonMicLatinF1KeyOrNumberAtEdgeOfPopupChars(key); } if (key.icon != null && shouldDrawIcon) { // Special handing for the upper-right number hint icons @@ -943,7 +943,7 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx if (key == null) return; // Should not draw number hint icons - if (key.icon != null && !isCommaKeyLabelOrNumberAtEdgeOfPopupChars(key)) { + if (key.icon != null && !isNonMicLatinF1KeyOrNumberAtEdgeOfPopupChars(key)) { mPreviewText.setCompoundDrawables(null, null, null, key.iconPreview != null ? key.iconPreview : key.icon); mPreviewText.setText(null); @@ -1226,12 +1226,13 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx return false; } - private static boolean isCommaKeyLabelOrNumberAtEdgeOfPopupChars(Key key) { - return isNumberAtEdgeOfPopupChars(key) || isCommaKeyLabel(key); + private boolean isNonMicLatinF1KeyOrNumberAtEdgeOfPopupChars(Key key) { + return isNumberAtEdgeOfPopupChars(key) || isNonMicLatinF1Key(key); } - private static boolean isCommaKeyLabel(Key key) { - return ",".equals(key.label); + private boolean isNonMicLatinF1Key(Key key) { + return (mKeyboard instanceof LatinKeyboard) + && ((LatinKeyboard)mKeyboard).isF1Key(key) && key.label != null; } private static boolean isNumberAtEdgeOfPopupChars(Key key) { -- GitLab