Swap parenthesis-like character code on RTL keyboard

Bug: 5047217
Change-Id: I1b88484825f5c035401cf083522bf95bbee30edb
diff --git a/java/res/values/attrs.xml b/java/res/values/attrs.xml
index 4c3ea83..e503d98 100644
--- a/java/res/values/attrs.xml
+++ b/java/res/values/attrs.xml
@@ -150,6 +150,8 @@
         <attr name="popupKeyboardTemplate" format="reference" />
         <!-- Locale of the keyboard layout -->
         <attr name="keyboardLocale" format="string" />
+        <!-- True if the keyboard is Right-To-Left -->
+        <attr name="isRtlKeyboard" format="boolean" />
         <!-- Icon set for key top and key preview. -->
         <attr name="iconShiftKey" format="reference" />
         <attr name="iconToSymbolKey" format="reference" />
diff --git a/java/res/xml-ar/kbd_symbols.xml b/java/res/xml-ar/kbd_symbols.xml
new file mode 100644
index 0000000..9e5c255
--- /dev/null
+++ b/java/res/xml-ar/kbd_symbols.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+**
+** Copyright 2011, 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:isRtlKeyboard="true"
+>
+    <include
+        latin:keyboardLayout="@xml/kbd_rows_symbols" />
+</Keyboard>
diff --git a/java/res/xml-ar/kbd_symbols_shift.xml b/java/res/xml-ar/kbd_symbols_shift.xml
new file mode 100644
index 0000000..934e6f8
--- /dev/null
+++ b/java/res/xml-ar/kbd_symbols_shift.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+**
+** Copyright 2011, 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:isRtlKeyboard="true"
+>
+    <include
+        latin:keyboardLayout="@xml/kbd_rows_symbols_shift" />
+</Keyboard>
diff --git a/java/res/xml-iw/kbd_symbols.xml b/java/res/xml-iw/kbd_symbols.xml
new file mode 100644
index 0000000..9e5c255
--- /dev/null
+++ b/java/res/xml-iw/kbd_symbols.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+**
+** Copyright 2011, 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:isRtlKeyboard="true"
+>
+    <include
+        latin:keyboardLayout="@xml/kbd_rows_symbols" />
+</Keyboard>
diff --git a/java/res/xml-iw/kbd_symbols_shift.xml b/java/res/xml-iw/kbd_symbols_shift.xml
new file mode 100644
index 0000000..934e6f8
--- /dev/null
+++ b/java/res/xml-iw/kbd_symbols_shift.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+**
+** Copyright 2011, 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:isRtlKeyboard="true"
+>
+    <include
+        latin:keyboardLayout="@xml/kbd_rows_symbols_shift" />
+</Keyboard>
diff --git a/java/res/xml-sw600dp/kbd_symbols.xml b/java/res/xml-sw600dp/kbd_rows_symbols.xml
similarity index 99%
rename from java/res/xml-sw600dp/kbd_symbols.xml
rename to java/res/xml-sw600dp/kbd_rows_symbols.xml
index fc89cd3..9982f45 100644
--- a/java/res/xml-sw600dp/kbd_symbols.xml
+++ b/java/res/xml-sw600dp/kbd_rows_symbols.xml
@@ -18,7 +18,7 @@
 */
 -->
 
-<Keyboard
+<merge
     xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
 >
     <include
@@ -170,4 +170,4 @@
         <include
             latin:keyboardLayout="@xml/kbd_qwerty_f2" />
     </Row>
-</Keyboard>
+</merge>
diff --git a/java/res/xml-sw600dp/kbd_symbols_shift.xml b/java/res/xml-sw600dp/kbd_rows_symbols_shift.xml
similarity index 99%
rename from java/res/xml-sw600dp/kbd_symbols_shift.xml
rename to java/res/xml-sw600dp/kbd_rows_symbols_shift.xml
index 99b78a4..ac4b93f 100644
--- a/java/res/xml-sw600dp/kbd_symbols_shift.xml
+++ b/java/res/xml-sw600dp/kbd_rows_symbols_shift.xml
@@ -18,7 +18,7 @@
 */
 -->
 
