Modularize keyboard XML files

* Remove duplicated xml-sw768dp/keys_apostrophe_dash.xml
* Separate keys_apostrophe_dash.xml to key_apostorhe.xml and
  key_dash.ml
* Separate key_space.xml from row_qwerty4.xml
* Separate key_f1.xml from xml{,-sw600dp}/row_qwerty4.xml
* Separate keys_f1f2.xml from xml-sw768dp/row_qwerty4.xml
* Fix incorrectly named rows_symbols{,_shift}4.xml to
  row_symbols{,_shift}4.xml

Change-Id: Id71967a016a348174d1fc265b654dbc233c6562e
diff --git a/java/res/xml-sw600dp/kbd_azerty_symbols.xml b/java/res/xml-sw600dp/kbd_10_10_7_symbols.xml
similarity index 100%
rename from java/res/xml-sw600dp/kbd_azerty_symbols.xml
rename to java/res/xml-sw600dp/kbd_10_10_7_symbols.xml
diff --git a/java/res/xml-sw600dp/kbd_azerty_symbols_shift.xml b/java/res/xml-sw600dp/kbd_10_10_7_symbols_shift.xml
similarity index 100%
rename from java/res/xml-sw600dp/kbd_azerty_symbols_shift.xml
rename to java/res/xml-sw600dp/kbd_10_10_7_symbols_shift.xml
diff --git a/java/res/xml-sw600dp/kbd_hebrew_symbols.xml b/java/res/xml-sw600dp/kbd_hebrew_symbols.xml
deleted file mode 100644
index 66254de..0000000
--- a/java/res/xml-sw600dp/kbd_hebrew_symbols.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-**
-** Copyright 2012, 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"
->
-    <include
-        latin:keyboardLayout="@xml/rows_10_10_7_symbols" />
-</Keyboard>
diff --git a/java/res/xml-sw600dp/kbd_hebrew_symbols_shift.xml b/java/res/xml-sw600dp/kbd_hebrew_symbols_shift.xml
deleted file mode 100644
index 3c5ed5e..0000000
--- a/java/res/xml-sw600dp/kbd_hebrew_symbols_shift.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-**
-** Copyright 2012, 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"
->
-    <include
-        latin:keyboardLayout="@xml/rows_10_10_7_symbols_shift" />
-</Keyboard>
diff --git a/java/res/xml-sw600dp/kbd_spanish_symbols.xml b/java/res/xml-sw600dp/kbd_spanish_symbols.xml
deleted file mode 100644
index 66254de..0000000
--- a/java/res/xml-sw600dp/kbd_spanish_symbols.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-**
-** Copyright 2012, 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"
->
-    <include
-        latin:keyboardLayout="@xml/rows_10_10_7_symbols" />
-</Keyboard>
diff --git a/java/res/xml-sw600dp/kbd_spanish_symbols_shift.xml b/java/res/xml-sw600dp/kbd_spanish_symbols_shift.xml
deleted file mode 100644
index 3c5ed5e..0000000
--- a/java/res/xml-sw600dp/kbd_spanish_symbols_shift.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-**
-** Copyright 2012, 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"
->
-    <include
-        latin:keyboardLayout="@xml/rows_10_10_7_symbols_shift" />
-</Keyboard>
diff --git a/java/res/xml-sw600dp/keys_apostrophe_dash.xml b/java/res/xml-sw600dp/key_apostrophe.xml
similarity index 74%
rename from java/res/xml-sw600dp/keys_apostrophe_dash.xml
rename to java/res/xml-sw600dp/key_apostrophe.xml
index badc6e5..7da4b62 100644
--- a/java/res/xml-sw600dp/keys_apostrophe_dash.xml
+++ b/java/res/xml-sw600dp/key_apostrophe.xml
@@ -2,7 +2,7 @@
 <!--
 /*
 **
-** Copyright 2011, The Android Open Source Project
+** Copyright 2012, 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.
@@ -45,19 +45,4 @@
                 latin:keyStyle="hasShiftedLetterHintStyle" />
         </default>
     </switch>
-    <switch>
-        <case
-            latin:mode="email"
-        >
-            <Key
-                latin:keyLabel="_" />
-        </case>
-        <default>
-            <Key
-                latin:keyLabel="!text/keylabel_for_dash"
-                latin:keyHintLabel="!text/keyhintlabel_for_dash"
-                latin:moreKeys="!text/more_keys_for_dash"
-                latin:keyStyle="hasShiftedLetterHintStyle" />
-        </default>
-    </switch>
 </merge>
diff --git a/java/res/xml/kbd_hebrew_symbols.xml b/java/res/xml-sw600dp/key_dash.xml
similarity index 61%
rename from java/res/xml/kbd_hebrew_symbols.xml
rename to java/res/xml-sw600dp/key_dash.xml
index 7e075df..a7c3727 100644
--- a/java/res/xml/kbd_hebrew_symbols.xml
+++ b/java/res/xml-sw600dp/key_dash.xml
@@ -18,9 +18,22 @@
 */
 -->
 
