diff --git a/java/res/drawable-hdpi/hint_popup.9.png b/java/res/drawable-hdpi/hint_popup.9.png
new file mode 100644
index 0000000000000000000000000000000000000000..b5ec003e655b5cd6de5ca98e10bbf849aed0fe37
Binary files /dev/null and b/java/res/drawable-hdpi/hint_popup.9.png differ
diff --git a/java/res/drawable-mdpi/hint_popup.9.png b/java/res/drawable-mdpi/hint_popup.9.png
new file mode 100644
index 0000000000000000000000000000000000000000..444cc26ee69c1e754a95d8c977e7169fab1e9321
Binary files /dev/null and b/java/res/drawable-mdpi/hint_popup.9.png differ
diff --git a/java/res/xml/kbd_popup_narrow_template.xml b/java/res/xml/kbd_popup_narrow_template.xml
index 23c686e8bc4670c60ed48cc40a0eca549fc32f08..9b78711a026f72f99c36718430d88f02113ab140 100644
--- a/java/res/xml/kbd_popup_narrow_template.xml
+++ b/java/res/xml/kbd_popup_narrow_template.xml
@@ -18,10 +18,10 @@
 */
 -->
 
-<Keyboard xmlns:android="http://schemas.android.com/apk/res/android"
-    android:keyWidth="9.45%p"
-    android:horizontalGap="0px"
-    android:verticalGap="0px"
-    android:keyHeight="@dimen/popup_key_height"
+<Keyboard xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
+    latin:keyWidth="9.45%p"
+    latin:horizontalGap="0px"
+    latin:verticalGap="0px"
+    latin:keyHeight="@dimen/popup_key_height"
     >
 </Keyboard>
diff --git a/java/res/xml/kbd_qwerty_black_row4.xml b/java/res/xml/kbd_qwerty_black_row4.xml
index 1718603fdd80829b81329759dd9fc7bb714cc63a..330ddda42056db1443bdca47a87b5329ec6d7c14 100644
--- a/java/res/xml/kbd_qwerty_black_row4.xml
+++ b/java/res/xml/kbd_qwerty_black_row4.xml
@@ -40,6 +40,7 @@
             latin:keyWidth="40%p" />
         <Key
             latin:keyLabel="."
+            latin:keyHintIcon="@drawable/hint_popup"
             latin:popupKeyboard="@xml/popup_punctuation" />
         <Key
             latin:codes="@integer/key_return"
@@ -59,7 +60,7 @@
             latin:keyWidth="20%p"
             latin:keyEdgeFlags="left" />
         <Key
-            latin:keyLabel="/" />
+            latin:codes="@integer/key_f1" />
         <Key
             latin:codes="@integer/key_space"
             latin:keyIcon="@drawable/sym_bkeyboard_space"
@@ -67,6 +68,7 @@
             latin:keyWidth="40%p" />
         <Key
             latin:keyLabel="."
+            latin:keyHintIcon="@drawable/hint_popup"
             latin:popupKeyboard="@xml/popup_punctuation" />
         <Key
             latin:codes="@integer/key_return"
@@ -86,7 +88,7 @@
             latin:keyWidth="20%p"
             latin:keyEdgeFlags="left" />
         <Key
-            latin:keyLabel="\@" />
+            latin:codes="@integer/key_f1" />
         <Key
             latin:codes="@integer/key_space"
             latin:keyIcon="@drawable/sym_bkeyboard_space"
@@ -94,6 +96,7 @@
             latin:keyWidth="40%p" />
         <Key
             latin:keyLabel="."
+            latin:keyHintIcon="@drawable/hint_popup"
             latin:popupKeyboard="@xml/popup_punctuation" />
         <Key
             latin:codes="@integer/key_return"
@@ -121,10 +124,12 @@
             latin:keyWidth="40%p" />
         <Key
             latin:keyLabel="."
+            latin:keyHintIcon="@drawable/hint_popup"
             latin:popupKeyboard="@xml/popup_punctuation" />
         <Key
             latin:keyLabel=":-)"
             latin:keyOutputText=":-) "
+            latin:keyHintIcon="@drawable/hint_popup"
             latin:popupKeyboard="@xml/popup_smileys"
             latin:keyWidth="20%p"
             latin:keyEdgeFlags="right" />
@@ -153,6 +158,7 @@
             latin:keyWidth="20%p" />
         <Key
             latin:keyLabel="."
+            latin:keyHintIcon="@drawable/hint_popup"
             latin:popupKeyboard="@xml/popup_punctuation" />
         <Key
             latin:codes="@integer/key_return"
@@ -184,6 +190,7 @@
             latin:keyWidth="30%p" />
         <Key
             latin:keyLabel="."
+            latin:keyHintIcon="@drawable/hint_popup"
             latin:popupKeyboard="@xml/popup_punctuation" />
         <Key
             latin:codes="@integer/key_return"
@@ -207,7 +214,7 @@
             latin:keyIcon="@drawable/sym_bkeyboard_settings"
             latin:iconPreview="@drawable/sym_keyboard_feedback_settings" />
         <Key
-            latin:keyLabel="/" />
+            latin:codes="@integer/key_f1" />
         <Key
             latin:codes="@integer/key_space"
             latin:keyIcon="@drawable/sym_bkeyboard_space"
@@ -215,6 +222,7 @@
             latin:keyWidth="30%p" />
         <Key
             latin:keyLabel="."
+            latin:keyHintIcon="@drawable/hint_popup"
             latin:popupKeyboard="@xml/popup_punctuation" />
         <Key
             latin:codes="@integer/key_return"
@@ -238,7 +246,7 @@
             latin:keyIcon="@drawable/sym_bkeyboard_settings"
             latin:iconPreview="@drawable/sym_keyboard_feedback_settings" />
         <Key
-            latin:keyLabel="\@" />
+            latin:codes="@integer/key_f1" />
         <Key
             latin:codes="@integer/key_space"
             latin:keyIcon="@drawable/sym_bkeyboard_space"
@@ -246,6 +254,7 @@
             latin:keyWidth="30%p" />
         <Key
             latin:keyLabel="."
+            latin:keyHintIcon="@drawable/hint_popup"
             latin:popupKeyboard="@xml/popup_punctuation" />
         <Key
             latin:codes="@integer/key_return"
@@ -277,10 +286,12 @@
             latin:keyWidth="30%p" />
         <Key
             latin:keyLabel="."
+            latin:keyHintIcon="@drawable/hint_popup"
             latin:popupKeyboard="@xml/popup_punctuation" />
         <Key
             latin:keyLabel=":-)"
             latin:keyOutputText=":-) "
+            latin:keyHintIcon="@drawable/hint_popup"
             latin:popupKeyboard="@xml/popup_smileys"
             latin:keyWidth="25%p"
             latin:keyEdgeFlags="right" />
@@ -312,6 +323,7 @@
             latin:iconPreview="@drawable/sym_keyboard_feedback_tab" />
         <Key
             latin:keyLabel="."
+            latin:keyHintIcon="@drawable/hint_popup"
             latin:popupKeyboard="@xml/popup_punctuation" />
         <Key
             latin:codes="@integer/key_return"
diff --git a/java/res/xml/kbd_qwerty_row4.xml b/java/res/xml/kbd_qwerty_row4.xml
index 124008f7fad0afbbe3e66b27eef92acf876de2b4..17b7c523519faf841d0b57db7bc5e93b10151576 100644
--- a/java/res/xml/kbd_qwerty_row4.xml
+++ b/java/res/xml/kbd_qwerty_row4.xml
@@ -43,6 +43,7 @@
             latin:isModifier="true" />
         <Key
             latin:keyLabel="."
+            latin:keyHintIcon="@drawable/hint_popup"
             latin:popupKeyboard="@xml/popup_punctuation"
             latin:isModifier="true" />
         <Key
@@ -65,7 +66,7 @@
             latin:isModifier="true"
             latin:keyEdgeFlags="left" />
         <Key
-            latin:keyLabel="/"
+            latin:codes="@integer/key_f1"
             latin:isModifier="true" />
         <Key
             latin:codes="@integer/key_space"
@@ -75,6 +76,7 @@
             latin:isModifier="true" />
         <Key
             latin:keyLabel="."
+            latin:keyHintIcon="@drawable/hint_popup"
             latin:popupKeyboard="@xml/popup_punctuation"
             latin:isModifier="true" />
         <Key
@@ -97,7 +99,7 @@
             latin:isModifier="true"
             latin:keyEdgeFlags="left" />
         <Key
-            latin:keyLabel="\@"
+            latin:codes="@integer/key_f1"
             latin:isModifier="true" />
         <Key
             latin:codes="@integer/key_space"
@@ -107,6 +109,7 @@
             latin:isModifier="true" />
         <Key
             latin:keyLabel="."
+            latin:keyHintIcon="@drawable/hint_popup"
             latin:popupKeyboard="@xml/popup_punctuation"
             latin:isModifier="true" />
         <Key
@@ -139,11 +142,13 @@
             latin:isModifier="true" />
         <Key
             latin:keyLabel="."
+            latin:keyHintIcon="@drawable/hint_popup"
             latin:popupKeyboard="@xml/popup_punctuation"
             latin:isModifier="true" />
         <Key
             latin:keyLabel=":-)"
             latin:keyOutputText=":-) "
+            latin:keyHintIcon="@drawable/hint_popup"
             latin:popupKeyboard="@xml/popup_smileys"
             latin:keyWidth="20%p"
             latin:isModifier="true"
@@ -177,6 +182,7 @@
             latin:isModifier="true" />
         <Key
             latin:keyLabel="."
+            latin:keyHintIcon="@drawable/hint_popup"
             latin:popupKeyboard="@xml/popup_punctuation"
             latin:isModifier="true" />
         <Key
@@ -214,6 +220,7 @@
             latin:isModifier="true" />
         <Key
             latin:keyLabel="."
+            latin:keyHintIcon="@drawable/hint_popup"
             latin:popupKeyboard="@xml/popup_punctuation"
             latin:isModifier="true" />
         <Key
@@ -241,7 +248,7 @@
             latin:iconPreview="@drawable/sym_keyboard_feedback_settings"
             latin:isModifier="true" />
         <Key
-            latin:keyLabel="/"
+            latin:codes="@integer/key_f1"
             latin:isModifier="true" />
         <Key
             latin:codes="@integer/key_space"
@@ -251,6 +258,7 @@
             latin:isModifier="true" />
         <Key
             latin:keyLabel="."
+            latin:keyHintIcon="@drawable/hint_popup"
             latin:popupKeyboard="@xml/popup_punctuation"
             latin:isModifier="true" />
         <Key
@@ -278,7 +286,7 @@
             latin:iconPreview="@drawable/sym_keyboard_feedback_settings"
             latin:isModifier="true" />
         <Key