-<Keyboard
+<merge
     xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
 >
     <include
@@ -147,4 +147,4 @@
         <include
             latin:keyboardLayout="@xml/kbd_qwerty_f2" />
     </Row>
-</Keyboard>
+</merge>
diff --git a/java/res/xml-sw768dp/kbd_symbols.xml b/java/res/xml-sw768dp/kbd_rows_symbols.xml
similarity index 98%
rename from java/res/xml-sw768dp/kbd_symbols.xml
rename to java/res/xml-sw768dp/kbd_rows_symbols.xml
index ba0715c..1d5bd9d 100644
--- a/java/res/xml-sw768dp/kbd_symbols.xml
+++ b/java/res/xml-sw768dp/kbd_rows_symbols.xml
@@ -2,7 +2,7 @@
 <!--
 /*
 **
-** Copyright 2010, The Android Open Source Project
+** Copyright 2011, 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.
@@ -18,7 +18,7 @@
 */
 -->
 
-<Keyboard
+<merge
     xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
 >
     <include
@@ -189,4 +189,4 @@
             </case>
         </switch>
     </Row>
-</Keyboard>
+</merge>
diff --git a/java/res/xml-sw768dp/kbd_symbols_shift.xml b/java/res/xml-sw768dp/kbd_rows_symbols_shift.xml
similarity index 98%
rename from java/res/xml-sw768dp/kbd_symbols_shift.xml
rename to java/res/xml-sw768dp/kbd_rows_symbols_shift.xml
index 1ddd64b..2219bdc 100644
--- a/java/res/xml-sw768dp/kbd_symbols_shift.xml
+++ b/java/res/xml-sw768dp/kbd_rows_symbols_shift.xml
@@ -2,7 +2,7 @@
 <!--
 /*
 **
-** Copyright 2010, The Android Open Source Project
+** Copyright 2011, 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.
@@ -18,7 +18,7 @@
 */
 -->
 
-<Keyboard
+<merge
     xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
 >
     <include
@@ -164,4 +164,4 @@
             </case>
         </switch>
     </Row>
-</Keyboard>
+</merge>
diff --git a/java/res/xml-sw600dp/kbd_symbols.xml b/java/res/xml/kbd_rows_symbols.xml
similarity index 64%
copy from java/res/xml-sw600dp/kbd_symbols.xml
copy to java/res/xml/kbd_rows_symbols.xml
index fc89cd3..a8eeb3b 100644
--- a/java/res/xml-sw600dp/kbd_symbols.xml
+++ b/java/res/xml/kbd_rows_symbols.xml
@@ -18,7 +18,7 @@
 */
 -->
 
-<Keyboard
+<merge
     xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
 >
     <include
@@ -26,7 +26,7 @@
     <include
         latin:keyboardLayout="@xml/kbd_currency_key_styles" />
     <Row
-        latin:keyWidth="9.0%p"
+        latin:keyWidth="10%p"
     >
         <Key
             latin:keyLabel="@string/keylabel_for_symbols_1"
@@ -57,18 +57,16 @@
             latin:popupCharacters="@string/alternates_for_symbols_9" />
         <Key
             latin:keyLabel="@string/keylabel_for_symbols_0"
-            latin:popupCharacters="@string/alternates_for_symbols_0" />
-        <Key
-            latin:keyStyle="deleteKeyStyle"
-            latin:keyXPos="-10.0%p"
-            latin:keyWidth="fillBoth" />
+            latin:popupCharacters="@string/alternates_for_symbols_0"
+            latin:keyWidth="fillRight" />
     </Row>
     <Row
-        latin:keyWidth="9.0%p"
+        latin:keyWidth="10%p"
     >
         <Key