-<Keyboard
+<merge
     xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
 >
-    <include
-        latin:keyboardLayout="@xml/rows_symbols" />
-</Keyboard>
+    <switch>
+        <case
+            latin:mode="email"
+        >
+            <Key
+                latin:keyLabel="_" />
+        </case>
+        <default>
+            <Key
+                latin:keyLabel="!text/keylabel_for_dash"
+                latin:keyHintLabel="!text/keyhintlabel_for_dash"
+                latin:moreKeys="!text/more_keys_for_dash"
+                latin:keyStyle="hasShiftedLetterHintStyle" />
+        </default>
+    </switch>
+</merge>
diff --git a/java/res/xml-sw600dp/key_f1.xml b/java/res/xml-sw600dp/key_f1.xml
new file mode 100644
index 0000000..e477d37
--- /dev/null
+++ b/java/res/xml-sw600dp/key_f1.xml
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+**
+** Copyright 2012, 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"
+>
+    <switch>
+        <case
+            latin:mode="email"
+        >
+            <Key
+                latin:keyStyle="comKeyStyle" />
+        </case>
+        <case
+            latin:mode="url"
+        >
+            <Key
+                latin:keyStyle="comKeyStyle" />
+        </case>
+        <default>
+            <Key
+                latin:keyLabel="/"
+                latin:keyHintLabel="\@"
+                latin:moreKeys="\@"
+                latin:keyStyle="hasShiftedLetterHintStyle" />
+        </default>
+    </switch>
+</merge>
diff --git a/java/res/xml-sw600dp/key_space.xml b/java/res/xml-sw600dp/key_space.xml
new file mode 100644
index 0000000..41f0dbd
--- /dev/null
+++ b/java/res/xml-sw600dp/key_space.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+**
+** Copyright 2012, 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"
+>
+    <switch>
+        <case
+            latin:languageCode="fa"
+        >
+            <Key
+                latin:keyStyle="spaceKeyStyle"
+                latin:keyXPos="30.750%p"
+                latin:keyWidth="30.850%p" />
+            <Key
+                latin:keyStyle="zwnjKeyStyle" />
+        </case>
+        <default>
+            <Key
+                latin:keyStyle="spaceKeyStyle"
+                latin:keyXPos="30.750%p"
+                latin:keyWidth="39.750%p" />
+        </default>
+    </switch>
+</merge>
diff --git a/java/res/xml-sw600dp/row_qwerty4.xml b/java/res/xml-sw600dp/row_qwerty4.xml
index eec35b0..95b328b 100644
--- a/java/res/xml-sw600dp/row_qwerty4.xml
+++ b/java/res/xml-sw600dp/row_qwerty4.xml
@@ -29,45 +29,10 @@
             latin:keyWidth="13.0%p" />
         <Key
             latin:keyStyle="tabKeyStyle" />
-        <switch>
-            <case
-                latin:mode="email"
-            >
-                <Key
-                    latin:keyStyle="comKeyStyle" />
-            </case>
-            <case
-                latin:mode="url"
-            >
-                <Key
-                    latin:keyStyle="comKeyStyle" />
-            </case>
-            <default>
-                <Key
-                    latin:keyLabel="/"
-                    latin:keyHintLabel="\@"
-                    latin:moreKeys="\@"
-                    latin:keyStyle="hasShiftedLetterHintStyle" />
-            </default>
-        </switch>
-        <switch>
-            <case
-                latin:languageCode="fa"
-            >
-                <Key
-                    latin:keyStyle="spaceKeyStyle"
-                    latin:keyXPos="30.750%p"
-                    latin:keyWidth="30.850%p" />
-                <Key
-                    latin:keyStyle="zwnjKeyStyle" />
-            </case>
-            <default>
-                <Key
-                    latin:keyStyle="spaceKeyStyle"
-                    latin:keyXPos="30.750%p"
-                    latin:keyWidth="39.750%p" />
-            </default>
-        </switch>
+        <include
+            latin:keyboardLayout="@xml/key_f1" />
+        <include
+            latin:keyboardLayout="@xml/key_space" />
         <switch>
             <case
                 latin:languageCode="iw"
@@ -78,7 +43,9 @@
             <!-- not languageCode="iw" -->
             <default>
                 <include
-                    latin:keyboardLayout="@xml/keys_apostrophe_dash" />
+                    latin:keyboardLayout="@xml/key_apostrophe" />
+                <include
+                    latin:keyboardLayout="@xml/key_dash" />
             </default>
         </switch>
         <Spacer