-            latin:keyLabel="\@"
+            latin:codes="@integer/key_f1"
             latin:isModifier="true" />
         <Key
             latin:codes="@integer/key_space"
@@ -288,6 +296,7 @@
             latin:isModifier="true" />
         <Key
             latin:keyLabel="."
+            latin:keyHintIcon="@drawable/hint_popup"
             latin:popupKeyboard="@xml/popup_punctuation"
             latin:isModifier="true" />
         <Key
@@ -325,11 +334,13 @@
             latin:isModifier="true" />
         <Key
             latin:keyLabel="."
+            latin:keyHintIcon="@drawable/hint_popup"
             latin:popupKeyboard="@xml/popup_punctuation"
             latin:isModifier="true" />
         <Key
             latin:keyLabel=":-)"
             latin:keyOutputText=":-) "
+            latin:keyHintIcon="@drawable/hint_popup"
             latin:popupKeyboard="@xml/popup_smileys"
             latin:keyWidth="25%p"
             latin:isModifier="true"
@@ -367,6 +378,7 @@
             latin:isModifier="true" />
         <Key
             latin:keyLabel="."
+            latin:keyHintIcon="@drawable/hint_popup"
             latin:popupKeyboard="@xml/popup_punctuation"
             latin:isModifier="true" />
         <Key
diff --git a/java/res/xml/kbd_symbols.xml b/java/res/xml/kbd_symbols.xml
index 83fb5a71de6b7e4ef53f9c1638a63925f65b530b..608ddda8e163ff393c5625a15a6a3e22ed2f6c18 100644
--- a/java/res/xml/kbd_symbols.xml
+++ b/java/res/xml/kbd_symbols.xml
@@ -143,70 +143,63 @@
             latin:keyEdgeFlags="right" />
     </Row>
     <Row
-        latin:keyboardMode="@+id/mode_symbols"
+        latin:keyboardMode="@+id/mode_symbols_normal"
         latin:rowEdgeFlags="bottom"
     >
-        <Key
-            latin:codes="@integer/key_symbol"
-            latin:keyLabel="@string/label_alpha_key"
-            latin:keyWidth="20%p"
-            latin:isModifier="true"
-            latin:keyEdgeFlags="left" />
-        <Key
-            latin:codes="@integer/key_f1"
-            latin:isModifier="true" />
-        <Key
-            latin:codes="@integer/key_space"
-            latin:keyIcon="@drawable/sym_keyboard_space"
-            latin:iconPreview="@drawable/sym_keyboard_feedback_space"
-            latin:keyWidth="40%p"
-            latin:isModifier="true" />
-        <Key
-            latin:keyLabel="."
-            latin:popupKeyboard="@xml/popup_punctuation"
-            latin:isModifier="true" />
-        <Key
-            latin:codes="@integer/key_return"
-            latin:keyIcon="@drawable/sym_keyboard_return"
-            latin:iconPreview="@drawable/sym_keyboard_feedback_return"
-            latin:keyWidth="20%p"
-            latin:isModifier="true"
-            latin:keyEdgeFlags="right" />
+        <include latin:keyboardLayout="@xml/kbd_symbols_row4_common" />
     </Row>
     <Row
-        latin:keyboardMode="@+id/mode_symbols_with_settings_key"
+        latin:keyboardMode="@+id/mode_symbols_url"
         latin:rowEdgeFlags="bottom"
     >
-        <Key
-            latin:codes="@integer/key_symbol"
-            latin:keyLabel="@string/label_alpha_key"
-            latin:keyWidth="15%p"
-            latin:isModifier="true"
-            latin:keyEdgeFlags="left" />
-        <Key
-            latin:codes="@integer/key_settings"
-            latin:keyIcon="@drawable/sym_keyboard_settings"
-            latin:iconPreview="@drawable/sym_keyboard_feedback_settings"
-            latin:isModifier="true" />
-        <Key
-            latin:codes="@integer/key_f1"
-            latin:isModifier="true" />
-        <Key
-            latin:codes="@integer/key_space"
-            latin:keyIcon="@drawable/sym_keyboard_space"
-            latin:iconPreview="@drawable/sym_keyboard_feedback_space"
-            latin:keyWidth="30%p"
-            latin:isModifier="true" />
-        <Key
-            latin:keyLabel="."
-            latin:popupKeyboard="@xml/popup_punctuation"
-            latin:isModifier="true" />
-        <Key
-            latin:codes="@integer/key_return"
-            latin:keyIcon="@drawable/sym_keyboard_return"
-            latin:iconPreview="@drawable/sym_keyboard_feedback_return"
-            latin:keyWidth="25%p"
-            latin:isModifier="true"
-            latin:keyEdgeFlags="right" />
+        <include latin:keyboardLayout="@xml/kbd_symbols_row4_common" />
+    </Row>
+    <Row
+        latin:keyboardMode="@+id/mode_symbols_email"
+        latin:rowEdgeFlags="bottom"
+    >
+        <include latin:keyboardLayout="@xml/kbd_symbols_row4_common" />
+    </Row>
+    <Row
+        latin:keyboardMode="@+id/mode_symbols_im"
+        latin:rowEdgeFlags="bottom"
+    >
+        <include latin:keyboardLayout="@xml/kbd_symbols_row4_im" />
+    </Row>
+    <Row
+        latin:keyboardMode="@+id/mode_symbols_webentry"
+        latin:rowEdgeFlags="bottom"
+    >
+        <include latin:keyboardLayout="@xml/kbd_symbols_row4_common" />
+    </Row>
+    <Row
+        latin:keyboardMode="@+id/mode_symbols_normal_with_settings_key"
+        latin:rowEdgeFlags="bottom"
+    >
+        <include latin:keyboardLayout="@xml/kbd_symbols_row4_common_with_settings_key" />
+    </Row>
+    <Row
+        latin:keyboardMode="@+id/mode_symbols_url_with_settings_key"
+        latin:rowEdgeFlags="bottom"
+    >
+        <include latin:keyboardLayout="@xml/kbd_symbols_row4_common_with_settings_key" />
+    </Row>
+    <Row
+        latin:keyboardMode="@+id/mode_symbols_email_with_settings_key"
+        latin:rowEdgeFlags="bottom"
+    >
+        <include latin:keyboardLayout="@xml/kbd_symbols_row4_common_with_settings_key" />
+    </Row>
+    <Row
+        latin:keyboardMode="@+id/mode_symbols_im_with_settings_key"
+        latin:rowEdgeFlags="bottom"
+    >
+        <include latin:keyboardLayout="@xml/kbd_symbols_row4_im_with_settings_key" />
+    </Row>
+    <Row
+        latin:keyboardMode="@+id/mode_symbols_webentry_with_settings_key"
+        latin:rowEdgeFlags="bottom"
+    >
+        <include latin:keyboardLayout="@xml/kbd_symbols_row4_common_with_settings_key" />
     </Row>
 </Keyboard>
diff --git a/java/res/xml/kbd_symbols_black.xml b/java/res/xml/kbd_symbols_black.xml
index b6a069c25fad23ad7c878b2e142200c1b7bdaa75..9e401a1cd221cb31959391b5eae4bfb550d080fb 100644
--- a/java/res/xml/kbd_symbols_black.xml
+++ b/java/res/xml/kbd_symbols_black.xml
@@ -142,59 +142,63 @@
             latin:keyEdgeFlags="right" />
     </Row>
     <Row
-        latin:keyboardMode="@+id/mode_symbols"
+        latin:keyboardMode="@+id/mode_symbols_normal"
         latin:rowEdgeFlags="bottom"
     >
-        <Key
-            latin:codes="@integer/key_symbol"
-            latin:keyLabel="@string/label_alpha_key"
-            latin:keyWidth="20%p"
-            latin:keyEdgeFlags="left" />
-        <Key
-            latin:codes="@integer/key_f1" />
-        <Key
-            latin:codes="@integer/key_space"
-            latin:keyIcon="@drawable/sym_bkeyboard_space"
-            latin:iconPreview="@drawable/sym_keyboard_feedback_space"
-            latin:keyWidth="40%p" />
-        <Key
-            latin:keyLabel="."
-            latin:popupKeyboard="@xml/popup_punctuation" />
-        <Key
-            latin:codes="@integer/key_return"
-            latin:keyIcon="@drawable/sym_bkeyboard_return"
-            latin:iconPreview="@drawable/sym_keyboard_feedback_return"
-            latin:keyWidth="20%p"
-            latin:keyEdgeFlags="right" />
+        <include latin:keyboardLayout="@xml/kbd_symbols_black_row4_common" />
     </Row>
     <Row
-        latin:keyboardMode="@+id/mode_symbols_with_settings_key"
+        latin:keyboardMode="@+id/mode_symbols_url"
         latin:rowEdgeFlags="bottom"
     >
-        <Key
-            latin:codes="@integer/key_symbol"
-            latin:keyLabel="@string/label_alpha_key"
-            latin:keyWidth="15%p"
-            latin:keyEdgeFlags="left" />
-        <Key
-            latin:codes="@integer/key_settings"
-            latin:keyIcon="@drawable/sym_bkeyboard_settings"
-            latin:iconPreview="@drawable/sym_keyboard_feedback_settings" />
-        <Key
-            latin:codes="@integer/key_f1" />
-        <Key
-            latin:codes="@integer/key_space"
-            latin:keyIcon="@drawable/sym_bkeyboard_space"
-            latin:iconPreview="@drawable/sym_keyboard_feedback_space"
-            latin:keyWidth="30%p" />
-        <Key
-            latin:keyLabel="."
-            latin:popupKeyboard="@xml/popup_punctuation" />
-        <Key
-            latin:codes="@integer/key_return"
-            latin:keyIcon="@drawable/sym_bkeyboard_return"
-            latin:iconPreview="@drawable/sym_keyboard_feedback_return"
-            latin:keyWidth="25%p"
-            latin:keyEdgeFlags="right" />
+        <include latin:keyboardLayout="@xml/kbd_symbols_black_row4_common" />
+    </Row>
+    <Row
+        latin:keyboardMode="@+id/mode_symbols_email"
+        latin:rowEdgeFlags="bottom"
+    >
+        <include latin:keyboardLayout="@xml/kbd_symbols_black_row4_common" />
+    </Row>
+    <Row
+        latin:keyboardMode="@+id/mode_symbols_im"
+        latin:rowEdgeFlags="bottom"
+    >
+        <include latin:keyboardLayout="@xml/kbd_symbols_black_row4_im" />
+    </Row>
+    <Row
+        latin:keyboardMode="@+id/mode_symbols_webentry"
+        latin:rowEdgeFlags="bottom"
+    >
+        <include latin:keyboardLayout="@xml/kbd_symbols_black_row4_common" />
+    </Row>
+    <Row
+        latin:keyboardMode="@+id/mode_symbols_normal_with_settings_key"
+        latin:rowEdgeFlags="bottom"
+    >
+        <include latin:keyboardLayout="@xml/kbd_symbols_black_row4_common_with_settings_key" />
+    </Row>
+    <Row
+        latin:keyboardMode="@+id/mode_symbols_url_with_settings_key"
+        latin:rowEdgeFlags="bottom"
+    >
+        <include latin:keyboardLayout="@xml/kbd_symbols_black_row4_common_with_settings_key" />
+    </Row>
+    <Row
+        latin:keyboardMode="@+id/mode_symbols_email_with_settings_key"
+        latin:rowEdgeFlags="bottom"
+    >
+        <include latin:keyboardLayout="@xml/kbd_symbols_black_row4_common_with_settings_key" />
+    </Row>
+    <Row
+        latin:keyboardMode="@+id/mode_symbols_im_with_settings_key"
+        latin:rowEdgeFlags="bottom"
+    >
+        <include latin:keyboardLayout="@xml/kbd_symbols_black_row4_im_with_settings_key" />
+    </Row>
+    <Row
+        latin:keyboardMode="@+id/mode_symbols_webentry_with_settings_key"
+        latin:rowEdgeFlags="bottom"
+    >
+        <include latin:keyboardLayout="@xml/kbd_symbols_black_row4_common_with_settings_key" />
     </Row>
 </Keyboard>