-            latin:keyLabel="#"
-            latin:keyXPos="4.5%p" />
+            latin:keyLabel="\@" />
+        <Key
+            latin:keyLabel="\#" />
         <Key
             latin:keyStyle="currencyKeyStyle" />
         <Key
@@ -90,84 +88,43 @@
             latin:popupCharacters="[,{,&lt;" />
         <Key
             latin:keyLabel=")"
-            latin:popupCharacters="],},&gt;" />
-        <Key
-            latin:keyStyle="returnKeyStyle"
-            latin:keyXPos="-14.6%p"
-            latin:keyWidth="fillBoth" />
+            latin:popupCharacters="],},&gt;"
+            latin:keyWidth="fillRight" />
     </Row>
     <Row
-        latin:keyWidth="8.9%p"
+        latin:keyWidth="10%p"
     >
         <Key
-            latin:keyStyle="moreKeyStyle"
-            latin:keyWidth="10.0%p" />
+            latin:keyStyle="altKeyStyle"
+            latin:keyWidth="15%p"
+            latin:visualInsetsRight="1%p" />
         <Key
-            latin:keyLabel="&lt;"
-            latin:popupCharacters="≤,«,‹" />
+            latin:keyLabel="!"
+            latin:popupCharacters="¡" />
+        <!-- Note: DroidSans doesn't have double-high-reversed-quotation '\u201f' glyph. -->
+        <!-- latin:popupCharacters="“,”,„,‟,«,»" -->
         <Key
-            latin:keyLabel="&gt;"
-            latin:popupCharacters="≥,»,›" />
+            latin:keyLabel="&quot;"
+            latin:popupCharacters="“,”,«,»"
+            latin:maxPopupKeyboardColumn="6" />
         <Key
-            latin:keyLabel="="
-            latin:popupCharacters="≠,≈" />
-        <switch>
-            <case
-                latin:mode="url"
-            >
-                <Key
-                    latin:keyLabel="\'"
-                    latin:popupCharacters="‘,’,‚,‛" />
-            </case>
-            <default>
-                <Key
-                    latin:keyLabel=":" />
-            </default>
-        </switch>
+            latin:keyLabel="\'"
+            latin:popupCharacters="‘,’,‚,‛" />
+        <Key
+            latin:keyLabel=":" />
         <Key
             latin:keyLabel="@string/keylabel_for_symbols_semicolon"
             latin:popupCharacters="@string/alternates_for_symbols_semicolon" />
         <Key
-            latin:keyLabel="@string/keylabel_for_symbols_comma"
-            latin:popupCharacters="@string/alternates_for_symbols_comma" />
-        <Key
-            latin:keyLabel="." />
-        <Key
-            latin:keyLabel="!"
-            latin:popupCharacters="¡" />
+            latin:keyLabel="/" />
         <Key
             latin:keyLabel="@string/keylabel_for_symbols_question"
             latin:popupCharacters="@string/alternates_for_symbols_question" />
         <Key
-            latin:keyLabel="/"
-            latin:keyWidth="fillRight" />
+            latin:keyStyle="deleteKeyStyle"
+            latin:keyWidth="fillRight"
+            latin:visualInsetsLeft="1%p" />
     </Row>