diff --git a/java/res/xml-sw600dp/rows_symbols4.xml b/java/res/xml-sw600dp/row_symbols4.xml
similarity index 100%
rename from java/res/xml-sw600dp/rows_symbols4.xml
rename to java/res/xml-sw600dp/row_symbols4.xml
diff --git a/java/res/xml-sw600dp/rows_symbols_shift4.xml b/java/res/xml-sw600dp/row_symbols_shift4.xml
similarity index 100%
rename from java/res/xml-sw600dp/rows_symbols_shift4.xml
rename to java/res/xml-sw600dp/row_symbols_shift4.xml
diff --git a/java/res/xml-sw600dp/rows_10_10_7_symbols.xml b/java/res/xml-sw600dp/rows_10_10_7_symbols.xml
index bdb1aa0..fe9f2fb 100644
--- a/java/res/xml-sw600dp/rows_10_10_7_symbols.xml
+++ b/java/res/xml-sw600dp/rows_10_10_7_symbols.xml
@@ -58,5 +58,5 @@
             latin:keyWidth="fillRight" />
     </Row>
     <include
-        latin:keyboardLayout="@xml/rows_symbols4" />
+        latin:keyboardLayout="@xml/row_symbols4" />
 </merge>
diff --git a/java/res/xml-sw600dp/rows_10_10_7_symbols_shift.xml b/java/res/xml-sw600dp/rows_10_10_7_symbols_shift.xml
index 1014934..9df1121 100644
--- a/java/res/xml-sw600dp/rows_10_10_7_symbols_shift.xml
+++ b/java/res/xml-sw600dp/rows_10_10_7_symbols_shift.xml
@@ -54,5 +54,5 @@
             latin:keyboardLayout="@xml/rowkeys_symbols_shift3" />
     </Row>
     <include
-        latin:keyboardLayout="@xml/rows_symbols_shift4" />
+        latin:keyboardLayout="@xml/row_symbols_shift4" />
 </merge>
diff --git a/java/res/xml-sw600dp/rows_hebrew.xml b/java/res/xml-sw600dp/rows_hebrew.xml
index a60da3a..d6861e8 100644
--- a/java/res/xml-sw600dp/rows_hebrew.xml
+++ b/java/res/xml-sw600dp/rows_hebrew.xml
@@ -27,7 +27,9 @@
         latin:keyWidth="8.5%p"
     >
         <include
-            latin:keyboardLayout="@xml/keys_apostrophe_dash" />
+            latin:keyboardLayout="@xml/key_apostrophe" />
+        <include
+            latin:keyboardLayout="@xml/key_dash" />
         <include
             latin:keyboardLayout="@xml/rowkeys_hebrew1" />
         <Key
diff --git a/java/res/xml-sw600dp/rows_symbols.xml b/java/res/xml-sw600dp/rows_symbols.xml
index ea9b302..ada22df 100644
--- a/java/res/xml-sw600dp/rows_symbols.xml
+++ b/java/res/xml-sw600dp/rows_symbols.xml
@@ -58,5 +58,5 @@
             latin:keyWidth="fillRight" />
     </Row>
     <include
-        latin:keyboardLayout="@xml/rows_symbols4" />
+        latin:keyboardLayout="@xml/row_symbols4" />
 </merge>
diff --git a/java/res/xml-sw600dp/rows_symbols_shift.xml b/java/res/xml-sw600dp/rows_symbols_shift.xml
index cc66f96..0750670 100644
--- a/java/res/xml-sw600dp/rows_symbols_shift.xml
+++ b/java/res/xml-sw600dp/rows_symbols_shift.xml
@@ -54,5 +54,5 @@
             latin:keyboardLayout="@xml/rowkeys_symbols_shift3" />
     </Row>
     <include
-        latin:keyboardLayout="@xml/rows_symbols_shift4" />
+        latin:keyboardLayout="@xml/row_symbols_shift4" />
 </merge>