diff --git a/java/res/xml/kbd_symbols_black_row4_common.xml b/java/res/xml/kbd_symbols_black_row4_common.xml
new file mode 100644
index 0000000000000000000000000000000000000000..7433eca7fad7a944ceb249448a802e0788a126c0
--- /dev/null
+++ b/java/res/xml/kbd_symbols_black_row4_common.xml
@@ -0,0 +1,46 @@
+<?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.
+*/
+-->
+
+<merge
+    xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
+>
+    <Key
+        latin:codes="@integer/key_symbol"
+        latin:keyLabel="@string/label_alpha_key"
+        latin:keyWidth="20%p"
+        latin:keyEdgeFlags="left" />
+    <Key
+        latin:codes="@integer/key_f1" />
+    <Key
+        latin:codes="@integer/key_space"
+        latin:keyIcon="@drawable/sym_bkeyboard_space"
+        latin:iconPreview="@drawable/sym_keyboard_feedback_space"
+        latin:keyWidth="40%p" />
+    <Key
+        latin:keyLabel="."
+        latin:keyHintIcon="@drawable/hint_popup"
+        latin:popupKeyboard="@xml/popup_punctuation" />
+    <Key
+        latin:codes="@integer/key_return"
+        latin:keyIcon="@drawable/sym_bkeyboard_return"
+        latin:iconPreview="@drawable/sym_keyboard_feedback_return"
+        latin:keyWidth="20%p"
+        latin:keyEdgeFlags="right" />
+</merge>
diff --git a/java/res/xml/kbd_symbols_black_row4_common_with_settings_key.xml b/java/res/xml/kbd_symbols_black_row4_common_with_settings_key.xml
new file mode 100644
index 0000000000000000000000000000000000000000..bbb16991900ecada4e4190112d885374ba6d3083
--- /dev/null
+++ b/java/res/xml/kbd_symbols_black_row4_common_with_settings_key.xml
@@ -0,0 +1,50 @@
+<?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.
+*/
+-->
+
+<merge
+    xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
+>
+    <Key
+        latin:codes="@integer/key_symbol"
+        latin:keyLabel="@string/label_alpha_key"
+        latin:keyWidth="15%p"
+        latin:keyEdgeFlags="left" />
+    <Key
+        latin:codes="@integer/key_settings"
+        latin:keyIcon="@drawable/sym_bkeyboard_settings"
+        latin:iconPreview="@drawable/sym_keyboard_feedback_settings" />
+    <Key
+        latin:codes="@integer/key_f1" />
+    <Key
+        latin:codes="@integer/key_space"
+        latin:keyIcon="@drawable/sym_bkeyboard_space"
+        latin:iconPreview="@drawable/sym_keyboard_feedback_space"
+        latin:keyWidth="30%p" />
+    <Key
+        latin:keyLabel="."
+        latin:keyHintIcon="@drawable/hint_popup"
+        latin:popupKeyboard="@xml/popup_punctuation" />
+    <Key
+        latin:codes="@integer/key_return"
+        latin:keyIcon="@drawable/sym_bkeyboard_return"
+        latin:iconPreview="@drawable/sym_keyboard_feedback_return"
+        latin:keyWidth="25%p"
+        latin:keyEdgeFlags="right" />
+</merge>
diff --git a/java/res/xml/kbd_symbols_black_row4_im.xml b/java/res/xml/kbd_symbols_black_row4_im.xml
new file mode 100644
index 0000000000000000000000000000000000000000..a1546b7b5e619fd50526b229ca85c8aa4dbaf384
--- /dev/null
+++ b/java/res/xml/kbd_symbols_black_row4_im.xml
@@ -0,0 +1,47 @@
+<?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.
+*/
+-->
+
+<merge
+    xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
+>
+    <Key
+        latin:codes="@integer/key_symbol"
+        latin:keyLabel="@string/label_alpha_key"
+        latin:keyWidth="20%p"
+        latin:keyEdgeFlags="left" />
+    <Key
+        latin:codes="@integer/key_f1" />
+    <Key
+        latin:codes="@integer/key_space"
+        latin:keyIcon="@drawable/sym_bkeyboard_space"
+        latin:iconPreview="@drawable/sym_keyboard_feedback_space"
+        latin:keyWidth="40%p" />
+    <Key
+        latin:keyLabel="."
+        latin:keyHintIcon="@drawable/hint_popup"
+        latin:popupKeyboard="@xml/popup_punctuation" />
+    <Key
+        latin:keyLabel=":-)"
+        latin:keyOutputText=":-) "
+        latin:keyHintIcon="@drawable/hint_popup"
+        latin:popupKeyboard="@xml/popup_smileys"
+        latin:keyWidth="20%p"
+        latin:keyEdgeFlags="right" />
+</merge>
diff --git a/java/res/xml/kbd_symbols_black_row4_im_with_settings_key.xml b/java/res/xml/kbd_symbols_black_row4_im_with_settings_key.xml
new file mode 100644
index 0000000000000000000000000000000000000000..4cab461e757904360deffb68061e1c5984e551cc
--- /dev/null
+++ b/java/res/xml/kbd_symbols_black_row4_im_with_settings_key.xml
@@ -0,0 +1,51 @@
+<?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.
+*/
+-->
+
+<merge
+    xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
+>
+    <Key
+        latin:codes="@integer/key_symbol"
+        latin:keyLabel="@string/label_alpha_key"
+        latin:keyWidth="15%p"
+        latin:keyEdgeFlags="left" />
+    <Key
+        latin:codes="@integer/key_settings"
+        latin:keyIcon="@drawable/sym_bkeyboard_settings"
+        latin:iconPreview="@drawable/sym_keyboard_feedback_settings" />
+    <Key
+        latin:codes="@integer/key_f1" />
+    <Key
+        latin:codes="@integer/key_space"
+        latin:keyIcon="@drawable/sym_bkeyboard_space"
+        latin:iconPreview="@drawable/sym_keyboard_feedback_space"
+        latin:keyWidth="30%p" />
+    <Key
+        latin:keyLabel="."
+        latin:keyHintIcon="@drawable/hint_popup"
+        latin:popupKeyboard="@xml/popup_punctuation" />
+    <Key
+        latin:keyLabel=":-)"
+        latin:keyOutputText=":-) "
+        latin:keyHintIcon="@drawable/hint_popup"
+        latin:popupKeyboard="@xml/popup_smileys"
+        latin:keyWidth="25%p"
+        latin:keyEdgeFlags="right" />
+</merge>
diff --git a/java/res/xml/kbd_symbols_row4_common.xml b/java/res/xml/kbd_symbols_row4_common.xml
new file mode 100644
index 0000000000000000000000000000000000000000..ef7cdcaff856c38968c774d80fbc5797aa18fd04
--- /dev/null
+++ b/java/res/xml/kbd_symbols_row4_common.xml
@@ -0,0 +1,51 @@
+<?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.
+*/
+-->
+
+<merge
+    xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
+>
+    <Key
+        latin:codes="@integer/key_symbol"
+        latin:keyLabel="@string/label_alpha_key"
+        latin:keyWidth="20%p"
+        latin:isModifier="true"
+        latin:keyEdgeFlags="left" />
+    <Key
+        latin:codes="@integer/key_f1"
+        latin:isModifier="true" />
+    <Key
+        latin:codes="@integer/key_space"
+        latin:keyIcon="@drawable/sym_keyboard_space"
+        latin:iconPreview="@drawable/sym_keyboard_feedback_space"
+        latin:keyWidth="40%p"
+        latin:isModifier="true" />
+    <Key
+        latin:keyLabel="."
+        latin:keyHintIcon="@drawable/hint_popup"
+        latin:popupKeyboard="@xml/popup_punctuation"
+        latin:isModifier="true" />
+    <Key
+        latin:codes="@integer/key_return"
+        latin:keyIcon="@drawable/sym_keyboard_return"
+        latin:iconPreview="@drawable/sym_keyboard_feedback_return"
+        latin:keyWidth="20%p"
+        latin:isModifier="true"
+        latin:keyEdgeFlags="right" />
+</merge>
diff --git a/java/res/xml/kbd_symbols_row4_common_with_settings_key.xml b/java/res/xml/kbd_symbols_row4_common_with_settings_key.xml
new file mode 100644
index 0000000000000000000000000000000000000000..54b85429cf15096a2ea013ba6b176d3e1722ee72
--- /dev/null
+++ b/java/res/xml/kbd_symbols_row4_common_with_settings_key.xml
@@ -0,0 +1,56 @@
+<?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.
+*/
+-->
+
+<merge
+    xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
+>
+    <Key
+        latin:codes="@integer/key_symbol"
+        latin:keyLabel="@string/label_alpha_key"
+        latin:keyWidth="15%p"
+        latin:isModifier="true"
+        latin:keyEdgeFlags="left" />
+    <Key
+        latin:codes="@integer/key_settings"
+        latin:keyIcon="@drawable/sym_keyboard_settings"
+        latin:iconPreview="@drawable/sym_keyboard_feedback_settings"
+        latin:isModifier="true" />
+    <Key
+        latin:codes="@integer/key_f1"
+        latin:isModifier="true" />
+    <Key
+        latin:codes="@integer/key_space"
+        latin:keyIcon="@drawable/sym_keyboard_space"
+        latin:iconPreview="@drawable/sym_keyboard_feedback_space"
+        latin:keyWidth="30%p"
+        latin:isModifier="true" />
+    <Key
+        latin:keyLabel="."
+        latin:keyHintIcon="@drawable/hint_popup"
+        latin:popupKeyboard="@xml/popup_punctuation"
+        latin:isModifier="true" />
+    <Key
+        latin:codes="@integer/key_return"
+        latin:keyIcon="@drawable/sym_keyboard_return"
+        latin:iconPreview="@drawable/sym_keyboard_feedback_return"
+        latin:keyWidth="25%p"
+        latin:isModifier="true"
+        latin:keyEdgeFlags="right" />
+</merge>
diff --git a/java/res/xml/kbd_symbols_row4_im.xml b/java/res/xml/kbd_symbols_row4_im.xml
new file mode 100644
index 0000000000000000000000000000000000000000..c7d679bc4a9d70a5bbb1e77cceb8c893c6245e09
--- /dev/null
+++ b/java/res/xml/kbd_symbols_row4_im.xml
@@ -0,0 +1,52 @@
+<?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.
+*/
+-->
+
+<merge
+    xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
+>
+    <Key
+        latin:codes="@integer/key_symbol"
+        latin:keyLabel="@string/label_alpha_key"
+        latin:keyWidth="20%p"
+        latin:isModifier="true"
+        latin:keyEdgeFlags="left" />
+    <Key
+        latin:codes="@integer/key_f1"
+        latin:isModifier="true" />
+    <Key
+        latin:codes="@integer/key_space"
+        latin:keyIcon="@drawable/sym_keyboard_space"
+        latin:iconPreview="@drawable/sym_keyboard_feedback_space"
+        latin:keyWidth="40%p"
+        latin:isModifier="true" />
+    <Key
+        latin:keyLabel="."
+        latin:keyHintIcon="@drawable/hint_popup"
+        latin:popupKeyboard="@xml/popup_punctuation"
+        latin:isModifier="true" />
+    <Key
+        latin:keyLabel=":-)"
+        latin:keyOutputText=":-) "
+        latin:keyHintIcon="@drawable/hint_popup"
+        latin:popupKeyboard="@xml/popup_smileys"
+        latin:keyWidth="20%p"
+        latin:isModifier="true"
+        latin:keyEdgeFlags="right" />
+</merge>
diff --git a/java/res/xml/kbd_symbols_row4_im_with_settings_key.xml b/java/res/xml/kbd_symbols_row4_im_with_settings_key.xml
new file mode 100644
index 0000000000000000000000000000000000000000..7cc209b6b15cf15cf8e68d3cfb34148fc0b7711b
--- /dev/null
+++ b/java/res/xml/kbd_symbols_row4_im_with_settings_key.xml
@@ -0,0 +1,57 @@
+<?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.
+*/
+-->
+
+<merge
+    xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
+>
+    <Key
+        latin:codes="@integer/key_symbol"
+        latin:keyLabel="@string/label_alpha_key"
+        latin:keyWidth="15%p"
+        latin:isModifier="true"
+        latin:keyEdgeFlags="left" />
+    <Key
+        latin:codes="@integer/key_settings"
+        latin:keyIcon="@drawable/sym_keyboard_settings"
+        latin:iconPreview="@drawable/sym_keyboard_feedback_settings"
+        latin:isModifier="true" />
+    <Key
+        latin:codes="@integer/key_f1"
+        latin:isModifier="true" />
+    <Key
+        latin:codes="@integer/key_space"
+        latin:keyIcon="@drawable/sym_keyboard_space"
+        latin:iconPreview="@drawable/sym_keyboard_feedback_space"
+        latin:keyWidth="30%p"
+        latin:isModifier="true" />
+    <Key
+        latin:keyLabel="."
+        latin:keyHintIcon="@drawable/hint_popup"
+        latin:popupKeyboard="@xml/popup_punctuation"
+        latin:isModifier="true" />
+    <Key
+        latin:keyLabel=":-)"
+        latin:keyOutputText=":-) "
+        latin:keyHintIcon="@drawable/hint_popup"
+        latin:popupKeyboard="@xml/popup_smileys"
+        latin:keyWidth="25%p"
+        latin:isModifier="true"
+        latin:keyEdgeFlags="right" />
+</merge>
diff --git a/java/res/xml/kbd_symbols_shift.xml b/java/res/xml/kbd_symbols_shift.xml
index d83706b5cdd56bfcfd117ff34ccf9c2c0b516b7e..b8f8faeb21bf01a08b91179e61a4423b10082431 100644
--- a/java/res/xml/kbd_symbols_shift.xml
+++ b/java/res/xml/kbd_symbols_shift.xml
@@ -122,68 +122,63 @@
             latin:keyEdgeFlags="right" />
     </Row>
     <Row
