From d6f147e14293d717e94ae30f1f33750adec6b9c5 Mon Sep 17 00:00:00 2001
From: "Tadashi G. Takaoka" <takaoka@google.com>
Date: Wed, 5 Feb 2014 18:26:14 +0900
Subject: [PATCH] Consolidate keyOutputText with keyLabel attribute

Change-Id: I90ea2c9d5ce42fabc79599995a2fae1f5f652a6b
---
 java/res/values/attrs.xml                                | 3 ---
 java/res/xml-sw600dp/key_styles_common.xml               | 9 +--------
 java/res/xml/key_styles_common.xml                       | 3 +--
 java/src/com/android/inputmethod/keyboard/Key.java       | 6 +-----
 .../inputmethod/keyboard/internal/KeyStylesSet.java      | 1 -
 5 files changed, 3 insertions(+), 19 deletions(-)

diff --git a/java/res/values/attrs.xml b/java/res/values/attrs.xml
index 4139878802..5bedd4ac21 100644
--- a/java/res/values/attrs.xml
+++ b/java/res/values/attrs.xml
@@ -276,9 +276,6 @@
             <flag name="altCodeWhileTyping" value="0x04" />
             <flag name="enableLongPress" value="0x08" />
         </attr>
-        <!-- TODO: Remove keyOutputText attribute and consolidate with keySpec. -->
-        <!-- The string of characters to output when this key is pressed. -->
-        <attr name="keyOutputText" format="string" />
         <!-- TODO: Rename keyLabel to keySpec. -->
         <!-- The label to display on the key. -->
         <attr name="keyLabel" format="string" />
diff --git a/java/res/xml-sw600dp/key_styles_common.xml b/java/res/xml-sw600dp/key_styles_common.xml
index d817add11e..4e4579b4fc 100644
--- a/java/res/xml-sw600dp/key_styles_common.xml
+++ b/java/res/xml-sw600dp/key_styles_common.xml
@@ -100,12 +100,6 @@
         latin:moreKeys="!icon/zwj_key|&#x200D;"
         latin:keyLabelFlags="hasPopupHint"
         latin:keyActionFlags="noKeyPreview" />
-    <key-style
-        latin:styleName="smileyKeyStyle"
-        latin:keyLabel=":-)"
-        latin:keyOutputText=":-) "
-        latin:keyLabelFlags="hasPopupHint|preserveCase"
-        latin:moreKeys="!text/more_keys_for_smiley" />
     <key-style
         latin:styleName="shortcutKeyStyle"
         latin:code="!code/key_shortcut"
@@ -190,8 +184,7 @@
         latin:parentStyle="baseForLayoutSwitchKeyStyle" />
     <key-style
         latin:styleName="comKeyStyle"
-        latin:keyLabel="!text/keylabel_for_popular_domain"
+        latin:keyLabel="!text/keylabel_for_popular_domain|!text/keylabel_for_popular_domain"
         latin:keyLabelFlags="autoXScale|fontNormal|hasPopupHint|preserveCase"
-        latin:keyOutputText="!text/keylabel_for_popular_domain"
         latin:moreKeys="!text/more_keys_for_popular_domain" />
 </merge>
diff --git a/java/res/xml/key_styles_common.xml b/java/res/xml/key_styles_common.xml
index d538eb8c3d..9c40d627af 100644
--- a/java/res/xml/key_styles_common.xml
+++ b/java/res/xml/key_styles_common.xml
@@ -184,9 +184,8 @@
         latin:parentStyle="baseForToSymbolKeyStyle" />
     <key-style
         latin:styleName="comKeyStyle"
-        latin:keyLabel="!text/keylabel_for_popular_domain"
+        latin:keyLabel="!text/keylabel_for_popular_domain|!text/keylabel_for_popular_domain"
         latin:keyLabelFlags="autoXScale|fontNormal|hasPopupHint|preserveCase"
-        latin:keyOutputText="!text/keylabel_for_popular_domain"
         latin:moreKeys="!text/more_keys_for_popular_domain"
         latin:backgroundType="functional" />
 </merge>
diff --git a/java/src/com/android/inputmethod/keyboard/Key.java b/java/src/com/android/inputmethod/keyboard/Key.java
index 9715557c70..1b9007da27 100644
--- a/java/src/com/android/inputmethod/keyboard/Key.java
+++ b/java/src/com/android/inputmethod/keyboard/Key.java
@@ -347,12 +347,8 @@ public class Key implements Comparable<Key> {
             mHintLabel = StringUtils.toUpperCaseOfStringForLocale(style.getString(keyAttr,
                     R.styleable.Keyboard_Key_keyHintLabel), needsToUpperCase, locale);
         }
-        final String outputTextInAttr = style.getString(
-                keyAttr, R.styleable.Keyboard_Key_keyOutputText);
-        final String rawOutputText = (outputTextInAttr != null) ? outputTextInAttr
-                : KeySpecParser.getOutputText(keySpec);
         String outputText = StringUtils.toUpperCaseOfStringForLocale(
-                rawOutputText, needsToUpperCase, locale);
+                KeySpecParser.getOutputText(keySpec), needsToUpperCase, locale);
         // Choose the first letter of the label as primary code if not specified.
         if (code == CODE_UNSPECIFIED && TextUtils.isEmpty(outputText)
                 && !TextUtils.isEmpty(mLabel)) {
diff --git a/java/src/com/android/inputmethod/keyboard/internal/KeyStylesSet.java b/java/src/com/android/inputmethod/keyboard/internal/KeyStylesSet.java
index f7e43a6c2a..a64f23501a 100644
--- a/java/src/com/android/inputmethod/keyboard/internal/KeyStylesSet.java
+++ b/java/src/com/android/inputmethod/keyboard/internal/KeyStylesSet.java
@@ -138,7 +138,6 @@ public final class KeyStylesSet {
             readString(keyAttr, R.styleable.Keyboard_Key_code);
             readString(keyAttr, R.styleable.Keyboard_Key_altCode);
             readString(keyAttr, R.styleable.Keyboard_Key_keyLabel);
-            readString(keyAttr, R.styleable.Keyboard_Key_keyOutputText);
             readString(keyAttr, R.styleable.Keyboard_Key_keyHintLabel);
             readStringArray(keyAttr, R.styleable.Keyboard_Key_moreKeys);
             readStringArray(keyAttr, R.styleable.Keyboard_Key_additionalMoreKeys);
-- 
GitLab