diff --git a/java/res/xml-sw768dp/key_space.xml b/java/res/xml-sw768dp/key_space.xml
new file mode 100644
index 0000000..115bcb6
--- /dev/null
+++ b/java/res/xml-sw768dp/key_space.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+**
+** Copyright 2012, 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"
+>
+    <switch>
+        <case
+            latin:languageCode="fa"
+        >
+            <Key
+                latin:keyStyle="spaceKeyStyle"
+                latin:keyXPos="31.250%p"
+                latin:keyWidth="29.453%p" />
+            <!-- U+200C: "" ZERO WIDTH NON-JOINER
+                 U+200D: "" ZERO WIDTH JOINER -->
+            <Key
+                latin:keyStyle="zwnjKeyStyle" />
+        </case>
+        <default>
+            <Key
+                latin:keyStyle="spaceKeyStyle"
+                latin:keyXPos="31.250%p"
+                latin:keyWidth="37.500%p" />
+        </default>
+    </switch>
+</merge>
diff --git a/java/res/xml-sw768dp/keys_apostrophe_dash.xml b/java/res/xml-sw768dp/keys_apostrophe_dash.xml
deleted file mode 100644
index badc6e5..0000000
--- a/java/res/xml-sw768dp/keys_apostrophe_dash.xml
+++ /dev/null
@@ -1,63 +0,0 @@
-<?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.
-*/
--->
-
-<merge
-    xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
->
-    <switch>
-        <case
-            latin:mode="email"
-        >
-            <Key
-                latin:keyLabel="-" />
-        </case>
-        <case
-            latin:mode="url"
-        >
-            <Key
-                latin:keyLabel="/"
-                latin:keyHintLabel=":"
-                latin:moreKeys=":"
-                latin:keyStyle="hasShiftedLetterHintStyle" />
-        </case>
-        <default>
-            <Key
-                latin:keyLabel="!text/keylabel_for_apostrophe"
-                latin:keyHintLabel="!text/keyhintlabel_for_apostrophe"
-                latin:moreKeys="!text/more_keys_for_apostrophe"
-                latin:keyStyle="hasShiftedLetterHintStyle" />
-        </default>
-    </switch>
-    <switch>
-        <case
-            latin:mode="email"
-        >
-            <Key
-                latin:keyLabel="_" />
-        </case>
-        <default>
-            <Key
-                latin:keyLabel="!text/keylabel_for_dash"
-                latin:keyHintLabel="!text/keyhintlabel_for_dash"
-                latin:moreKeys="!text/more_keys_for_dash"
-                latin:keyStyle="hasShiftedLetterHintStyle" />
-        </default>
-    </switch>
-</merge>
diff --git a/java/res/xml-sw768dp/keys_f1f2.xml b/java/res/xml-sw768dp/keys_f1f2.xml
new file mode 100644
index 0000000..5697035
--- /dev/null
+++ b/java/res/xml-sw768dp/keys_f1f2.xml
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+**
+** Copyright 2012, 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"
+>
+    <switch>
+        <case
+            latin:mode="url"
+        >
+            <Key
+                latin:keyStyle="comKeyStyle"
+                latin:keyWidth="16.084%p" />
+        </case>
+        <default>
+            <switch>
+                <case
+                    latin:mode="email"
+                >
+                    <Key
+                        latin:keyStyle="comKeyStyle" />
+                </case>
+                <case
+                    latin:imeAction="actionSearch"
+                >
+                    <Key
+                        latin:keyLabel=":"
+                        latin:keyHintLabel="+"
+                        latin:moreKeys="+"
+                        latin:keyStyle="hasShiftedLetterHintStyle" />
+                </case>
+                <default>
+                    <Key
+                        latin:keyStyle="smileyKeyStyle" />
+                </default>
+            </switch>
+            <switch>
+                <case
+                    latin:mode="email"
+                >
+                    <Key
+                        latin:keyLabel="\@" />
+                </case>
+                <default>
+                    <Key
+                        latin:keyLabel="/"
+                        latin:keyHintLabel="\@"
+                        latin:moreKeys="\@"
+                        latin:keyStyle="hasShiftedLetterHintStyle" />
+                </default>
+            </switch>
+        </default>
+    </switch>
+</merge>
diff --git a/java/res/xml-sw768dp/row_qwerty4.xml b/java/res/xml-sw768dp/row_qwerty4.xml
index 90da21b..f6ad3fd 100644
--- a/java/res/xml-sw768dp/row_qwerty4.xml
+++ b/java/res/xml-sw768dp/row_qwerty4.xml
@@ -29,73 +29,10 @@
         <Spacer
             latin:keyXPos="15.157%p"
             latin:keyWidth="0%p" />