-        latin:keyboardMode="@+id/mode_symbols"
+        latin:keyboardMode="@+id/mode_symbols_normal"
         latin:rowEdgeFlags="bottom"
     >
-        <Key
-            latin:codes="@integer/key_symbol"
-            latin:keyLabel="@string/label_alpha_key"
-            latin:keyWidth="20%p"
-            latin:isModifier="true"
-            latin:keyEdgeFlags="left" />
-        <Key
-            latin:keyLabel="„"
-            latin:isModifier="true" />
-        <Key
-            latin:codes="@integer/key_space"
-            latin:keyIcon="@drawable/sym_keyboard_space"
-            latin:iconPreview="@drawable/sym_keyboard_feedback_space"
-            latin:keyWidth="40%p"
-            latin:isModifier="true" />
-        <Key
-            latin:keyLabel="…"
-            latin:isModifier="true" />
-        <Key
-            latin:codes="@integer/key_return"
-            latin:keyIcon="@drawable/sym_keyboard_return"
-            latin:iconPreview="@drawable/sym_keyboard_feedback_return"
-            latin:keyWidth="20%p"
-            latin:isModifier="true"
-            latin:keyEdgeFlags="right" />
+        <include latin:keyboardLayout="@xml/kbd_symbols_shift_row4_common" />
     </Row>
     <Row
-        latin:keyboardMode="@+id/mode_symbols_with_settings_key"
+        latin:keyboardMode="@+id/mode_symbols_url"
         latin:rowEdgeFlags="bottom"
     >
-        <Key
-            latin:codes="@integer/key_symbol"
-            latin:keyLabel="@string/label_alpha_key"
-            latin:keyWidth="15%p"
-            latin:isModifier="true"
-            latin:keyEdgeFlags="left" />
-        <Key
-            latin:codes="@integer/key_settings"
-            latin:keyIcon="@drawable/sym_keyboard_settings"
-            latin:iconPreview="@drawable/sym_keyboard_feedback_settings"
-            latin:isModifier="true" />
-        <Key
-            latin:keyLabel="„"
-            latin:isModifier="true" />
-        <Key
-            latin:codes="@integer/key_space"
-            latin:keyIcon="@drawable/sym_keyboard_space"
-            latin:iconPreview="@drawable/sym_keyboard_feedback_space"
-            latin:keyWidth="30%p"
-            latin:isModifier="true" />
-        <Key
-            latin:keyLabel="…"
-            latin:isModifier="true" />
-        <Key
-            latin:codes="@integer/key_return"
-            latin:keyIcon="@drawable/sym_keyboard_return"
-            latin:iconPreview="@drawable/sym_keyboard_feedback_return"
-            latin:keyWidth="25%p"
-            latin:isModifier="true"
-            latin:keyEdgeFlags="right" />
+        <include latin:keyboardLayout="@xml/kbd_symbols_shift_row4_common" />
+    </Row>
+    <Row
+        latin:keyboardMode="@+id/mode_symbols_email"
+        latin:rowEdgeFlags="bottom"
+    >
+        <include latin:keyboardLayout="@xml/kbd_symbols_shift_row4_common" />
+    </Row>
+    <Row
+        latin:keyboardMode="@+id/mode_symbols_im"
+        latin:rowEdgeFlags="bottom"
+    >
+        <include latin:keyboardLayout="@xml/kbd_symbols_shift_row4_im" />
+    </Row>
+    <Row
+        latin:keyboardMode="@+id/mode_symbols_webentry"
+        latin:rowEdgeFlags="bottom"
+    >
+        <include latin:keyboardLayout="@xml/kbd_symbols_shift_row4_common" />
+    </Row>
+    <Row
+        latin:keyboardMode="@+id/mode_symbols_normal_with_settings_key"
+        latin:rowEdgeFlags="bottom"
+    >
+        <include latin:keyboardLayout="@xml/kbd_symbols_shift_row4_common_with_settings_key" />
+    </Row>
+    <Row
+        latin:keyboardMode="@+id/mode_symbols_url_with_settings_key"
+        latin:rowEdgeFlags="bottom"
+    >
+        <include latin:keyboardLayout="@xml/kbd_symbols_shift_row4_common_with_settings_key" />
+    </Row>
+    <Row
+        latin:keyboardMode="@+id/mode_symbols_email_with_settings_key"
+        latin:rowEdgeFlags="bottom"
+    >
+        <include latin:keyboardLayout="@xml/kbd_symbols_shift_row4_common_with_settings_key" />
+    </Row>
+    <Row
+        latin:keyboardMode="@+id/mode_symbols_im_with_settings_key"
+        latin:rowEdgeFlags="bottom"
+    >
+        <include latin:keyboardLayout="@xml/kbd_symbols_shift_row4_im_with_settings_key" />
+    </Row>
+    <Row
+        latin:keyboardMode="@+id/mode_symbols_webentry_with_settings_key"
+        latin:rowEdgeFlags="bottom"
+    >
+        <include latin:keyboardLayout="@xml/kbd_symbols_shift_row4_common_with_settings_key" />
     </Row>
 </Keyboard>
diff --git a/java/res/xml/kbd_symbols_shift_black.xml b/java/res/xml/kbd_symbols_shift_black.xml
index e5f8abf6e003ef95569850b0c18dd52e38738b8d..34684a65b282b7f0eb10515fa32b857877fb2d46 100644
--- a/java/res/xml/kbd_symbols_shift_black.xml
+++ b/java/res/xml/kbd_symbols_shift_black.xml
@@ -121,57 +121,63 @@
             latin:keyEdgeFlags="right" />
     </Row>
     <Row
-        latin:keyboardMode="@+id/mode_symbols"
+        latin:keyboardMode="@+id/mode_symbols_normal"
         latin:rowEdgeFlags="bottom"
     >
-        <Key
-            latin:codes="@integer/key_symbol"
-            latin:keyLabel="@string/label_alpha_key"
-            latin:keyWidth="20%p"
-            latin:keyEdgeFlags="left" />
-        <Key
-            latin:keyLabel="„" />
-        <Key
-            latin:codes="@integer/key_space"
-            latin:keyIcon="@drawable/sym_bkeyboard_space"
-            latin:iconPreview="@drawable/sym_keyboard_feedback_space"
-            latin:keyWidth="40%p" />
-        <Key
-            latin:keyLabel="…" />
-        <Key
-            latin:codes="@integer/key_return"
-            latin:keyIcon="@drawable/sym_bkeyboard_return"
-            latin:iconPreview="@drawable/sym_keyboard_feedback_return"
-            latin:keyWidth="20%p"
-            latin:keyEdgeFlags="right" />
+        <include latin:keyboardLayout="@xml/kbd_symbols_shift_black_row4_common" />
     </Row>
     <Row
