Merge "Fix unit test to run"
diff --git a/java/res/values-xlarge-land/dimens.xml b/java/res/values-xlarge-land/dimens.xml
index 5b9d50a..8737cae 100644
--- a/java/res/values-xlarge-land/dimens.xml
+++ b/java/res/values-xlarge-land/dimens.xml
@@ -19,6 +19,18 @@
 -->
 
 <resources>
+    <!-- keyboardHeight = key_height*4 + key_bottom_gap*3 -->
+    <dimen name="keyboardHeight">58.0mm</dimen>
+    <!-- key_height + key_bottom_gap = popup_key_height -->
+    <!-- <dimen name="key_height">14.5mm</dimen> -->
+    <dimen name="key_bottom_gap">0.0mm</dimen>
+    <dimen name="key_horizontal_gap">0.0mm</dimen>
+    <dimen name="popup_key_height">13.0mm</dimen>
+    <dimen name="keyboard_top_padding">0.0mm</dimen>
+    <dimen name="keyboard_bottom_padding">0.0mm</dimen>
+    <!-- key_height x 1.0 -->
+    <dimen name="key_preview_height">13.0mm</dimen>
+
     <dimen name="key_letter_size">28dip</dimen>
     <dimen name="key_label_text_size">20dip</dimen>
     <!-- left or right padding of label alignment -->
diff --git a/java/res/values-xlarge/config.xml b/java/res/values-xlarge/config.xml
new file mode 100644
index 0000000..0a1d4e4
--- /dev/null
+++ b/java/res/values-xlarge/config.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+**
+** Copyright 2010, 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.
+*/
+-->
+
+<resources>
+    <string name="config_text_size_of_language_on_spacebar">medium</string>
+</resources>
diff --git a/java/res/values-xlarge/dimens.xml b/java/res/values-xlarge/dimens.xml
index 07d5f09..7969b76 100644
--- a/java/res/values-xlarge/dimens.xml
+++ b/java/res/values-xlarge/dimens.xml
@@ -20,12 +20,12 @@
 
 <resources>
     <!-- keyboardHeight = key_height*4 + key_bottom_gap*3 -->
-    <dimen name="keyboardHeight">58.0mm</dimen>
+    <dimen name="keyboardHeight">48.0mm</dimen>
     <!-- key_height + key_bottom_gap = popup_key_height -->
-<!--    <dimen name="key_height">14.5mm</dimen>-->
+    <!-- <dimen name="key_height">14.5mm</dimen> -->
     <dimen name="key_bottom_gap">0.0mm</dimen>
     <dimen name="key_horizontal_gap">0.0mm</dimen>
-    <dimen name="popup_key_height">13.0mm</dimen>
+    <dimen name="popup_key_height">10.0mm</dimen>
     <dimen name="keyboard_top_padding">0.0mm</dimen>
     <dimen name="keyboard_bottom_padding">0.0mm</dimen>
     <!-- key_height x 1.0 -->
diff --git a/java/res/values/config.xml b/java/res/values/config.xml
index 0bb0e33..14b8d00 100644
--- a/java/res/values/config.xml
+++ b/java/res/values/config.xml
@@ -32,6 +32,7 @@
     <integer name="config_long_press_key_timeout">400</integer>
     <integer name="config_long_press_shift_key_timeout">1200</integer>
     <integer name="config_multi_tap_key_timeout">800</integer>
+    <string name="config_text_size_of_language_on_spacebar">small</string>
     <string-array name="auto_correction_threshold_values">
         <!-- Off, When auto correction setting is Off, this value is not used. -->
         <item></item>
diff --git a/java/res/values/dimens.xml b/java/res/values/dimens.xml
index 41d6384..cf2019f 100644
--- a/java/res/values/dimens.xml
+++ b/java/res/values/dimens.xml
@@ -22,7 +22,7 @@
     <!-- keyboardHeight = key_height*4 + key_bottom_gap*3 -->
     <dimen name="keyboardHeight">1.265in</dimen>
     <!-- key_height + key_bottom_gap = popup_key_height -->