-        <switch>
-            <case
-                latin:mode="url"
-            >
-                <Key
-                    latin:keyStyle="comKeyStyle"
-                    latin:keyWidth="16.084%p" />
-            </case>
-            <default>
-                <switch>
-                    <case
-                        latin:mode="email"
-                    >
-                        <Key
-                            latin:keyStyle="comKeyStyle" />
-                    </case>
-                    <case
-                        latin:imeAction="actionSearch"
-                    >
-                        <Key
-                            latin:keyLabel=":"
-                            latin:keyHintLabel="+"
-                            latin:moreKeys="+"
-                            latin:keyStyle="hasShiftedLetterHintStyle" />
-                    </case>
-                    <default>
-                        <Key
-                            latin:keyStyle="smileyKeyStyle" />
-                    </default>
-                </switch>
-                <switch>
-                    <case
-                        latin:mode="email"
-                    >
-                        <Key
-                            latin:keyLabel="\@" />
-                    </case>
-                    <default>
-                        <Key
-                            latin:keyLabel="/"
-                            latin:keyHintLabel="\@"
-                            latin:moreKeys="\@"
-                            latin:keyStyle="hasShiftedLetterHintStyle" />
-                    </default>
-                </switch>
-            </default>
-        </switch>
-        <switch>
-            <case
-                latin:languageCode="fa"
-            >
-                <Key
-                    latin:keyStyle="spaceKeyStyle"
-                    latin:keyXPos="31.250%p"
-                    latin:keyWidth="29.453%p" />
-                <!-- U+200C: "" ZERO WIDTH NON-JOINER
-                     U+200D: "" ZERO WIDTH JOINER -->
-                <Key
-                    latin:keyStyle="zwnjKeyStyle" />
-            </case>
-            <default>
-                <Key
-                    latin:keyStyle="spaceKeyStyle"
-                    latin:keyXPos="31.250%p"
-                    latin:keyWidth="37.500%p" />
-            </default>
-        </switch>
+        <include
+            latin:keyboardLayout="@xml/keys_f1f2" />
+        <include
+            latin:keyboardLayout="@xml/key_space" />
         <switch>
             <case
                 latin:languageCode="iw"
@@ -105,7 +42,9 @@
             </case>
             <default>
                 <include
-                    latin:keyboardLayout="@xml/keys_apostrophe_dash" />
+                    latin:keyboardLayout="@xml/key_apostrophe" />
+                <include
+                    latin:keyboardLayout="@xml/key_dash" />
             </default>
         </switch>
         <switch>
diff --git a/java/res/xml-sw768dp/rows_symbols4.xml b/java/res/xml-sw768dp/row_symbols4.xml
similarity index 100%
rename from java/res/xml-sw768dp/rows_symbols4.xml
rename to java/res/xml-sw768dp/row_symbols4.xml
diff --git a/java/res/xml-sw768dp/rows_symbols_shift4.xml b/java/res/xml-sw768dp/row_symbols_shift4.xml
similarity index 100%
rename from java/res/xml-sw768dp/rows_symbols_shift4.xml
rename to java/res/xml-sw768dp/row_symbols_shift4.xml
diff --git a/java/res/xml-sw768dp/rows_10_10_7_symbols.xml b/java/res/xml-sw768dp/rows_10_10_7_symbols.xml
index 1d61d99..44f0964 100644
--- a/java/res/xml-sw768dp/rows_10_10_7_symbols.xml
+++ b/java/res/xml-sw768dp/rows_10_10_7_symbols.xml
@@ -65,5 +65,5 @@
             latin:keyWidth="fillBoth" />
     </Row>
     <include
-        latin:keyboardLayout="@xml/rows_symbols4" />
+        latin:keyboardLayout="@xml/row_symbols4" />
 </merge>
diff --git a/java/res/xml-sw768dp/rows_10_10_7_symbols_shift.xml b/java/res/xml-sw768dp/rows_10_10_7_symbols_shift.xml
index d22f833..bea0d9c 100644
--- a/java/res/xml-sw768dp/rows_10_10_7_symbols_shift.xml
+++ b/java/res/xml-sw768dp/rows_10_10_7_symbols_shift.xml
@@ -65,5 +65,5 @@
             latin:keyWidth="fillBoth" />
     </Row>
     <include
-        latin:keyboardLayout="@xml/rows_symbols_shift4" />
+        latin:keyboardLayout="@xml/row_symbols_shift4" />
 </merge>
diff --git a/java/res/xml-sw768dp/rows_hebrew.xml b/java/res/xml-sw768dp/rows_hebrew.xml
index 476071a..e70f450 100644
--- a/java/res/xml-sw768dp/rows_hebrew.xml
+++ b/java/res/xml-sw768dp/rows_hebrew.xml
@@ -31,7 +31,9 @@
             latin:keyLabelFlags="alignLeft"
             latin:keyWidth="7.969%p" />
         <include
-            latin:keyboardLayout="@xml/keys_apostrophe_dash" />
+            latin:keyboardLayout="@xml/key_apostrophe" />
+        <include
+            latin:keyboardLayout="@xml/key_dash" />
         <include
             latin:keyboardLayout="@xml/rowkeys_hebrew1" />
         <Key
