From 9426f7df2a72d292e2ceaac4c6386336208d14e6 Mon Sep 17 00:00:00 2001
From: "Tadashi G. Takaoka" <takaoka@google.com>
Date: Fri, 9 Sep 2011 15:23:27 +0900
Subject: [PATCH] Currency symbol keys are more aware of locale

* Locale is one of EU, main currency is Euro, and more currencies are
  Pound, Yen and Dollar (plus Cent on 10" tablet)
* Locale is GB, main currency is Pound, and more currencies are
  Euro, Yen and Dollar (plus Cent on 10" tablet)
* Locale has special currency symbol such as Hebrew,
  main currency is the one, and more currencies are
  Pound, Euro, Dollar (plus Cent on 10" tablet)
* Other than these, main currency is Dollar, and more currencies are
  Pound, Cent, Euro (plus Yen on 10" tablet)

Bug: 5281876
Change-Id: I548dc663bafdb3b3f717f4328fda8dfcbafca2df
---
 .../xml-sw600dp/kbd_rows_symbols_shift.xml    |  8 ++-
 .../xml-sw768dp/kbd_rows_symbols_shift.xml    | 10 ++--
 .../xml/kbd_currency_dollar_key_styles.xml    | 38 ++++++++++++
 java/res/xml/kbd_currency_euro_key_styles.xml | 39 ++++++++++++
 java/res/xml/kbd_currency_key_styles.xml      | 60 ++++++++++++-------
 java/res/xml/kbd_rows_symbols_shift.xml       |  8 ++-
 6 files changed, 133 insertions(+), 30 deletions(-)
 create mode 100644 java/res/xml/kbd_currency_dollar_key_styles.xml
 create mode 100644 java/res/xml/kbd_currency_euro_key_styles.xml

diff --git a/java/res/xml-sw600dp/kbd_rows_symbols_shift.xml b/java/res/xml-sw600dp/kbd_rows_symbols_shift.xml
index 3d62eff7ec..73fdf2d3cb 100644
--- a/java/res/xml-sw600dp/kbd_rows_symbols_shift.xml
+++ b/java/res/xml-sw600dp/kbd_rows_symbols_shift.xml
@@ -23,6 +23,8 @@
 >
     <include
         latin:keyboardLayout="@xml/kbd_key_styles" />
+    <include
+        latin:keyboardLayout="@xml/kbd_currency_key_styles" />
     <Row
         latin:keyWidth="9.0%p"
     >
@@ -61,11 +63,11 @@
             latin:keyLabel="£"
             latin:keyXPos="4.5%p" />
         <Key
-            latin:keyLabel="¢" />
+            latin:keyStyle="moreCurrency1KeyStyle" />
         <Key
-            latin:keyLabel="€" />
+            latin:keyStyle="moreCurrency2KeyStyle" />
         <Key
-            latin:keyLabel="Â¥" />
+            latin:keyStyle="moreCurrency3KeyStyle" />
         <Key
             latin:keyLabel="^"
             latin:moreKeys="↑,↓,←,→" />
diff --git a/java/res/xml-sw768dp/kbd_rows_symbols_shift.xml b/java/res/xml-sw768dp/kbd_rows_symbols_shift.xml
index 30f72ac468..ec78d579fe 100644
--- a/java/res/xml-sw768dp/kbd_rows_symbols_shift.xml
+++ b/java/res/xml-sw768dp/kbd_rows_symbols_shift.xml
@@ -23,6 +23,8 @@
 >
     <include
         latin:keyboardLayout="@xml/kbd_key_styles" />
+    <include
+        latin:keyboardLayout="@xml/kbd_currency_key_styles" />
     <Row
         latin:keyWidth="8.282%p"
     >
@@ -66,13 +68,13 @@
             latin:keyLabelOption="alignLeft"
             latin:keyWidth="11.172%p" />
         <Key
-            latin:keyLabel="£" />
+            latin:keyStyle="moreCurrency1KeyStyle" />
         <Key
-            latin:keyLabel="¢" />
+            latin:keyStyle="moreCurrency2KeyStyle" />
         <Key
-            latin:keyLabel="€" />
+            latin:keyStyle="moreCurrency3KeyStyle" />
         <Key
-            latin:keyLabel="Â¥" />
+            latin:keyStyle="moreCurrency4KeyStyle" />
         <Key
             latin:keyLabel="^"
             latin:moreKeys="↑,↓,←,→" />
diff --git a/java/res/xml/kbd_currency_dollar_key_styles.xml b/java/res/xml/kbd_currency_dollar_key_styles.xml
new file mode 100644
index 0000000000..d5dca2afa0
--- /dev/null
+++ b/java/res/xml/kbd_currency_dollar_key_styles.xml
@@ -0,0 +1,38 @@
+<?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">
+    <key-style
+        latin:styleName="currencyKeyStyle"
+        latin:keyLabel="$"
+        latin:moreKeys="@string/more_keys_for_currency_dollar" />
+    <key-style
+        latin:styleName="moreCurrency1KeyStyle"
+        latin:keyLabel="£" />
+    <key-style
+        latin:styleName="moreCurrency2KeyStyle"
+        latin:keyLabel="¢" />
+    <key-style
+        latin:styleName="moreCurrency3KeyStyle"
+        latin:keyLabel="€" />
+    <key-style
+        latin:styleName="moreCurrency4KeyStyle"
+        latin:keyLabel="Â¥" />
+</merge>
diff --git a/java/res/xml/kbd_currency_euro_key_styles.xml b/java/res/xml/kbd_currency_euro_key_styles.xml
new file mode 100644
index 0000000000..6edddf0746
--- /dev/null
+++ b/java/res/xml/kbd_currency_euro_key_styles.xml
@@ -0,0 +1,39 @@
+<?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">
+    <key-style
+        latin:styleName="currencyKeyStyle"
+        latin:keyLabel="€"
+        latin:moreKeys="@string/more_keys_for_currency_euro" />
+    <key-style
+        latin:styleName="moreCurrency1KeyStyle"
+        latin:keyLabel="£" />
+    <key-style
+        latin:styleName="moreCurrency2KeyStyle"
+        latin:keyLabel="Â¥" />
+    <key-style
+        latin:styleName="moreCurrency3KeyStyle"
+        latin:keyLabel="$"
+        latin:moreKeys="¢" />
+    <key-style
+        latin:styleName="moreCurrency4KeyStyle"
+        latin:keyLabel="¢" />
+</merge>
diff --git a/java/res/xml/kbd_currency_key_styles.xml b/java/res/xml/kbd_currency_key_styles.xml
index bcdfe5639f..225888337a 100644
--- a/java/res/xml/kbd_currency_key_styles.xml
+++ b/java/res/xml/kbd_currency_key_styles.xml
@@ -25,9 +25,8 @@
         <case
             latin:passwordInput="true"
         >
-            <key-style
-                latin:styleName="currencyKeyStyle"
-                latin:keyLabel="$" />
+            <include
+                latin:keyboardLayout="@xml/kbd_currency_dollar_key_styles" />
         </case>
         <!-- Countries using Euro currency, 23 countries as for January 2011. -->
               1. Andorra (ca_AD, ca_ES)
@@ -54,31 +53,28 @@
              22. Spain (es_ES, ca_ES)
              23. Vatican City (it_VA)
         -->
+        <!-- Though Denmark and Turkey don't using Euro as their currencies, but having Euro sign on
+             the symbol keyboard might be useful.  Especially Danish krone (kr) and Turkish lira
+             (TL) can be represented by usual alphabet letters. -->
         <!-- Note: Some locales may not have country code, and it it supposed to indicate the
              country where the language originally/mainly spoken. -->
         <case
-            latin:localeCode="de|es|el|fi|fr|it|nl|sk|sl|pt_PT"
+            latin:localeCode="da|de|es|el|fi|fr|it|nl|sk|sl|pt_PT|tr"
         >
-            <key-style
-                latin:styleName="currencyKeyStyle"
-                latin:keyLabel="€"
-                latin:moreKeys="@string/more_keys_for_currency_euro" />
+            <include
+                latin:keyboardLayout="@xml/kbd_currency_euro_key_styles" />
         </case>
         <case
             latin:languageCode="ca|et|lb|mt|sla"
         >
-            <key-style
-                latin:styleName="currencyKeyStyle"
-                latin:keyLabel="€"
-                latin:moreKeys="@string/more_keys_for_currency_euro" />
+            <include
+                latin:keyboardLayout="@xml/kbd_currency_euro_key_styles" />
         </case>
         <case
             latin:countryCode="AD|AT|BE|CY|EE|FI|FR|DE|GR|IE|IT|XK|LU|MT|MO|ME|NL|PT|SM|SK|SI|ES|VA"
         >
-            <key-style
-                latin:styleName="currencyKeyStyle"
-                latin:keyLabel="€"
-                latin:moreKeys="@string/more_keys_for_currency_euro" />
+            <include
+                latin:keyboardLayout="@xml/kbd_currency_euro_key_styles" />
         </case>
         <case
             latin:languageCode="iw"
@@ -87,6 +83,19 @@
                 latin:styleName="currencyKeyStyle"
                 latin:keyLabel="₪"
                 latin:moreKeys="@string/more_keys_for_currency_general" />
+            <key-style
+                latin:styleName="moreCurrency1KeyStyle"
+                latin:keyLabel="£" />
+            <key-style
+                latin:styleName="moreCurrency2KeyStyle"
+                latin:keyLabel="€" />
+            <key-style
+                latin:styleName="moreCurrency3KeyStyle"
+                latin:keyLabel="$"
+                latin:moreKeys="¢" />
+            <key-style
+                latin:styleName="moreCurrency4KeyStyle"
+                latin:keyLabel="¢" />
         </case>
         <!-- United Kingdom -->
         <case
@@ -96,12 +105,23 @@
                 latin:styleName="currencyKeyStyle"
                 latin:keyLabel="£"
                 latin:moreKeys="@string/more_keys_for_currency_pound" />
-        </case>
-        <default>
             <key-style
-                latin:styleName="currencyKeyStyle"
+                latin:styleName="moreCurrency1KeyStyle"
+                latin:keyLabel="€" />
+            <key-style
+                latin:styleName="moreCurrency2KeyStyle"
+                latin:keyLabel="Â¥" />
+            <key-style
+                latin:styleName="moreCurrency3KeyStyle"
                 latin:keyLabel="$"
-                latin:moreKeys="@string/more_keys_for_currency_dollar" />
+                latin:moreKeys="¢" />
+            <key-style
+                latin:styleName="moreCurrency4KeyStyle"
+                latin:keyLabel="¢" />
+        </case>
+        <default>
+            <include
+                latin:keyboardLayout="@xml/kbd_currency_dollar_key_styles" />
         </default>
     </switch>
 </merge>
diff --git a/java/res/xml/kbd_rows_symbols_shift.xml b/java/res/xml/kbd_rows_symbols_shift.xml
index 66c14fea3b..58ae72c6d0 100644
--- a/java/res/xml/kbd_rows_symbols_shift.xml
+++ b/java/res/xml/kbd_rows_symbols_shift.xml
@@ -23,6 +23,8 @@
 >
     <include
         latin:keyboardLayout="@xml/kbd_key_styles" />
+    <include
+        latin:keyboardLayout="@xml/kbd_currency_key_styles" />
     <Row
         latin:keyWidth="10%p"
     >
@@ -56,11 +58,11 @@
         <Key
             latin:keyStyle="nonSpecialBackgroundTabKeyStyle" />
         <Key
-            latin:keyLabel="£" />
+            latin:keyStyle="moreCurrency1KeyStyle" />
         <Key
-            latin:keyLabel="¢" />
+            latin:keyStyle="moreCurrency2KeyStyle" />
         <Key
-            latin:keyLabel="€" />
+            latin:keyStyle="moreCurrency3KeyStyle" />
         <Key
             latin:keyLabel="°"
             latin:moreKeys="′,″" />
-- 
GitLab