Adaptive keyboard width/position parser

This change introduces the following features to Keyboard XML format.

 * "keyXPos" can specify the key X coordinate directly.
 * "keyXPos" can be negative. The X coordinate will be calcluated from
    the right edge of the keyboard toward left.
 * "keyWidth" can be zero to be filled up to the right side.
 * "keyWidth can be negative. The key will be filled up to both sides.
 * Spacer's horizontalGap is renamed as keyWidth, and can be inherited
   from key-style.
 * Spacer can have keyXPos attribute.

Using these syntax, all keyboard layouts have been re-written.

Cherry-Pick: I314b2e8ca2aa145ff9506cbf927140a15685af42
Bug: 4442045
Change-Id: I048fe5eaef020d8472ab577e9d326042bae2f3fa
diff --git a/java/res/xml-sw768dp/kbd_symbols.xml b/java/res/xml-sw768dp/kbd_symbols.xml
index 41e8522..26cf1ac 100644
--- a/java/res/xml-sw768dp/kbd_symbols.xml
+++ b/java/res/xml-sw768dp/kbd_symbols.xml
@@ -35,12 +35,12 @@
         latin:keyboardLayout="@xml/kbd_currency_key_styles" />
     <!-- This row is intentionally not marked as a top row -->
     <Row
-        latin:keyWidth="8.272%p"
+        latin:keyWidth="8.282%p"
     >
         <Key
             latin:keyStyle="tabKeyStyle"
             latin:keyLabelOption="alignLeft"
-            latin:keyWidth="7.949%p"
+            latin:keyWidth="7.969%p"
             latin:keyEdgeFlags="left" />
         <Key
             latin:keyLabel="1"
@@ -71,16 +71,17 @@
             latin:popupCharacters="ⁿ,∅" />
         <Key
             latin:keyStyle="deleteKeyStyle"
-            latin:keyWidth="9.331%p"
+            latin:keyXPos="-9.219%p"
+            latin:keyWidth="fillBoth"
             latin:keyEdgeFlags="right" />
     </Row>
     <Row
-        latin:keyWidth="8.157%p"
+        latin:keyWidth="8.125%p"
     >
         <Key
             latin:keyStyle="toAlphaKeyStyle"
             latin:keyLabelOption="alignLeft"
-            latin:keyWidth="11.167%p"
+            latin:keyWidth="11.172%p"
             latin:keyEdgeFlags="left" />
         <Key
             latin:keyLabel="#" />
@@ -108,15 +109,16 @@
             latin:popupCharacters="],},&gt;" />
         <Key
             latin:keyStyle="returnKeyStyle"
-            latin:keyWidth="15.750%p"
+            latin:keyXPos="-15.704%p"
+            latin:keyWidth="fillBoth"
             latin:keyEdgeFlags="right" />
     </Row>
     <Row
-        latin:keyWidth="8.042%p"
+        latin:keyWidth="8.047%p"
     >
         <Key
             latin:keyStyle="moreKeyStyle"
-            latin:keyWidth="15.192%p"
+            latin:keyWidth="13.829%p"
             latin:keyEdgeFlags="left" />
         <Key
             latin:keyLabel="&lt;"
@@ -180,32 +182,30 @@
         </switch>
         <Key
             latin:keyStyle="moreKeyStyle"
-            latin:keyWidth="12.530%p"
+            latin:keyXPos="-13.750%p"
+            latin:keyWidth="fillBoth"
             latin:keyEdgeFlags="right" />
     </Row>
     <!-- This row is intentionally not marked as a bottom row -->
     <Row
-        latin:keyWidth="8.042%p"
+        latin:keyWidth="8.047%p"
     >
-        <Spacer
-            latin:horizontalGap="8.362%p" />
         <switch>
             <case latin:hasSettingsKey="true">
                 <Key
-                    latin:keyStyle="settingsKeyStyle" />
+                    latin:keyStyle="settingsKeyStyle"
+                    latin:keyWidth="8.047%p" />
             </case>
-            <default>
-                <Spacer
-                    latin:horizontalGap="8.042%p" />
-            </default>
         </switch>
         <Key
-            latin:keyLabel="/" />
+            latin:keyLabel="/"
+            latin:keyXPos="15.157%p" />
         <Key
             latin:keyLabel="\@" />
         <Key
             latin:keyStyle="spaceKeyStyle"
-            latin:keyWidth="37.454%p" />
+            latin:keyXPos="31.250%p"
+            latin:keyWidth="37.500%p" />
         <switch>
             <case
                 latin:languageCode="ru"
@@ -230,7 +230,9 @@
                 latin:voiceKeyEnabled="true"
             >
                 <Key
-                    latin:keyStyle="micKeyStyle" />
+                    latin:keyStyle="micKeyStyle"
+                    latin:keyXPos="-8.047%p"
+                    latin:keyWidth="fillRight" />
             </case>
         </switch>
     </Row>