diff --git a/java/res/xml-sw768dp/rows_symbols.xml b/java/res/xml-sw768dp/rows_symbols.xml
index ed2df18..fcc624f 100644
--- a/java/res/xml-sw768dp/rows_symbols.xml
+++ b/java/res/xml-sw768dp/rows_symbols.xml
@@ -65,5 +65,5 @@
             latin:keyWidth="fillBoth" />
     </Row>
     <include
-        latin:keyboardLayout="@xml/rows_symbols4" />
+        latin:keyboardLayout="@xml/row_symbols4" />
 </merge>
diff --git a/java/res/xml-sw768dp/rows_symbols_shift.xml b/java/res/xml-sw768dp/rows_symbols_shift.xml
index 30e1df0..1d13bb1 100644
--- a/java/res/xml-sw768dp/rows_symbols_shift.xml
+++ b/java/res/xml-sw768dp/rows_symbols_shift.xml
@@ -65,5 +65,5 @@
             latin:keyWidth="fillBoth" />
     </Row>
     <include
-        latin:keyboardLayout="@xml/rows_symbols_shift4" />
+        latin:keyboardLayout="@xml/row_symbols_shift4" />
 </merge>
diff --git a/java/res/xml-sw768dp/rows_thai_symbols.xml b/java/res/xml-sw768dp/rows_thai_symbols.xml
index 20f22bc..b3f60f5 100644
--- a/java/res/xml-sw768dp/rows_thai_symbols.xml
+++ b/java/res/xml-sw768dp/rows_thai_symbols.xml
@@ -72,5 +72,5 @@
             latin:keyWidth="fillBoth" />
     </Row>
     <include
-        latin:keyboardLayout="@xml/rows_symbols4" />
+        latin:keyboardLayout="@xml/row_symbols4" />
 </merge>
diff --git a/java/res/xml-sw768dp/rows_thai_symbols_shift.xml b/java/res/xml-sw768dp/rows_thai_symbols_shift.xml
index 467dd19..573e0e3 100644
--- a/java/res/xml-sw768dp/rows_thai_symbols_shift.xml
+++ b/java/res/xml-sw768dp/rows_thai_symbols_shift.xml
@@ -72,5 +72,5 @@
             latin:keyWidth="fillBoth" />
     </Row>
     <include
-        latin:keyboardLayout="@xml/rows_symbols_shift4" />
+        latin:keyboardLayout="@xml/row_symbols_shift4" />
 </merge>