-    <Row
-        latin:keyWidth="8.9%p"
-    >
-        <Key
-            latin:keyStyle="toAlphaKeyStyle"
-            latin:keyLabelOption="alignLeft"
-            latin:keyWidth="13.0%p" />
-        <Key
-            latin:keyStyle="tabKeyStyle" />
-        <Key
-            latin:keyLabel="\@" />
-        <Key
-            latin:keyStyle="spaceKeyStyle"
-            latin:keyXPos="30.750%p"
-            latin:keyWidth="39.750%p" />
-        <!-- Note: DroidSans doesn't have double-high-reversed-quotation '\u201f' glyph. -->
-        <!-- latin:popupCharacters="“,”,„,‟,«,»,‘,’,‚,‛" -->
-        <Key
-            latin:keyLabel="&quot;"
-            latin:popupCharacters="“,”,«,»,‘,’,‚,‛" />
-        <Key
-            latin:keyLabel="_" />
-        <Spacer
-            latin:keyXPos="-10.00%p"
-            latin:keyWidth="0%p" />
-        <include
-            latin:keyboardLayout="@xml/kbd_qwerty_f2" />
-    </Row>
-</Keyboard>
+    <include
+        latin:keyboardLayout="@xml/kbd_symbols_row4" />
+</merge>
diff --git a/java/res/xml-sw600dp/kbd_symbols_shift.xml b/java/res/xml/kbd_rows_symbols_shift.xml
similarity index 60%
copy from java/res/xml-sw600dp/kbd_symbols_shift.xml
copy to java/res/xml/kbd_rows_symbols_shift.xml
index 99b78a4..0706cbc 100644
--- a/java/res/xml-sw600dp/kbd_symbols_shift.xml
+++ b/java/res/xml/kbd_rows_symbols_shift.xml
@@ -2,7 +2,7 @@
 <!--
 /*
 **
-** Copyright 2011, The Android Open Source Project
+** Copyright 2008, 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.
@@ -18,13 +18,13 @@
 */
 -->
 
-<Keyboard
+<merge
     xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
 >
     <include
         latin:keyboardLayout="@xml/kbd_key_styles" />
     <Row
-        latin:keyWidth="9.0%p"
+        latin:keyWidth="10%p"
     >
         <Key
             latin:keyLabel="~" />
@@ -50,24 +50,19 @@
             latin:keyStyle="nonPasswordSymbolKeyStyle"
             latin:keyLabel="×" />
         <Key
-            latin:keyStyle="nonPasswordSymbolKeyStyle"
-            latin:keyLabel="§"
-            latin:popupCharacters="¶" />
+            latin:keyLabel="{" />
         <Key
-            latin:keyStyle="nonPasswordSymbolKeyStyle"
-            latin:keyLabel="Δ" />
-        <Key
-            latin:keyStyle="deleteKeyStyle"
-            latin:keyXPos="-10.0%p"
-            latin:keyWidth="fillBoth" />
+            latin:keyLabel="}"
+            latin:keyWidth="fillRight" />
     </Row>
     <Row
-        latin:keyWidth="9.0%p"
+        latin:keyWidth="10%p"
     >
         <Key
+            latin:keyStyle="nonSpecialBackgroundTabKeyStyle" />
+        <Key
             latin:keyStyle="nonPasswordSymbolKeyStyle"
-            latin:keyLabel="£"
-            latin:keyXPos="4.5%p" />
+            latin:keyLabel="£" />
         <Key
             latin:keyStyle="nonPasswordSymbolKeyStyle"
             latin:keyLabel="¢" />
@@ -76,75 +71,55 @@
             latin:keyLabel="€" />
         <Key
             latin:keyStyle="nonPasswordSymbolKeyStyle"
-            latin:keyLabel="¥" />
+            latin:keyLabel="°"
+            latin:popupCharacters="′,″" />
         <Key
             latin:keyLabel="^"
             latin:popupCharacters="↑,↓,←,→" />
         <Key
-            latin:keyStyle="nonPasswordSymbolKeyStyle"
-            latin:keyLabel="°"
-            latin:popupCharacters="′,″" />
+            latin:keyLabel="_" />
         <Key
-            latin:keyStyle="nonPasswordSymbolKeyStyle"
-            latin:keyLabel="±"
-            latin:popupCharacters="∞" />
+            latin:keyLabel="="
+            latin:popupCharacters="≠,≈,∞" />
         <Key
-            latin:keyLabel="{" />
+            latin:keyLabel="[" />
         <Key
-            latin:keyLabel="}" />
-        <Key
-            latin:keyStyle="returnKeyStyle"
-            latin:keyXPos="-14.6%p"
-            latin:keyWidth="fillBoth" />
+            latin:keyLabel="]"
+            latin:keyWidth="fillRight" />
     </Row>
     <Row