-        latin:keyboardMode="@+id/mode_symbols_with_settings_key"
+        latin:keyboardMode="@+id/mode_symbols_url"
         latin:rowEdgeFlags="bottom"
     >
-        <Key
-            latin:codes="@integer/key_symbol"
-            latin:keyLabel="@string/label_alpha_key"
-            latin:keyWidth="15%p"
-            latin:keyEdgeFlags="left" />
-        <Key
-            latin:codes="@integer/key_settings"
-            latin:keyIcon="@drawable/sym_bkeyboard_settings"
-            latin:iconPreview="@drawable/sym_keyboard_feedback_settings" />
-        <Key
-            latin:keyLabel="„" />
-        <Key
-            latin:codes="@integer/key_space"
-            latin:keyIcon="@drawable/sym_bkeyboard_space"
-            latin:iconPreview="@drawable/sym_keyboard_feedback_space"
-            latin:keyWidth="30%p" />
-        <Key
-            latin:keyLabel="…" />
-        <Key
-            latin:codes="@integer/key_return"
-            latin:keyIcon="@drawable/sym_bkeyboard_return"
-            latin:iconPreview="@drawable/sym_keyboard_feedback_return"
-            latin:keyWidth="25%p"
-            latin:keyEdgeFlags="right" />
+        <include latin:keyboardLayout="@xml/kbd_symbols_shift_black_row4_common" />
+    </Row>
+    <Row
+        latin:keyboardMode="@+id/mode_symbols_email"
+        latin:rowEdgeFlags="bottom"
+    >
+        <include latin:keyboardLayout="@xml/kbd_symbols_shift_black_row4_common" />
+    </Row>
+    <Row
+        latin:keyboardMode="@+id/mode_symbols_im"
+        latin:rowEdgeFlags="bottom"
+    >
+        <include latin:keyboardLayout="@xml/kbd_symbols_shift_black_row4_im" />
+    </Row>
+    <Row
+        latin:keyboardMode="@+id/mode_symbols_webentry"
+        latin:rowEdgeFlags="bottom"
+    >
+        <include latin:keyboardLayout="@xml/kbd_symbols_shift_black_row4_common" />
+    </Row>
+    <Row
+        latin:keyboardMode="@+id/mode_symbols_normal_with_settings_key"
+        latin:rowEdgeFlags="bottom"
+    >
+        <include latin:keyboardLayout="@xml/kbd_symbols_shift_black_row4_common_with_settings_key" />
+    </Row>
+    <Row
+        latin:keyboardMode="@+id/mode_symbols_url_with_settings_key"
+        latin:rowEdgeFlags="bottom"
+    >
+        <include latin:keyboardLayout="@xml/kbd_symbols_shift_black_row4_common_with_settings_key" />
+    </Row>
+    <Row
+        latin:keyboardMode="@+id/mode_symbols_email_with_settings_key"
+        latin:rowEdgeFlags="bottom"
+    >
+        <include latin:keyboardLayout="@xml/kbd_symbols_shift_black_row4_common_with_settings_key" />
+    </Row>
+    <Row
+        latin:keyboardMode="@+id/mode_symbols_im_with_settings_key"
+        latin:rowEdgeFlags="bottom"
+    >
+        <include latin:keyboardLayout="@xml/kbd_symbols_shift_black_row4_im_with_settings_key" />
+    </Row>
+    <Row
+        latin:keyboardMode="@+id/mode_symbols_webentry_with_settings_key"
+        latin:rowEdgeFlags="bottom"
+    >
+        <include latin:keyboardLayout="@xml/kbd_symbols_shift_black_row4_common_with_settings_key" />
     </Row>
 </Keyboard>