diff --git a/java/res/xml/kbd_azerty_symbols.xml b/java/res/xml/kbd_10_10_7_symbols.xml
similarity index 100%
rename from java/res/xml/kbd_azerty_symbols.xml
rename to java/res/xml/kbd_10_10_7_symbols.xml
diff --git a/java/res/xml/kbd_azerty_symbols_shift.xml b/java/res/xml/kbd_10_10_7_symbols_shift.xml
similarity index 100%
rename from java/res/xml/kbd_azerty_symbols_shift.xml
rename to java/res/xml/kbd_10_10_7_symbols_shift.xml
diff --git a/java/res/xml/kbd_hebrew_symbols_shift.xml b/java/res/xml/kbd_hebrew_symbols_shift.xml
deleted file mode 100644
index 25db3c8..0000000
--- a/java/res/xml/kbd_hebrew_symbols_shift.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-**
-** Copyright 2012, 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"
->
-    <include
-        latin:keyboardLayout="@xml/rows_symbols_shift" />
-</Keyboard>
diff --git a/java/res/xml/kbd_spanish_symbols.xml b/java/res/xml/kbd_spanish_symbols.xml
deleted file mode 100644
index 7e075df..0000000
--- a/java/res/xml/kbd_spanish_symbols.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-**
-** Copyright 2012, 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"
->
-    <include
-        latin:keyboardLayout="@xml/rows_symbols" />
-</Keyboard>
diff --git a/java/res/xml/kbd_spanish_symbols_shift.xml b/java/res/xml/kbd_spanish_symbols_shift.xml
deleted file mode 100644
index 25db3c8..0000000
--- a/java/res/xml/kbd_spanish_symbols_shift.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-**
-** Copyright 2012, 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"
->
-    <include
-        latin:keyboardLayout="@xml/rows_symbols_shift" />
-</Keyboard>
diff --git a/java/res/xml/key_f1.xml b/java/res/xml/key_f1.xml
new file mode 100644
index 0000000..455f9ef
--- /dev/null
+++ b/java/res/xml/key_f1.xml
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+**
+** Copyright 2012, 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"
+>
+    <switch>
+        <case
+            latin:mode="url"
+        >
+            <Key
+                latin:keyLabel="/"
+                latin:keyStyle="f1MoreKeysStyle" />
+        </case>
+        <case
+            latin:mode="email"
+        >
+            <Key
+                latin:keyLabel="\@"
+                latin:keyStyle="f1MoreKeysStyle" />
+        </case>
+        <case
+            latin:hasShortcutKey="true"
+        >
+            <Key
+                latin:keyStyle="shortcutKeyStyle" />
+        </case>
+        <!-- latin:hasShortcutKey="false" -->
+        <default>
+            <Key
+                latin:keyLabel="!text/keylabel_for_comma"
+                latin:keyLabelFlags="hasPopupHint"
+                latin:additionalMoreKeys="!text/more_keys_for_comma"
+                latin:keyStyle="f1MoreKeysStyle" />
+        </default>
+    </switch>
+</merge>
diff --git a/java/res/xml/key_space.xml b/java/res/xml/key_space.xml
new file mode 100644
index 0000000..02ee42f
--- /dev/null
+++ b/java/res/xml/key_space.xml
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+**
+** Copyright 2012, 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"
+>
+    <switch>
+        <case
+            latin:languageCode="fa"
+            latin:languageSwitchKeyEnabled="true"
+        >
+            <Key
+                latin:keyStyle="languageSwitchKeyStyle" />
+            <Key
+                latin:keyStyle="spaceKeyStyle"
+                latin:keyWidth="30%p" />
+            <Key
+                latin:keyStyle="zwnjKeyStyle" />
+        </case>
+        <case
+            latin:languageCode="fa"
+            latin:languageSwitchKeyEnabled="false"
+        >
+            <Key
+                latin:keyStyle="spaceKeyStyle"
+                latin:keyWidth="40%p" />
+            <Key
+                latin:keyStyle="zwnjKeyStyle" />
+        </case>
+        <case
+            latin:languageSwitchKeyEnabled="true"
+        >
+            <Key
+                latin:keyStyle="languageSwitchKeyStyle" />
+            <Key
+                latin:keyStyle="spaceKeyStyle"
+                latin:keyWidth="40%p" />
+        </case>
+        <!-- languageSwitchKeyEnabled="false" -->
+        <default>
+            <Key
+                latin:keyStyle="spaceKeyStyle"
+                latin:keyWidth="50%p" />
+        </default>
+    </switch>
+</merge>
diff --git a/java/res/xml/keyboard_layout_set_azerty.xml b/java/res/xml/keyboard_layout_set_azerty.xml
index d4df667..4d144ed 100644
--- a/java/res/xml/keyboard_layout_set_azerty.xml
+++ b/java/res/xml/keyboard_layout_set_azerty.xml
@@ -26,10 +26,10 @@
         latin:enableProximityCharsCorrection="true" />
     <Element
         latin:elementName="symbols"
-        latin:elementKeyboard="@xml/kbd_azerty_symbols" />
+        latin:elementKeyboard="@xml/kbd_10_10_7_symbols" />
     <Element
         latin:elementName="symbolsShifted"
-        latin:elementKeyboard="@xml/kbd_azerty_symbols_shift" />
+        latin:elementKeyboard="@xml/kbd_10_10_7_symbols_shift" />
     <Element
         latin:elementName="phone"
         latin:elementKeyboard="@xml/kbd_phone" />
diff --git a/java/res/xml/keyboard_layout_set_hebrew.xml b/java/res/xml/keyboard_layout_set_hebrew.xml
index d0f12f3..212816d 100644
--- a/java/res/xml/keyboard_layout_set_hebrew.xml
+++ b/java/res/xml/keyboard_layout_set_hebrew.xml
@@ -26,10 +26,10 @@
         latin:enableProximityCharsCorrection="true" />
     <Element
         latin:elementName="symbols"
-        latin:elementKeyboard="@xml/kbd_hebrew_symbols" />
+        latin:elementKeyboard="@xml/kbd_10_10_7_symbols" />
     <Element
         latin:elementName="symbolsShifted"
-        latin:elementKeyboard="@xml/kbd_hebrew_symbols_shift" />
+        latin:elementKeyboard="@xml/kbd_10_10_7_symbols_shift" />
     <Element
         latin:elementName="phone"
         latin:elementKeyboard="@xml/kbd_phone" />
diff --git a/java/res/xml/keyboard_layout_set_spanish.xml b/java/res/xml/keyboard_layout_set_spanish.xml
index 0ef712b..57cef52 100644
--- a/java/res/xml/keyboard_layout_set_spanish.xml
+++ b/java/res/xml/keyboard_layout_set_spanish.xml
@@ -26,10 +26,10 @@
         latin:enableProximityCharsCorrection="true" />
     <Element
         latin:elementName="symbols"
-        latin:elementKeyboard="@xml/kbd_spanish_symbols" />
+        latin:elementKeyboard="@xml/kbd_10_10_7_symbols" />
     <Element
         latin:elementName="symbolsShifted"