-        latin:keyWidth="8.9%p"
+        latin:keyWidth="10%p"
     >
         <Key
-            latin:keyStyle="moreKeyStyle"
-            latin:keyWidth="10.0%p" />
-        <Key
-            latin:keyLabel="\\" />
-        <Key
-            latin:keyStyle="nonPasswordSymbolKeyStyle"
-            latin:keyLabel="©" />
-        <Key
-            latin:keyStyle="nonPasswordSymbolKeyStyle"
-            latin:keyLabel="®" />
+            latin:keyStyle="altKeyStyle"
+            latin:keyWidth="15%p"
+            latin:visualInsetsRight="1%p" />
         <Key
             latin:keyStyle="nonPasswordSymbolKeyStyle"
             latin:keyLabel="™" />
         <Key
             latin:keyStyle="nonPasswordSymbolKeyStyle"
-            latin:keyLabel="℅" />
-        <Key
-            latin:keyLabel="[" />
-        <Key
-            latin:keyLabel="]" />
+            latin:keyLabel="®" />
         <Key
             latin:keyStyle="nonPasswordSymbolKeyStyle"
-            latin:keyLabel="¡" />
+            latin:keyLabel="©" />
         <Key
             latin:keyStyle="nonPasswordSymbolKeyStyle"
-            latin:keyLabel="¿" />
+            latin:keyLabel="¶"
+            latin:popupCharacters="§" />
+        <Key
+            latin:keyLabel="\\" />
+        <Key
+            latin:keyLabel="&lt;"
+            latin:popupCharacters="≤,«,‹" />
+        <Key
+            latin:keyLabel="&gt;"
+            latin:popupCharacters="≥,»,›" />
+        <Key
+            latin:keyStyle="deleteKeyStyle"
+            latin:keyWidth="fillRight"
+            latin:visualInsetsLeft="1%p" />
     </Row>
-    <Row
-        latin:keyWidth="8.9%p"
-    >
-        <Key
-            latin:keyStyle="toAlphaKeyStyle"
-            latin:keyLabelOption="alignLeft"
-            latin:keyWidth="13.0%p" />
-        <Key
-            latin:keyStyle="tabKeyStyle" />
-        <Key
-            latin:keyStyle="spaceKeyStyle"
-            latin:keyXPos="30.750%p"
-            latin:keyWidth="39.750%p" />
-        <Spacer
-            latin:keyXPos="-10.00%p"
-            latin:keyWidth="0%p" />
-        <include
-            latin:keyboardLayout="@xml/kbd_qwerty_f2" />
-    </Row>
-</Keyboard>
+    <include
+        latin:keyboardLayout="@xml/kbd_symbols_shift_row4" />
+</merge>
diff --git a/java/res/xml/kbd_symbols.xml b/java/res/xml/kbd_symbols.xml
index 7bb8d02..737f684 100644
--- a/java/res/xml/kbd_symbols.xml
+++ b/java/res/xml/kbd_symbols.xml
@@ -1,125 +1,26 @@
 <?xml version="1.0" encoding="utf-8"?>
 <!--