diff --git a/java/res/xml/kbd_symbols_shift_black_row4_common.xml b/java/res/xml/kbd_symbols_shift_black_row4_common.xml
new file mode 100644
index 0000000000000000000000000000000000000000..beb5b3d678f564fca7151300b61ca92adefc6081
--- /dev/null
+++ b/java/res/xml/kbd_symbols_shift_black_row4_common.xml
@@ -0,0 +1,44 @@
+<?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.
+*/
+-->
+
+<merge
+    xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
+>
+    <Key
+        latin:codes="@integer/key_symbol"
+        latin:keyLabel="@string/label_alpha_key"
+        latin:keyWidth="20%p"
+        latin:keyEdgeFlags="left" />
+    <Key
+        latin:keyLabel="„" />
+    <Key
+        latin:codes="@integer/key_space"
+        latin:keyIcon="@drawable/sym_bkeyboard_space"
+        latin:iconPreview="@drawable/sym_keyboard_feedback_space"
+        latin:keyWidth="40%p" />
+    <Key
+        latin:keyLabel="…" />
+    <Key
+        latin:codes="@integer/key_return"
+        latin:keyIcon="@drawable/sym_bkeyboard_return"
+        latin:iconPreview="@drawable/sym_keyboard_feedback_return"
+        latin:keyWidth="20%p"
+        latin:keyEdgeFlags="right" />
+</merge>
diff --git a/java/res/xml/kbd_symbols_shift_black_row4_common_with_settings_key.xml b/java/res/xml/kbd_symbols_shift_black_row4_common_with_settings_key.xml
new file mode 100644
index 0000000000000000000000000000000000000000..97f882a5a611c889ddf6ba299b406bc0196529b7
--- /dev/null
+++ b/java/res/xml/kbd_symbols_shift_black_row4_common_with_settings_key.xml
@@ -0,0 +1,48 @@
+<?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.
+*/
+-->
+
+<merge
+    xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
+>
+    <Key
+        latin:codes="@integer/key_symbol"
+        latin:keyLabel="@string/label_alpha_key"
+        latin:keyWidth="15%p"
+        latin:keyEdgeFlags="left" />
+    <Key
+        latin:codes="@integer/key_settings"
+        latin:keyIcon="@drawable/sym_bkeyboard_settings"
+        latin:iconPreview="@drawable/sym_keyboard_feedback_settings" />
+    <Key
+        latin:keyLabel="„" />
+    <Key
+        latin:codes="@integer/key_space"
+        latin:keyIcon="@drawable/sym_bkeyboard_space"
+        latin:iconPreview="@drawable/sym_keyboard_feedback_space"
+        latin:keyWidth="30%p" />
+    <Key
+        latin:keyLabel="…" />
+    <Key
+        latin:codes="@integer/key_return"
+        latin:keyIcon="@drawable/sym_bkeyboard_return"
+        latin:iconPreview="@drawable/sym_keyboard_feedback_return"
+        latin:keyWidth="25%p"
+        latin:keyEdgeFlags="right" />
+</merge>
diff --git a/java/res/xml/kbd_symbols_shift_black_row4_im.xml b/java/res/xml/kbd_symbols_shift_black_row4_im.xml
new file mode 100644
index 0000000000000000000000000000000000000000..c0263c2151565372fa7d81f11b9e32c531b12608
--- /dev/null
+++ b/java/res/xml/kbd_symbols_shift_black_row4_im.xml
@@ -0,0 +1,45 @@
+<?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.
+*/
+-->
+
+<merge
+    xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
+>
+    <Key
+        latin:codes="@integer/key_symbol"
+        latin:keyLabel="@string/label_alpha_key"
+        latin:keyWidth="20%p"
+        latin:keyEdgeFlags="left" />
+    <Key
+        latin:keyLabel="„" />
+    <Key
+        latin:codes="@integer/key_space"
+        latin:keyIcon="@drawable/sym_bkeyboard_space"
+        latin:iconPreview="@drawable/sym_keyboard_feedback_space"
+        latin:keyWidth="40%p" />
+    <Key
+        latin:keyLabel="…" />
+    <Key
+        latin:keyLabel=":-)"
+        latin:keyOutputText=":-) "
+        latin:keyHintIcon="@drawable/hint_popup"
+        latin:popupKeyboard="@xml/popup_smileys"
+        latin:keyWidth="20%p"
+        latin:keyEdgeFlags="right" />
+</merge>
diff --git a/java/res/xml/kbd_symbols_shift_black_row4_im_with_settings_key.xml b/java/res/xml/kbd_symbols_shift_black_row4_im_with_settings_key.xml
new file mode 100644
index 0000000000000000000000000000000000000000..14d6a0b5166c86ddd7e206d814967dcd8ef47119
--- /dev/null
+++ b/java/res/xml/kbd_symbols_shift_black_row4_im_with_settings_key.xml
@@ -0,0 +1,49 @@
+<?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.
+*/
+-->
+
+<merge
+    xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
+>
+    <Key
+        latin:codes="@integer/key_symbol"
+        latin:keyLabel="@string/label_alpha_key"
+        latin:keyWidth="15%p"
+        latin:keyEdgeFlags="left" />
+    <Key
+        latin:codes="@integer/key_settings"
+        latin:keyIcon="@drawable/sym_bkeyboard_settings"
+        latin:iconPreview="@drawable/sym_keyboard_feedback_settings" />
+    <Key
+        latin:keyLabel="„" />
+    <Key
+        latin:codes="@integer/key_space"
+        latin:keyIcon="@drawable/sym_bkeyboard_space"
+        latin:iconPreview="@drawable/sym_keyboard_feedback_space"
+        latin:keyWidth="30%p" />
+    <Key
+        latin:keyLabel="…" />
+    <Key
+        latin:keyLabel=":-)"
+        latin:keyOutputText=":-) "
+        latin:keyHintIcon="@drawable/hint_popup"
+        latin:popupKeyboard="@xml/popup_smileys"
+        latin:keyWidth="25%p"
+        latin:keyEdgeFlags="right" />
+</merge>
diff --git a/java/res/xml/kbd_symbols_shift_row4_common.xml b/java/res/xml/kbd_symbols_shift_row4_common.xml
new file mode 100644
index 0000000000000000000000000000000000000000..4d5199e88be1c2091132a83cd15b5f20a76f04d6
--- /dev/null
+++ b/java/res/xml/kbd_symbols_shift_row4_common.xml
@@ -0,0 +1,49 @@
+<?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.
+*/
+-->
+
+<merge
+    xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
+>
+    <Key
+        latin:codes="@integer/key_symbol"
+        latin:keyLabel="@string/label_alpha_key"
+        latin:keyWidth="20%p"
+        latin:isModifier="true"
+        latin:keyEdgeFlags="left" />
+    <Key
+        latin:keyLabel="„"
+        latin:isModifier="true" />
+    <Key
+        latin:codes="@integer/key_space"
+        latin:keyIcon="@drawable/sym_keyboard_space"
+        latin:iconPreview="@drawable/sym_keyboard_feedback_space"
+        latin:keyWidth="40%p"
+        latin:isModifier="true" />
+    <Key
+        latin:keyLabel="…"
+        latin:isModifier="true" />
+    <Key
+        latin:codes="@integer/key_return"
+        latin:keyIcon="@drawable/sym_keyboard_return"
+        latin:iconPreview="@drawable/sym_keyboard_feedback_return"
+        latin:keyWidth="20%p"
+        latin:isModifier="true"
+        latin:keyEdgeFlags="right" />
+</merge>
diff --git a/java/res/xml/kbd_symbols_shift_row4_common_with_settings_key.xml b/java/res/xml/kbd_symbols_shift_row4_common_with_settings_key.xml
new file mode 100644
index 0000000000000000000000000000000000000000..df570ea1b6eaaba0d4ea81e02420fb374b8f21e4
--- /dev/null
+++ b/java/res/xml/kbd_symbols_shift_row4_common_with_settings_key.xml
@@ -0,0 +1,54 @@
+<?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.
+*/
+-->
+
+<merge
+    xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
+>
+    <Key
+        latin:codes="@integer/key_symbol"
+        latin:keyLabel="@string/label_alpha_key"
+        latin:keyWidth="15%p"
+        latin:isModifier="true"
+        latin:keyEdgeFlags="left" />
+    <Key
+        latin:codes="@integer/key_settings"
+        latin:keyIcon="@drawable/sym_keyboard_settings"
+        latin:iconPreview="@drawable/sym_keyboard_feedback_settings"
+        latin:isModifier="true" />
+    <Key
+        latin:keyLabel="„"
+        latin:isModifier="true" />
+    <Key
+        latin:codes="@integer/key_space"
+        latin:keyIcon="@drawable/sym_keyboard_space"
+        latin:iconPreview="@drawable/sym_keyboard_feedback_space"
+        latin:keyWidth="30%p"
+        latin:isModifier="true" />
+    <Key
+        latin:keyLabel="…"
+        latin:isModifier="true" />
+    <Key
+        latin:codes="@integer/key_return"
+        latin:keyIcon="@drawable/sym_keyboard_return"
+        latin:iconPreview="@drawable/sym_keyboard_feedback_return"
+        latin:keyWidth="25%p"
+        latin:isModifier="true"
+        latin:keyEdgeFlags="right" />
+</merge>
diff --git a/java/res/xml/kbd_symbols_shift_row4_im.xml b/java/res/xml/kbd_symbols_shift_row4_im.xml
new file mode 100644
index 0000000000000000000000000000000000000000..69c6092546c18b2709242e2d5e76721685bc865e
--- /dev/null
+++ b/java/res/xml/kbd_symbols_shift_row4_im.xml
@@ -0,0 +1,50 @@
+<?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.
+*/
+-->
+
+<merge
+    xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
+>
+    <Key
+        latin:codes="@integer/key_symbol"
+        latin:keyLabel="@string/label_alpha_key"
+        latin:keyWidth="20%p"
+        latin:isModifier="true"
+        latin:keyEdgeFlags="left" />
+    <Key
+        latin:keyLabel="„"
+        latin:isModifier="true" />
+    <Key
+        latin:codes="@integer/key_space"
+        latin:keyIcon="@drawable/sym_keyboard_space"
+        latin:iconPreview="@drawable/sym_keyboard_feedback_space"
+        latin:keyWidth="40%p"
+        latin:isModifier="true" />
+    <Key
+        latin:keyLabel="…"
+        latin:isModifier="true" />
+    <Key
+        latin:keyLabel=":-)"
+        latin:keyOutputText=":-) "
+        latin:keyHintIcon="@drawable/hint_popup"
+        latin:popupKeyboard="@xml/popup_smileys"
+        latin:keyWidth="20%p"
+        latin:isModifier="true"
+        latin:keyEdgeFlags="right" />
+</merge>
diff --git a/java/res/xml/kbd_symbols_shift_row4_im_with_settings_key.xml b/java/res/xml/kbd_symbols_shift_row4_im_with_settings_key.xml
new file mode 100644
index 0000000000000000000000000000000000000000..aad6e400bdf0082fda89d8647d747c9484219f5f
--- /dev/null
+++ b/java/res/xml/kbd_symbols_shift_row4_im_with_settings_key.xml
@@ -0,0 +1,55 @@
+<?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.
+*/
+-->
+
+<merge
+    xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
+>
+    <Key
+        latin:codes="@integer/key_symbol"
+        latin:keyLabel="@string/label_alpha_key"
+        latin:keyWidth="15%p"
+        latin:isModifier="true"
+        latin:keyEdgeFlags="left" />
+    <Key
+        latin:codes="@integer/key_settings"
+        latin:keyIcon="@drawable/sym_keyboard_settings"
+        latin:iconPreview="@drawable/sym_keyboard_feedback_settings"
+        latin:isModifier="true" />
+    <Key
+        latin:keyLabel="„"
+        latin:isModifier="true" />
+    <Key
+        latin:codes="@integer/key_space"
+        latin:keyIcon="@drawable/sym_keyboard_space"
+        latin:iconPreview="@drawable/sym_keyboard_feedback_space"
+        latin:keyWidth="30%p"
+        latin:isModifier="true" />
+    <Key
+        latin:keyLabel="…"
+        latin:isModifier="true" />
+    <Key
+        latin:keyLabel=":-)"
+        latin:keyOutputText=":-) "
+        latin:keyHintIcon="@drawable/hint_popup"
+        latin:popupKeyboard="@xml/popup_smileys"
+        latin:keyWidth="25%p"
+        latin:isModifier="true"
+        latin:keyEdgeFlags="right" />
+</merge>
diff --git a/java/res/xml/popup_at.xml b/java/res/xml/popup_at.xml
new file mode 100644
index 0000000000000000000000000000000000000000..4b19d4fd4b65d16a9c915209a1d4586a2dc0be7e
--- /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:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
+    latin:keyWidth="10%p"
+    latin:horizontalGap="0px"
+    latin:verticalGap="0px"
+    latin:keyHeight="@dimen/popup_key_height"
+>
+    <Row
+        latin:rowEdgeFlags="top|bottom"
+    >
+        <Key
+            latin:codes="@integer/key_settings"
+            latin:keyIcon="@drawable/sym_keyboard_settings"
+            latin:keyEdgeFlags="left" />
+        <Key
+            latin:keyLabel="\@"
+            latin: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 0000000000000000000000000000000000000000..1ace909efd30dfcfb1695c7b34d73898b723f704
--- /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:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
+    latin:keyWidth="10%p"
+    latin:horizontalGap="0px"
+    latin:verticalGap="0px"
+    latin:keyHeight="@dimen/popup_key_height"
+>
+    <Row
+        latin:rowEdgeFlags="top|bottom"
+    >
+        <Key
+            latin:codes="@integer/key_settings"
+            latin:keyIcon="@drawable/sym_keyboard_settings"
+            latin:keyEdgeFlags="left" />
+        <Key
+            latin:keyLabel="/"
+            latin:keyEdgeFlags="right" />
+    </Row>
+</Keyboard>
diff --git a/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java b/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java
index 86dbf1f60b32867474a44d55ee034c5115b935af..ec422174dc2c6ebbd22ee1ca88aff2ae1313dde0 100644
--- a/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java
+++ b/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java
@@ -29,14 +29,14 @@ import java.util.Locale;
 
 public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceChangeListener {
 
-    public static final int MODE_NONE = 0;
-    public static final int MODE_TEXT = 1;
-    public static final int MODE_SYMBOLS = 2;
-    public static final int MODE_PHONE = 3;
-    public static final int MODE_URL = 4;
-    public static final int MODE_EMAIL = 5;
-    public static final int MODE_IM = 6;
-    public static final int MODE_WEB = 7;
+    public static final int MODE_TEXT = 0;
+    public static final int MODE_URL = 1;
+    public static final int MODE_EMAIL = 2;
+    public static final int MODE_IM = 3;
+    public static final int MODE_WEB = 4;
+    public static final int MODE_PHONE = 5;
+
+    public static final int MODE_NONE = -1;
 
     // Main keyboard layouts without the settings key
     public static final int KEYBOARDMODE_NORMAL = R.id.mode_normal;
@@ -44,6 +44,13 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
     public static final int KEYBOARDMODE_EMAIL = R.id.mode_email;
     public static final int KEYBOARDMODE_IM = R.id.mode_im;
     public static final int KEYBOARDMODE_WEB = R.id.mode_webentry;
+    public static final int[] QWERTY_MODES = {
+            KEYBOARDMODE_NORMAL,
+            KEYBOARDMODE_URL,
+            KEYBOARDMODE_EMAIL,
+            KEYBOARDMODE_IM,
+            KEYBOARDMODE_WEB,
+            0 /* for MODE_PHONE */ };
     // Main keyboard layouts with the settings key
     public static final int KEYBOARDMODE_NORMAL_WITH_SETTINGS_KEY =
             R.id.mode_normal_with_settings_key;
@@ -55,12 +62,45 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
             R.id.mode_im_with_settings_key;
     public static final int KEYBOARDMODE_WEB_WITH_SETTINGS_KEY =
             R.id.mode_webentry_with_settings_key;
-
-    // Symbols keyboard layout without the settings key
-    public static final int KEYBOARDMODE_SYMBOLS = R.id.mode_symbols;
-    // Symbols keyboard layout with the settings key
-    public static final int KEYBOARDMODE_SYMBOLS_WITH_SETTINGS_KEY =
-            R.id.mode_symbols_with_settings_key;
+    public static final int[] QWERTY_WITH_SETTINGS_KEY_MODES = {
+            KEYBOARDMODE_NORMAL_WITH_SETTINGS_KEY,
+            KEYBOARDMODE_URL_WITH_SETTINGS_KEY,
+            KEYBOARDMODE_EMAIL_WITH_SETTINGS_KEY,
+            KEYBOARDMODE_IM_WITH_SETTINGS_KEY,
+            KEYBOARDMODE_WEB_WITH_SETTINGS_KEY,
+            0 /* for MODE_PHONE */ };
+
+    // Symbols keyboard layouts without the settings key
+    public static final int KEYBOARDMODE_SYMBOLS_NORMAL = R.id.mode_symbols_normal;
+    public static final int KEYBOARDMODE_SYMBOLS_URL = R.id.mode_symbols_url;
+    public static final int KEYBOARDMODE_SYMBOLS_EMAIL = R.id.mode_symbols_email;
+    public static final int KEYBOARDMODE_SYMBOLS_IM = R.id.mode_symbols_im;
+    public static final int KEYBOARDMODE_SYMBOLS_WEB = R.id.mode_symbols_webentry;
+    public static final int[] SYMBOLS_MODES = {
+            KEYBOARDMODE_SYMBOLS_NORMAL,
+            KEYBOARDMODE_SYMBOLS_URL,
+            KEYBOARDMODE_SYMBOLS_EMAIL,
+            KEYBOARDMODE_SYMBOLS_IM,
+            KEYBOARDMODE_SYMBOLS_WEB,
+            0 /* for MODE_PHONE */ };
+    // Symbols keyboard layouts with the settings key
+    public static final int KEYBOARDMODE_SYMBOLS_NORMAL_WITH_SETTINGS_KEY =
+            R.id.mode_symbols_normal_with_settings_key;
+    public static final int KEYBOARDMODE_SYMBOLS_URL_WITH_SETTINGS_KEY =
+            R.id.mode_symbols_url_with_settings_key;
+    public static final int KEYBOARDMODE_SYMBOLS_EMAIL_WITH_SETTINGS_KEY =
+            R.id.mode_symbols_email_with_settings_key;
+    public static final int KEYBOARDMODE_SYMBOLS_IM_WITH_SETTINGS_KEY =
+            R.id.mode_symbols_im_with_settings_key;
+    public static final int KEYBOARDMODE_SYMBOLS_WEB_WITH_SETTINGS_KEY =
+            R.id.mode_symbols_webentry_with_settings_key;
+    public static final int[] SYMBOLS_WITH_SETTINGS_KEY_MODES = {
+            KEYBOARDMODE_SYMBOLS_NORMAL_WITH_SETTINGS_KEY,
+            KEYBOARDMODE_SYMBOLS_URL_WITH_SETTINGS_KEY,
+            KEYBOARDMODE_SYMBOLS_EMAIL_WITH_SETTINGS_KEY,
+            KEYBOARDMODE_SYMBOLS_IM_WITH_SETTINGS_KEY,
+            KEYBOARDMODE_SYMBOLS_WEB_WITH_SETTINGS_KEY,
+            0 /* for MODE_PHONE */ };
 
     public static final String DEFAULT_LAYOUT_ID = "4";
     public static final String PREF_KEYBOARD_LAYOUT = "pref_keyboard_layout_20100902";
@@ -115,7 +155,6 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
     private boolean mIsAutoCompletionActive;
     private boolean mHasVoice;
     private boolean mVoiceOnPrimary;
-    private boolean mPreferSymbols;
     private int mSymbolsModeState = SYMBOLS_MODE_STATE_NONE;
 
     // Indicates whether or not we have the settings key
@@ -158,21 +197,26 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
     }
 
     private KeyboardId makeSymbolsId(boolean hasVoice) {
+        final int mode = mMode == MODE_NONE ? MODE_TEXT : mMode;
         return new KeyboardId(KBD_SYMBOLS[getCharColorId()], mHasSettingsKey ?
-                KEYBOARDMODE_SYMBOLS_WITH_SETTINGS_KEY : KEYBOARDMODE_SYMBOLS,
+                SYMBOLS_WITH_SETTINGS_KEY_MODES[mode] : SYMBOLS_MODES[mode],
                 false, hasVoice);
     }
 
     private KeyboardId makeSymbolsShiftedId(boolean hasVoice) {
+        final int mode = mMode == MODE_NONE ? MODE_TEXT : mMode;
         return new KeyboardId(KBD_SYMBOLS_SHIFT[getCharColorId()], mHasSettingsKey ?
-                KEYBOARDMODE_SYMBOLS_WITH_SETTINGS_KEY : KEYBOARDMODE_SYMBOLS,
+                SYMBOLS_WITH_SETTINGS_KEY_MODES[mode] : SYMBOLS_MODES[mode],
                 false, hasVoice);
     }
 