-<!--    <dimen name="key_height">0.290in</dimen>-->
+    <!-- <dimen name="key_height">0.290in</dimen> -->
     <dimen name="key_bottom_gap">0.035in</dimen>
     <dimen name="key_horizontal_gap">0.000in</dimen>
     <dimen name="popup_key_height">0.325in</dimen>
diff --git a/java/res/values/strings.xml b/java/res/values/strings.xml
index 3e034a0..fe2e2e2 100644
--- a/java/res/values/strings.xml
+++ b/java/res/values/strings.xml
@@ -36,9 +36,9 @@
 
     <!-- Category title for text prediction -->
     <string name="prediction_category">Word suggestion settings</string>
-	
+
     <!-- Option to enable auto capitalization of sentences -->
-    <string name="auto_cap">Auto-capitalization</string> 
+    <string name="auto_cap">Auto-capitalization</string>
 
     <!-- Option to enable quick fixes -->
     <string name="quick_fixes">Quick fixes</string>
@@ -81,7 +81,7 @@
 
     <!-- Indicates that a word has been added to the dictionary -->
     <string name="added_word"><xliff:g id="word">%s</xliff:g> : Saved</string>
-    
+
     <!-- Label for soft enter key when it performs GO action.  Must be short to fit on key! -->
     <string name="label_go_key">Go</string>
     <!-- Label for soft enter key when it performs NEXT action.  Must be short to fit on key! -->
@@ -104,16 +104,16 @@
     <!-- Title of the warning dialog that shows when a user initiates voice input for
          the first time. -->
     <string name="voice_warning_title">Voice input</string>
-    
+
     <!-- Message that gets put at the top of the warning dialog if the user is attempting to use
          voice input in a currently unsupported locale. Voice input will work for such a user,
          but it will only recognize them in English. -->
     <string name="voice_warning_locale_not_supported">Voice input is not currently supported for your language, but does work in English.</string>
-    
+
     <!-- Message of the warning dialog that shows when a user initiates voice input for
          the first time, or turns it on in settings. -->
     <string name="voice_warning_may_not_understand">Voice input uses Google\'s speech recognition. <a href="http://m.google.com/privacy">The Mobile Privacy Policy</a> applies.</string>
-    
+
     <!-- An additional part of the warning dialog for voice input that only shows when the user
          actually initiates voice input, rather than just turning it on in settings. -->
     <string name="voice_warning_how_to_turn_off">To turn off voice input, go to input method settings.</string>
@@ -121,7 +121,7 @@
     <!-- Message to show when user enables the voice input settings (which says
         "Press the microphone button"). -->
     <string name="voice_hint_dialog_message">To use voice input, press the microphone button.</string>
-    
+
     <!-- Short message to tell the user the system is ready for them to speak. -->
     <string name="voice_listening">Speak now</string>
 
@@ -136,7 +136,7 @@
 
     <!-- Short message shown for a network error. -->
     <string name="voice_network_error">Couldn\'t connect</string>
-    
+
     <!-- Short message shown for a network error where the utterance was really long,
          in which case we should suggest that the user speak less. -->
     <string name="voice_too_much_speech">Error, too much speech.</string>
@@ -153,8 +153,7 @@
     <!-- Short message shown when the server couldn't parse any speech. -->
     <string name="voice_no_match">No matches found</string>
 
-    <!-- Short message shown when the user initiates voice and voice
-	search is not installed. -->
+    <!-- Short message shown when the user initiates voice and voice search is not installed. -->
     <string name="voice_not_installed">Voice search not installed</string>
 
     <!-- Short hint shown in candidate view to explain voice input. -->
@@ -188,10 +187,10 @@
     <string name="language_selection_title">Input languages</string>
     <!-- Title summary for input language selection screen -->
     <string name="language_selection_summary">Slide finger on spacebar to change language</string>