-/* 
+/*
 **
 ** Copyright 2008, 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 
+** 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 
+**     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 
+** 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"
 >
     <include
-        latin:keyboardLayout="@xml/kbd_key_styles" />
-    <include
-        latin:keyboardLayout="@xml/kbd_currency_key_styles" />
-    <Row>
-        <Key
-            latin:keyLabel="@string/keylabel_for_symbols_1"
-            latin:popupCharacters="@string/alternates_for_symbols_1" />
-        <Key
-            latin:keyLabel="@string/keylabel_for_symbols_2"
-            latin:popupCharacters="@string/alternates_for_symbols_2" />
-        <Key
-            latin:keyLabel="@string/keylabel_for_symbols_3"
-            latin:popupCharacters="@string/alternates_for_symbols_3" />
-        <Key
-            latin:keyLabel="@string/keylabel_for_symbols_4"
-            latin:popupCharacters="@string/alternates_for_symbols_4" />
-        <Key
-            latin:keyLabel="@string/keylabel_for_symbols_5"
-            latin:popupCharacters="@string/alternates_for_symbols_5" />
-        <Key
-            latin:keyLabel="@string/keylabel_for_symbols_6"
-            latin:popupCharacters="@string/alternates_for_symbols_6" />
-        <Key
-            latin:keyLabel="@string/keylabel_for_symbols_7"
-            latin:popupCharacters="@string/alternates_for_symbols_7" />
-        <Key
-            latin:keyLabel="@string/keylabel_for_symbols_8"
-            latin:popupCharacters="@string/alternates_for_symbols_8" />
-        <Key
-            latin:keyLabel="@string/keylabel_for_symbols_9"
-            latin:popupCharacters="@string/alternates_for_symbols_9" />
-        <Key
-            latin:keyLabel="@string/keylabel_for_symbols_0"
-            latin:popupCharacters="@string/alternates_for_symbols_0"
-            latin:keyWidth="fillRight" />
-    </Row>
-    <Row>
-        <Key
-            latin:keyLabel="\@" />
-        <Key
-            latin:keyLabel="\#" />
-        <Key
-            latin:keyStyle="currencyKeyStyle" />
-        <Key
-            latin:keyLabel="@string/keylabel_for_symbols_percent"
-            latin:popupCharacters="@string/alternates_for_symbols_percent" />
-        <Key
-            latin:keyLabel="&amp;" />
-        <Key
-            latin:keyLabel="*"
-            latin:popupCharacters="†,‡,★" />
-        <Key
-            latin:keyLabel="-"
-            latin:popupCharacters="_,–,—" />
-        <Key
-            latin:keyLabel="+"
-            latin:popupCharacters="±" />
-        <Key
-            latin:keyLabel="("
-            latin:popupCharacters="[,{,&lt;" />
-        <Key
-            latin:keyLabel=")"
-            latin:popupCharacters="],},&gt;"
-            latin:keyWidth="fillRight" />
-    </Row>
-    <Row>
-        <Key
-            latin:keyStyle="altKeyStyle"
-            latin:keyWidth="15%p"
-            latin:visualInsetsRight="1%p" />
-        <Key
-            latin:keyLabel="!"
-            latin:popupCharacters="¡" />
-        <!-- Note: DroidSans doesn't have double-high-reversed-quotation '\u201f' glyph. -->
-        <!-- latin:popupCharacters="“,”,„,‟,«,»" -->
-        <Key
-            latin:keyLabel="&quot;"
-            latin:popupCharacters="“,”,«,»"
-            latin:maxPopupKeyboardColumn="6" />
-        <Key
-            latin:keyLabel="\'"
-            latin:popupCharacters="‘,’,‚,‛" />
-        <Key
-            latin:keyLabel=":" />
-        <Key
-            latin:keyLabel="@string/keylabel_for_symbols_semicolon"
-            latin:popupCharacters="@string/alternates_for_symbols_semicolon" />
-        <Key
-            latin:keyLabel="/" />
-        <Key
-            latin:keyLabel="@string/keylabel_for_symbols_question"
-            latin:popupCharacters="@string/alternates_for_symbols_question" />
-        <Key
-            latin:keyStyle="deleteKeyStyle"
-            latin:keyWidth="fillRight"
-            latin:visualInsetsLeft="1%p" />
-    </Row>
-    <include
-        latin:keyboardLayout="@xml/kbd_symbols_row4" />
+        latin:keyboardLayout="@xml/kbd_rows_symbols" />
 </Keyboard>
diff --git a/java/res/xml/kbd_symbols_shift.xml b/java/res/xml/kbd_symbols_shift.xml
index 61fbec2..9c163d6 100644
--- a/java/res/xml/kbd_symbols_shift.xml
+++ b/java/res/xml/kbd_symbols_shift.xml
@@ -1,119 +1,26 @@
 <?xml version="1.0" encoding="utf-8"?>
 <!--
-/* 
+/*
 **
 ** Copyright 2008, 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 
+** 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 
+**     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 
+** 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"
 >
     <include
-        latin:keyboardLayout="@xml/kbd_key_styles" />
-    <Row>
-        <Key
-            latin:keyLabel="~" />
-        <Key
-            latin:keyLabel="`" />
-        <Key
-            latin:keyLabel="|" />
-        <Key
-            latin:keyStyle="nonPasswordSymbolKeyStyle"
-            latin:keyLabel="•"
-            latin:popupCharacters="♪,♥,♠,♦,♣" />
-        <Key
-            latin:keyStyle="nonPasswordSymbolKeyStyle"
-            latin:keyLabel="√" />
-        <Key
-            latin:keyStyle="nonPasswordSymbolKeyStyle"
-            latin:keyLabel="π"
-            latin:popupCharacters="Π" />
-        <Key
-            latin:keyStyle="nonPasswordSymbolKeyStyle"
-            latin:keyLabel="÷" />
-        <Key
-            latin:keyStyle="nonPasswordSymbolKeyStyle"
-            latin:keyLabel="×" />
-        <Key
-            latin:keyLabel="{" />
-        <Key
-            latin:keyLabel="}"
-            latin:keyWidth="fillRight" />
-    </Row>
-    <Row>
-        <Key
-            latin:keyStyle="nonSpecialBackgroundTabKeyStyle" />
-        <Key
-            latin:keyStyle="nonPasswordSymbolKeyStyle"
-            latin:keyLabel="£" />
-        <Key
-            latin:keyStyle="nonPasswordSymbolKeyStyle"
-            latin:keyLabel="¢" />
-        <Key
-            latin:keyStyle="nonPasswordSymbolKeyStyle"
-            latin:keyLabel="€" />
-        <Key
-            latin:keyStyle="nonPasswordSymbolKeyStyle"
-            latin:keyLabel="°"
-            latin:popupCharacters="′,″" />
-        <Key
-            latin:keyLabel="^"
-            latin:popupCharacters="↑,↓,←,→" />
-        <Key
-            latin:keyLabel="_" />
-        <Key
-            latin:keyLabel="="
-            latin:popupCharacters="≠,≈,∞" />
-        <Key
-            latin:keyLabel="[" />
-        <Key
-            latin:keyLabel="]"
-            latin:keyWidth="fillRight" />
-    </Row>
-    <Row>
-        <Key
-            latin:keyStyle="altKeyStyle"
-            latin:keyWidth="15%p"
-            latin:visualInsetsRight="1%p" />
-        <Key
-            latin:keyStyle="nonPasswordSymbolKeyStyle"
-            latin:keyLabel="™" />
-        <Key
-            latin:keyStyle="nonPasswordSymbolKeyStyle"
-            latin:keyLabel="®" />
-        <Key
-            latin:keyStyle="nonPasswordSymbolKeyStyle"
-            latin:keyLabel="©" />
-        <Key
-            latin:keyStyle="nonPasswordSymbolKeyStyle"
-            latin:keyLabel="¶"
-            latin:popupCharacters="§" />
-        <Key
-            latin:keyLabel="\\" />
-        <Key
-            latin:keyLabel="&lt;"
-            latin:popupCharacters="≤,«,‹" />
-        <Key
-            latin:keyLabel="&gt;"
-            latin:popupCharacters="≥,»,›" />
-        <Key
-            latin:keyStyle="deleteKeyStyle"
-            latin:keyWidth="fillRight"
-            latin:visualInsetsLeft="1%p" />
-    </Row>
-    <include latin:keyboardLayout="@xml/kbd_symbols_shift_row4" />
+        latin:keyboardLayout="@xml/kbd_rows_symbols_shift" />
 </Keyboard>