-        latin:elementKeyboard="@xml/kbd_spanish_symbols_shift" />
+        latin:elementKeyboard="@xml/kbd_10_10_7_symbols_shift" />
     <Element
         latin:elementName="phone"
         latin:elementKeyboard="@xml/kbd_phone" />
diff --git a/java/res/xml/row_qwerty4.xml b/java/res/xml/row_qwerty4.xml
index 343e3ee..361a2c3 100644
--- a/java/res/xml/row_qwerty4.xml
+++ b/java/res/xml/row_qwerty4.xml
@@ -27,75 +27,10 @@
         <Key
             latin:keyStyle="toSymbolKeyStyle"
             latin:keyWidth="15%p" />
-        <switch>
-            <case
-                latin:mode="url"
-            >
-                <Key
-                    latin:keyLabel="/"
-                    latin:keyStyle="f1MoreKeysStyle" />
-            </case>
-            <case
-                latin:mode="email"
-            >
-                <Key
-                    latin:keyLabel="\@"
-                    latin:keyStyle="f1MoreKeysStyle" />
-            </case>
-            <case
-                latin:hasShortcutKey="true"
-            >
-                <Key
-                    latin:keyStyle="shortcutKeyStyle" />
-            </case>
-            <!-- latin:hasShortcutKey="false" -->
-            <default>
-                <Key
-                    latin:keyLabel="!text/keylabel_for_comma"
-                    latin:keyLabelFlags="hasPopupHint"
-                    latin:additionalMoreKeys="!text/more_keys_for_comma"
-                    latin:keyStyle="f1MoreKeysStyle" />
-            </default>
-        </switch>
-        <switch>
-            <case
-                latin:languageCode="fa"
-                latin:languageSwitchKeyEnabled="true"
-            >
-                <Key
-                    latin:keyStyle="languageSwitchKeyStyle" />
-                <Key
-                    latin:keyStyle="spaceKeyStyle"
-                    latin:keyWidth="30%p" />
-                <Key
-                    latin:keyStyle="zwnjKeyStyle" />
-            </case>
-            <case
-                latin:languageCode="fa"
-                latin:languageSwitchKeyEnabled="false"
-            >
-                <Key
-                    latin:keyStyle="spaceKeyStyle"
-                    latin:keyWidth="40%p" />
-                <Key
-                    latin:keyStyle="zwnjKeyStyle" />
-            </case>
-            <case
-                latin:languageSwitchKeyEnabled="true"
-            >
-                <Key
-                    latin:keyStyle="languageSwitchKeyStyle" />
-                <Key
-                    latin:keyStyle="spaceKeyStyle"
-                    latin:keyWidth="40%p" />
-            </case>
-            <!-- languageSwitchKeyEnabled="false" -->
-            <default>
-                <Key
-                    latin:keyStyle="spaceKeyStyle"
-                    latin:keyWidth="50%p" />
-            </default>
-        </switch>
+        <include
+            latin:keyboardLayout="@xml/key_f1" />
+        <include
+            latin:keyboardLayout="@xml/key_space" />
         <Key
             latin:keyStyle="punctuationKeyStyle" />
         <Key
diff --git a/java/res/xml/rows_symbols4.xml b/java/res/xml/row_symbols4.xml
similarity index 100%
rename from java/res/xml/rows_symbols4.xml
rename to java/res/xml/row_symbols4.xml
diff --git a/java/res/xml/rows_symbols_shift4.xml b/java/res/xml/row_symbols_shift4.xml
similarity index 100%
rename from java/res/xml/rows_symbols_shift4.xml
rename to java/res/xml/row_symbols_shift4.xml
diff --git a/java/res/xml/rows_symbols.xml b/java/res/xml/rows_symbols.xml
index dcd8d59..2a73ffb 100644
--- a/java/res/xml/rows_symbols.xml
+++ b/java/res/xml/rows_symbols.xml
@@ -44,5 +44,5 @@
             latin:keyboardLayout="@xml/rowkeys_symbols3" />
     </Row>
     <include
-        latin:keyboardLayout="@xml/rows_symbols4" />
+        latin:keyboardLayout="@xml/row_symbols4" />
 </merge>
diff --git a/java/res/xml/rows_symbols_shift.xml b/java/res/xml/rows_symbols_shift.xml
index 6205eed..0ab9715 100644
--- a/java/res/xml/rows_symbols_shift.xml
+++ b/java/res/xml/rows_symbols_shift.xml
@@ -44,5 +44,5 @@
             latin:keyboardLayout="@xml/rowkeys_symbols_shift3" />
     </Row>
     <include
-        latin:keyboardLayout="@xml/rows_symbols_shift4" />
+        latin:keyboardLayout="@xml/row_symbols_shift4" />
 </merge>