-    public void makeKeyboards(boolean forceCreate) {
+    private void makeSymbolsKeyboardIds() {
         mSymbolsId = makeSymbolsId(mHasVoice && !mVoiceOnPrimary);
         mSymbolsShiftedId = makeSymbolsShiftedId(mHasVoice && !mVoiceOnPrimary);
+    }
 
+    public void makeKeyboards(boolean forceCreate) {
+        makeSymbolsKeyboardIds();
         if (forceCreate) mKeyboards.clear();
         // Configuration change is coming after the keyboard gets recreated. So don't rely on that.
         // If keyboards have already been made, check if we have a screen width change and 
@@ -207,10 +251,6 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
             });
         }
 
-        public KeyboardId(int xml, boolean hasVoice) {
-            this(xml, 0, false, hasVoice);
-        }
-
         @Override
         public boolean equals(Object other) {
             return other instanceof KeyboardId && equals((KeyboardId) other);
@@ -244,14 +284,10 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
 
     public void setKeyboardMode(int mode, int imeOptions, boolean enableVoice) {
         mSymbolsModeState = SYMBOLS_MODE_STATE_NONE;
-        mPreferSymbols = mode == MODE_SYMBOLS;
-        if (mode == MODE_SYMBOLS) {
-            mode = MODE_TEXT;
-        }
         try {
-            setKeyboardMode(mode, imeOptions, enableVoice, mPreferSymbols);
+            setKeyboardMode(mode, imeOptions, enableVoice, false);
         } catch (RuntimeException e) {
-            LatinImeLogger.logOnException(mode + "," + imeOptions + "," + mPreferSymbols, e);
+            LatinImeLogger.logOnException(mode + "," + imeOptions, e);
         }
     }
 
@@ -259,8 +295,10 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
         if (mInputView == null) return;
         mMode = mode;
         mImeOptions = imeOptions;
+        makeSymbolsKeyboardIds();
         if (enableVoice != mHasVoice) {
-            setVoiceMode(mHasVoice, mVoiceOnPrimary);
+            // TODO clean up this unnecessary recursive call.
+            setVoiceMode(enableVoice, mVoiceOnPrimary);
         }
         mIsSymbols = isSymbols;
 
@@ -277,7 +315,7 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
         mInputView.setKeyboard(keyboard);
         keyboard.setShifted(false);
         keyboard.setShiftLocked(keyboard.isShiftLocked());
-        keyboard.setImeOptions(mInputMethodService.getResources(), mMode, imeOptions);
+        keyboard.setImeOptions(mInputMethodService.getResources(), mode, imeOptions);
         keyboard.setColorOfSymbolIcons(mIsAutoCompletionActive, isBlackSym());
         // Update the settings key state because number of enabled IMEs could have been changed
         updateSettingsKeyState(PreferenceManager.getDefaultSharedPreferences(mInputMethodService));
@@ -309,48 +347,31 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
     }
 
     private KeyboardId getKeyboardId(int mode, int imeOptions, boolean isSymbols) {
-        boolean hasVoice = hasVoiceButton(isSymbols);
-        int charColorId = getCharColorId();
-        // TODO: generalize for any KeyboardId
-        int keyboardRowsResId = KBD_QWERTY[charColorId];
-        if (isSymbols) {
-            if (mode == MODE_PHONE) {
-                return new KeyboardId(KBD_PHONE_SYMBOLS[charColorId], hasVoice);
-            } else {
-                return new KeyboardId(KBD_SYMBOLS[charColorId], mHasSettingsKey ?
-                        KEYBOARDMODE_SYMBOLS_WITH_SETTINGS_KEY : KEYBOARDMODE_SYMBOLS,
-                        false, hasVoice);
-            }
+        final boolean hasVoice = hasVoiceButton(isSymbols);
+        final int charColorId = getCharColorId();
+        final int keyboardRowsResId;
+        final boolean enableShiftLock;
+        final int keyboardMode;
+
+        if (mode == MODE_NONE) {
+            LatinImeLogger.logOnWarning(
+                    "getKeyboardId:" + mode + "," + imeOptions + "," + isSymbols);
+            mode = MODE_TEXT;
         }
-        switch (mode) {
-            case MODE_NONE:
-                LatinImeLogger.logOnWarning(
-                        "getKeyboardId:" + mode + "," + imeOptions + "," + isSymbols);
-                /* fall through */
-            case MODE_TEXT:
-                return new KeyboardId(keyboardRowsResId, mHasSettingsKey ?
-                        KEYBOARDMODE_NORMAL_WITH_SETTINGS_KEY : KEYBOARDMODE_NORMAL,
-                        true, hasVoice);
-            case MODE_SYMBOLS:
-                return new KeyboardId(KBD_SYMBOLS[charColorId], mHasSettingsKey ?
-                        KEYBOARDMODE_SYMBOLS_WITH_SETTINGS_KEY : KEYBOARDMODE_SYMBOLS,
-                        false, hasVoice);
-            case MODE_PHONE:
-                return new KeyboardId(KBD_PHONE[charColorId], hasVoice);
-            case MODE_URL:
-                return new KeyboardId(keyboardRowsResId, mHasSettingsKey ?
-                        KEYBOARDMODE_URL_WITH_SETTINGS_KEY : KEYBOARDMODE_URL, true, hasVoice);
-            case MODE_EMAIL:
-                return new KeyboardId(keyboardRowsResId, mHasSettingsKey ?
-                        KEYBOARDMODE_EMAIL_WITH_SETTINGS_KEY : KEYBOARDMODE_EMAIL, true, hasVoice);
-            case MODE_IM:
-                return new KeyboardId(keyboardRowsResId, mHasSettingsKey ?
-                        KEYBOARDMODE_IM_WITH_SETTINGS_KEY : KEYBOARDMODE_IM, true, hasVoice);
-            case MODE_WEB:
-                return new KeyboardId(keyboardRowsResId, mHasSettingsKey ?
-                        KEYBOARDMODE_WEB_WITH_SETTINGS_KEY : KEYBOARDMODE_WEB, true, hasVoice);
+        if (isSymbols) {
+            keyboardRowsResId = mode == MODE_PHONE
+                    ? KBD_PHONE_SYMBOLS[charColorId] : KBD_SYMBOLS[charColorId];
+            enableShiftLock = false;
+            keyboardMode = mHasSettingsKey
+                    ? SYMBOLS_WITH_SETTINGS_KEY_MODES[mode] : SYMBOLS_MODES[mode];
+        } else {  // QWERTY
+            keyboardRowsResId = mode == MODE_PHONE
+                    ? KBD_PHONE[charColorId] : KBD_QWERTY[charColorId];
+            enableShiftLock = mode == MODE_PHONE ? false : true;
+            keyboardMode = mHasSettingsKey
+                    ? QWERTY_WITH_SETTINGS_KEY_MODES[mode] : QWERTY_MODES[mode];
         }
-        return null;
+        return new KeyboardId(keyboardRowsResId, keyboardMode, enableShiftLock, hasVoice);
     }
 
     public int getKeyboardMode() {
@@ -411,7 +432,7 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
 
     public void toggleSymbols() {
         setKeyboardMode(mMode, mImeOptions, mHasVoice, !mIsSymbols);
-        if (mIsSymbols && !mPreferSymbols) {
+        if (mIsSymbols) {
             mSymbolsModeState = SYMBOLS_MODE_STATE_BEGIN;
         } else {
             mSymbolsModeState = SYMBOLS_MODE_STATE_NONE;
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index edda9e866d3f0a590113011bc56c539f29f6a9f0..bb29e63679dca29060bd8549d53d12a3741d676e 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -2333,8 +2333,8 @@ public class LatinIME extends InputMethodService
 
     private boolean shouldShowVoiceButton(FieldContext fieldContext, EditorInfo attribute) {
         return ENABLE_VOICE_BUTTON && fieldCanDoVoice(fieldContext)
-                && !(attribute != null && attribute.privateImeOptions != null
-                        && attribute.privateImeOptions.equals(IME_OPTION_NO_MICROPHONE))
+                && !(attribute != null
+                        && IME_OPTION_NO_MICROPHONE.equals(attribute.privateImeOptions))
                 && SpeechRecognizer.isRecognitionAvailable(this);
     }
 
diff --git a/java/src/com/android/inputmethod/latin/LatinKeyboard.java b/java/src/com/android/inputmethod/latin/LatinKeyboard.java
index 3ca85c5d0a8700e3f5e85411a889c00a8b7455a8..fcbada191767c77b9ff9188c7d56b25c104d226a 100644
--- a/java/src/com/android/inputmethod/latin/LatinKeyboard.java
+++ b/java/src/com/android/inputmethod/latin/LatinKeyboard.java
@@ -60,6 +60,7 @@ public class LatinKeyboard extends BaseKeyboard {
     private final Drawable mButtonArrowRightIcon;
     private Key mEnterKey;
     private Key mF1Key;
+    private final Drawable mHintIcon;
     private Key mSpaceKey;
     private Key m123Key;
     private int mSpaceKeyIndex = -1;
@@ -69,6 +70,7 @@ public class LatinKeyboard extends BaseKeyboard {
     private LanguageSwitcher mLanguageSwitcher;
     private final Resources mRes;
     private final Context mContext;
+    private int mMode;  // TODO: remove this and use the corresponding mode in the parent class
     // Whether this keyboard has voice icon on it
     private boolean mHasVoiceButton;
     // Whether voice icon is enabled at all
@@ -119,6 +121,7 @@ public class LatinKeyboard extends BaseKeyboard {
         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);
@@ -133,6 +136,7 @@ public class LatinKeyboard extends BaseKeyboard {
         mButtonArrowRightIcon = res.getDrawable(R.drawable.sym_keyboard_language_arrows_right);
         m123MicIcon = res.getDrawable(R.drawable.sym_keyboard_123_mic);
         m123MicPreviewIcon = res.getDrawable(R.drawable.sym_keyboard_feedback_123_mic);
+        mHintIcon = res.getDrawable(R.drawable.hint_popup);
         setDefaultBounds(m123MicPreviewIcon);
         sSpacebarVerticalCorrection = res.getDimensionPixelOffset(
                 R.dimen.spacebar_vertical_correction);
@@ -180,10 +184,12 @@ public class LatinKeyboard extends BaseKeyboard {
         key.text = null;
         key.iconPreview = null;
         key.icon = null;
+        key.hintIcon = null;
         key.label = label;
     }
 
     public void setImeOptions(Resources res, int mode, int options) {
+        mMode = mode;
         if (mEnterKey == null)
             return;
         switch (options & (EditorInfo.IME_MASK_ACTION | EditorInfo.IME_FLAG_NO_ENTER_ACTION)) {
@@ -292,7 +298,7 @@ public class LatinKeyboard extends BaseKeyboard {
             mMicIcon = mRes.getDrawable(R.drawable.sym_keyboard_mic);
             m123MicIcon = mRes.getDrawable(R.drawable.sym_keyboard_123_mic);
         }
-        updateF1Key();
+        updateDynamicKeys();
         if (mSpaceKey != null) {
             updateSpaceBarForLocale(isAutoCompletion, isBlack);
         }
@@ -301,11 +307,16 @@ public class LatinKeyboard extends BaseKeyboard {
     public void setVoiceMode(boolean hasVoiceButton, boolean hasVoice) {
         mHasVoiceButton = hasVoiceButton;
         mVoiceEnabled = hasVoice;
+        updateDynamicKeys();
+    }
+
+    private void updateDynamicKeys() {
+        update123Key();
         updateF1Key();
     }
 
-    private void updateF1Key() {
-        if (mF1Key == null) return;
+    private void update123Key() {
+        // Update KEYCODE_MODE_CHANGE key only on alphabet mode, not on symbol mode.
         if (m123Key != null && mIsAlphaKeyboard) {
             if (mVoiceEnabled && !mHasVoiceButton) {
                 m123Key.icon = m123MicIcon;
@@ -317,22 +328,52 @@ public class LatinKeyboard extends BaseKeyboard {
                 m123Key.label = m123Label;
             }
         }
+    }
 
-        if (mHasVoiceButton && mVoiceEnabled) {
-            mF1Key.codes = new int[] { LatinKeyboardView.KEYCODE_VOICE };
-            mF1Key.label = null;
-            mF1Key.icon = mMicIcon;
-            mF1Key.iconPreview = mMicPreviewIcon;
-            mF1Key.popupResId = R.xml.popup_mic;
-        } else {
-            mF1Key.label = ",";
-            mF1Key.codes = new int[] { ',' };
-            mF1Key.icon = null;
-            mF1Key.iconPreview = null;
-            mF1Key.popupResId = R.xml.popup_comma;
+    private void updateF1Key() {
+        // Update KEYCODE_F1 key. Please note that some keyboard layouts have no F1 key.
+        if (mF1Key == null)
+            return;
+
+        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 {
+                setNonMicF1Key(mF1Key, ",", R.xml.popup_comma);
+            }
         }
     }
 
+    private void setMicF1Key(Key key) {
+        key.label = null;
+        key.codes = new int[] { LatinKeyboardView.KEYCODE_VOICE };
+        key.popupResId = R.xml.popup_mic;
+        key.icon = mMicIcon;
+        key.hintIcon = mHintIcon;
+        key.iconPreview = mMicPreviewIcon;
+    }
+
+    private void setNonMicF1Key(Key key, String label, int popupResId) {
+        key.label = label;
+        key.codes = new int[] { label.charAt(0) };
+        key.popupResId = popupResId;
+        key.icon = null;
+        key.hintIcon = mHintIcon;
+        key.iconPreview = null;
+    }
+
     /**
      * @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 b02780bf6e79c3433b9451a967869331b945ff32..4e264e853e9c3addf03b98fe8759a56b6f34e1a1 100644
--- a/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java
+++ b/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java
@@ -57,6 +57,8 @@ import java.util.WeakHashMap;
  * A view that renders a virtual {@link LatinKeyboard}. It handles rendering of keys and
  * detecting key presses and touch movements.
  *
+ * TODO: References to LatinKeyboard in this class should be replaced with ones to its base class.
+ *
  * @attr ref R.styleable#LatinKeyboardBaseView_keyBackground
  * @attr ref R.styleable#LatinKeyboardBaseView_keyPreviewLayout
  * @attr ref R.styleable#LatinKeyboardBaseView_keyPreviewOffset
@@ -160,7 +162,7 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx
     // Miscellaneous constants
     /* package */ static final int NOT_A_KEY = -1;
     private static final int[] LONG_PRESSABLE_STATE_SET = { android.R.attr.state_long_pressable };
-    private static final int NUMBER_HINT_VERTICAL_ADJUSTMENT_PIXEL = -1;
+    private static final int HINT_ICON_VERTICAL_ADJUSTMENT_PIXEL = -1;
 
     // XML attribute
     private int mKeyTextSize;
@@ -861,32 +863,20 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx
                 // Turn off drop shadow
                 paint.setShadowLayer(0, 0, 0, 0);
             }
-            Drawable icon = null;
-            if (key.label == null && key.icon != null)
-                icon = key.icon;
-            if (icon == null && key.hintIcon != null && drawHintIcon)
-                icon = key.hintIcon;
-            if (icon != null) {
-                // Special handing for the upper-right number hint icons
-                final int drawableWidth;
-                final int drawableHeight;
-                final int drawableX;
-                final int drawableY;
-                if (icon == key.hintIcon) {
-                    drawableWidth = key.width;
-                    drawableHeight = key.height;
-                    drawableX = 0;
-                    drawableY = NUMBER_HINT_VERTICAL_ADJUSTMENT_PIXEL;
-                } else {
-                    drawableWidth = key.icon.getIntrinsicWidth();
-                    drawableHeight = key.icon.getIntrinsicHeight();
-                    drawableX = (key.width + padding.left - padding.right - drawableWidth) / 2;
-                    drawableY = (key.height + padding.top - padding.bottom - drawableHeight) / 2;
-                }
-                canvas.translate(drawableX, drawableY);
-                icon.setBounds(0, 0, drawableWidth, drawableHeight);
-                icon.draw(canvas);
-                canvas.translate(-drawableX, -drawableY);
+            if (key.label == null && key.icon != null) {
+                int drawableWidth = key.icon.getIntrinsicWidth();
+                int drawableHeight = key.icon.getIntrinsicHeight();
+                int drawableX = (key.width + padding.left - padding.right - drawableWidth) / 2;
+                int drawableY = (key.height + padding.top - padding.bottom - drawableHeight) / 2;
+                drawIcon(canvas, key.icon, drawableX, drawableY, drawableWidth, drawableHeight);
+
+            }
+            if (key.hintIcon != null && drawHintIcon) {
+                int drawableWidth = key.width;
+                int drawableHeight = key.height;
+                int drawableX = 0;
+                int drawableY = HINT_ICON_VERTICAL_ADJUSTMENT_PIXEL;
+                drawIcon(canvas, key.hintIcon, drawableX, drawableY, drawableWidth, drawableHeight);
             }
             canvas.translate(-key.x - kbdPaddingLeft, -key.y - kbdPaddingTop);
         }
@@ -920,6 +910,13 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx
         mDirtyRect.setEmpty();
     }
 
+    private void drawIcon(Canvas canvas, Drawable icon, int x, int y, int width, int height) {
+        canvas.translate(x, y);
+        icon.setBounds(0, 0, width, height);
+        icon.draw(canvas);
+        canvas.translate(-x, -y);
+    }
+
     public void setForeground(boolean foreground) {
         mInForeground = foreground;
     }
@@ -962,8 +959,7 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx
         // WindowManager.BadTokenException.
         if (key == null || !mInForeground)
             return;
-        // Should not draw number hint icons
-        if (key.icon != null && key.label == null) {
+        if (key.icon != null) {
             mPreviewText.setCompoundDrawables(null, null, null,
                     key.iconPreview != null ? key.iconPreview : key.icon);
             mPreviewText.setText(null);