-    
+
     <!-- Add to dictionary hint -->
     <string name="hint_add_to_dictionary">\u2190 Touch again to save</string>
-    
+
     <!-- Inform the user that a particular language has an available dictionary -->
     <string name="has_dictionary">Dictionary available</string>
 
@@ -210,10 +209,10 @@
     <string name="subtype_mode_cs_keyboard">Czech Keyboard</string>
     <string name="subtype_mode_da_keyboard">Danish Keyboard</string>
     <string name="subtype_mode_de_keyboard">German Keyboard</string>
-    <string name="subtype_mode_en_GB_keyboard">English (United Kingdom) Keyboard</string>
-    <string name="subtype_mode_en_US_keyboard">English (United States) Keyboard</string>
+    <string name="subtype_mode_en_GB_keyboard">English (UK) Keyboard</string>
+    <string name="subtype_mode_en_US_keyboard">English (US) Keyboard</string>
     <string name="subtype_mode_es_keyboard">Spanish Keyboard</string>
-    <string name="subtype_mode_es_US_keyboard">Spanish (United States) Keyboard</string>
+    <string name="subtype_mode_es_US_keyboard">Spanish (US) Keyboard</string>
     <string name="subtype_mode_fr_keyboard">French Keyboard</string>
     <string name="subtype_mode_fr_CA_keyboard">French (Canada) Keyboard</string>
     <string name="subtype_mode_fr_CH_keyboard">French (Switzerland) Keyboard</string>
@@ -227,10 +226,10 @@
     <string name="subtype_mode_cs_voice">Czech Voice</string>
     <string name="subtype_mode_de_voice">German Voice</string>
     <string name="subtype_mode_en_AU_voice">English (Australia) Voice</string>
-    <string name="subtype_mode_en_GB_voice">English (United Kingdom) Voice</string>
+    <string name="subtype_mode_en_GB_voice">English (UK) Voice</string>
     <string name="subtype_mode_en_IN_voice">English (India) Voice</string>
     <string name="subtype_mode_en_NZ_voice">English (New Zealand) Voice</string>
-    <string name="subtype_mode_en_US_voice">English (United States) Voice</string>
+    <string name="subtype_mode_en_US_voice">English (US) Voice</string>
     <string name="subtype_mode_es_voice">Spanish Voice</string>
     <string name="subtype_mode_fr_voice">French Voice</string>
     <string name="subtype_mode_ja_voice">Japanese Voice</string>
@@ -239,8 +238,8 @@
     <string name="subtype_mode_pt_voice">Portuguese Voice</string>
     <string name="subtype_mode_ru_voice">Russian Voice</string>
     <string name="subtype_mode_tr_voice">Turkish Voice</string>
-    <string name="subtype_mode_zh_CN_voice">Chinese (China) Voice</string>
-    <string name="subtype_mode_zh_TW_voice">Chinese (Taiwan) Voice</string>
+    <string name="subtype_mode_zh_CN_voice">Chinese (China, Simplified) Voice</string>
+    <string name="subtype_mode_zh_TW_voice">Chinese (Taiwan, Traditional) Voice</string>
 
     <!-- Title of an option for usability study mode -->
     <string name="prefs_usability_study_mode">Usability Study Mode</string>
diff --git a/java/res/xml/method.xml b/java/res/xml/method.xml
index a381821..482b35f 100644
--- a/java/res/xml/method.xml
+++ b/java/res/xml/method.xml
@@ -29,7 +29,7 @@
         android:isDefault="@bool/im_is_default">
     <!-- If IME doesn't have an applicable subtype, the first subtype will be used as a default
          subtype.-->
-    <subtype android:icon="@drawable/ic_subtype_keyboard_en_us"
+    <subtype android:icon="@drawable/ic_subtype_keyboard_en_gb"
             android:label="@string/subtype_mode_en_US_keyboard"
             android:imeSubtypeLocale="en_US"
             android:imeSubtypeMode="keyboard"
diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardView.java b/java/src/com/android/inputmethod/keyboard/KeyboardView.java
index 70267a7..4a3a58b 100644
--- a/java/src/com/android/inputmethod/keyboard/KeyboardView.java
+++ b/java/src/com/android/inputmethod/keyboard/KeyboardView.java
@@ -174,7 +174,7 @@
     // This map caches key label text height in pixel as value and key label text size as map key.
     private final HashMap<Integer, Integer> mTextHeightCache = new HashMap<Integer, Integer>();
     // Distance from horizontal center of the key, proportional to key label text height and width.
-    private final float KEY_LABEL_VERTICAL_ADJUSTMENT_FACTOR_CENTER = 0.55f;
+    private final float KEY_LABEL_VERTICAL_ADJUSTMENT_FACTOR_CENTER = 0.45f;
     private final float KEY_LABEL_VERTICAL_PADDING_FACTOR = 1.60f;
     private final String KEY_LABEL_REFERENCE_CHAR = "H";
     private final int KEY_LABEL_OPTION_ALIGN_LEFT = 1;
@@ -727,6 +727,9 @@
                     final float centerY = (key.mHeight + padding.top - padding.bottom) / 2;
                     baseline = centerY
                             + labelCharHeight * KEY_LABEL_VERTICAL_ADJUSTMENT_FACTOR_CENTER;
+                    if (DEBUG_SHOW_ALIGN)
+                        drawHorizontalLine(canvas, (int)baseline, key.mWidth, 0xc0008000,
+                                new Paint());
                 }
                 // Horizontal label text alignment
                 final int positionX;
diff --git a/java/src/com/android/inputmethod/keyboard/LatinKeyboard.java b/java/src/com/android/inputmethod/keyboard/LatinKeyboard.java
index 0a42857..7cae4f1 100644
--- a/java/src/com/android/inputmethod/keyboard/LatinKeyboard.java
+++ b/java/src/com/android/inputmethod/keyboard/LatinKeyboard.java
@@ -75,6 +75,9 @@
 
     private static int sSpacebarVerticalCorrection;
 
+    private static final String SMALL_TEXT_SIZE_OF_LANGUAGE_ON_SPACEBAR = "small";
+    private static final String MEDIUM_TEXT_SIZE_OF_LANGUAGE_ON_SPACEBAR = "medium";
+
     public LatinKeyboard(Context context, KeyboardId id) {
         super(context, id);
         final Resources res = context.getResources();
@@ -189,10 +192,23 @@
             paint.setAntiAlias(true);
             paint.setTextAlign(Align.CENTER);
 
+            final String textSizeOfLanguageOnSpacebar = res.getString(
+                    R.string.config_text_size_of_language_on_spacebar,
+                    SMALL_TEXT_SIZE_OF_LANGUAGE_ON_SPACEBAR);
+            final int textStyle;
+            final int defaultTextSize;
+            if (MEDIUM_TEXT_SIZE_OF_LANGUAGE_ON_SPACEBAR.equals(textSizeOfLanguageOnSpacebar)) {
+                textStyle = android.R.style.TextAppearance_Medium;
+                defaultTextSize = 18;
+            } else {
+                textStyle = android.R.style.TextAppearance_Small;
+                defaultTextSize = 14;
+            }
+
             final boolean allowVariableTextSize = true;
             final String language = layoutSpaceBar(paint, subtypeSwitcher.getInputLocale(),
                     mButtonArrowLeftIcon, mButtonArrowRightIcon, width, height,
-                    getTextSizeFromTheme(android.R.style.TextAppearance_Small, 14),
+                    getTextSizeFromTheme(textStyle, defaultTextSize),
                     allowVariableTextSize);
 
             // Draw language text with shadow