From 0861d67fd80a99156e42ec00d4ff4b2b1e8e14dc Mon Sep 17 00:00:00 2001
From: "Tadashi G. Takaoka" <takaoka@google.com>
Date: Wed, 28 Aug 2013 15:59:49 +0900
Subject: [PATCH] Fix unit test

The breakage of the unit tests has been introduced by Id8caf5a972 that
emptied the default styles. This change reverts back some attributes
to the default.

Change-Id: I2748eefe50e34bbf908071e4a1a17a70aa32bdef
---
 java/res/layout/hint_add_to_dictionary.xml |  2 +-
 java/res/layout/input_view.xml             |  1 -
 java/res/layout/more_keys_keyboard.xml     |  2 +-
 java/res/layout/more_suggestions.xml       |  2 +-
 java/res/layout/suggestion_info.xml        |  2 +-
 java/res/layout/suggestion_word.xml        |  2 +-
 java/res/values/attrs.xml                  |  8 ++++----
 java/res/values/themes-common.xml          | 19 ++++++++++++++-----
 java/res/values/themes-gb.xml              | 14 +++++++++++---
 java/res/values/themes-ics.xml             | 18 +++++++++++-------
 10 files changed, 45 insertions(+), 25 deletions(-)

diff --git a/java/res/layout/hint_add_to_dictionary.xml b/java/res/layout/hint_add_to_dictionary.xml
index 63d4001ade..68a9faf19f 100644
--- a/java/res/layout/hint_add_to_dictionary.xml
+++ b/java/res/layout/hint_add_to_dictionary.xml
@@ -33,4 +33,4 @@
     android:clickable="false"
     android:singleLine="true"
     android:ellipsize="none"
-    android:background="?attr/suggestionBackground" />
+    style="?attr/suggestionWordStyle" />
diff --git a/java/res/layout/input_view.xml b/java/res/layout/input_view.xml
index 51133b2896..78217b01a2 100644
--- a/java/res/layout/input_view.xml
+++ b/java/res/layout/input_view.xml
@@ -34,7 +34,6 @@
         android:layout_height="@dimen/suggestions_strip_height"
         android:paddingRight="@dimen/suggestions_strip_padding"
         android:paddingLeft="@dimen/suggestions_strip_padding"
-        android:background="?attr/suggestionStripBackground"
         style="?attr/suggestionStripViewStyle" />
     <!-- To ensure that key preview popup is correctly placed when the current system locale is
          one of RTL locales, layoutDirection="ltr" is needed in the SDK version 17+. -->
diff --git a/java/res/layout/more_keys_keyboard.xml b/java/res/layout/more_keys_keyboard.xml
index cab3abcd9b..6637117e0e 100644
--- a/java/res/layout/more_keys_keyboard.xml
+++ b/java/res/layout/more_keys_keyboard.xml
@@ -23,7 +23,7 @@
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"
     android:orientation="horizontal"
-    android:background="?attr/moreKeysKeyboardBackground"
+    style="?attr/moreKeysKeyboardContainerStyle"
 >
     <com.android.inputmethod.keyboard.MoreKeysKeyboardView
         xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
diff --git a/java/res/layout/more_suggestions.xml b/java/res/layout/more_suggestions.xml
index 0ec0ed1b38..8659f07618 100644
--- a/java/res/layout/more_suggestions.xml
+++ b/java/res/layout/more_suggestions.xml
@@ -23,7 +23,7 @@
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"
     android:orientation="horizontal"
-    android:background="?attr/moreKeysKeyboardBackground"
+    style="?attr/moreKeysKeyboardContainerStyle"
 >
     <com.android.inputmethod.latin.suggestions.MoreSuggestionsView
         xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
diff --git a/java/res/layout/suggestion_info.xml b/java/res/layout/suggestion_info.xml
index 8b0ee34846..0aa26000da 100644
--- a/java/res/layout/suggestion_info.xml
+++ b/java/res/layout/suggestion_info.xml
@@ -24,4 +24,4 @@
     android:layout_height="wrap_content"
     android:textSize="6dp"
     android:textColor="@android:color/white"
-    android:background="?attr/suggestionBackground" />
+    style="?attr/suggestionWordStyle" />
diff --git a/java/res/layout/suggestion_word.xml b/java/res/layout/suggestion_word.xml
index e32e6952b8..c82a13c996 100644
--- a/java/res/layout/suggestion_word.xml
+++ b/java/res/layout/suggestion_word.xml
@@ -36,4 +36,4 @@
     android:clickable="false"
     android:singleLine="true"
     android:ellipsize="none"
-    android:background="?attr/suggestionBackground" />
+    style="?attr/suggestionWordStyle" />
diff --git a/java/res/values/attrs.xml b/java/res/values/attrs.xml
index 218e43ea58..589adecad8 100644
--- a/java/res/values/attrs.xml
+++ b/java/res/values/attrs.xml
@@ -32,12 +32,12 @@
         <attr name="moreKeysKeyboardStyle" format="reference" />
         <!-- MoreKeysKeyboardView style -->
         <attr name="moreKeysKeyboardViewStyle" format="reference" />
+        <!-- MoreKeysKeyboardView container style -->
+        <attr name="moreKeysKeyboardContainerStyle" format="reference" />
         <!-- Suggestions strip style -->
         <attr name="suggestionStripViewStyle" format="reference" />
-        <!-- Styled attributes for android:background -->
-        <attr name="moreKeysKeyboardBackground" format="reference" />
-        <attr name="suggestionStripBackground" format="reference" />
-        <attr name="suggestionBackground" format="reference" />
+        <!-- Suggestion word style -->
+        <attr name="suggestionWordStyle" format="reference" />
     </declare-styleable>
 
     <declare-styleable name="KeyboardView">
diff --git a/java/res/values/themes-common.xml b/java/res/values/themes-common.xml
index 04c4a52e63..473a1257ec 100644
--- a/java/res/values/themes-common.xml
+++ b/java/res/values/themes-common.xml
@@ -30,6 +30,7 @@
         <item name="maxMoreKeysColumn">@integer/config_max_more_keys_column</item>
     </style>
     <style name="KeyboardView">
+        <item name="keyBackground">@drawable/btn_keyboard_key_ics</item>
         <item name="keyLetterSize">@fraction/key_letter_ratio</item>
         <item name="keyLargeLetterRatio">@fraction/key_large_letter_ratio</item>
         <item name="keyLabelSize">@fraction/key_label_ratio</item>
@@ -100,16 +101,24 @@
         <item name="gestureRecognitionSpeedThreshold">@fraction/config_gesture_recognition_speed_threshold</item>
         <item name="suppressKeyPreviewAfterBatchInputDuration">@integer/config_suppress_key_preview_after_batch_input_duration</item>
     </style>
-    <style name="MainKeyboardView" />
+    <style
+        name="MainKeyboardView"
+        parent="KeyboardView" />
     <style name="EmojiKeyboardView" />
     <style name="MoreKeysKeyboard" />
-    <style name="MoreKeysKeyboardView" />
     <style
-        name="SuggestionStripView"
-    >
+        name="MoreKeysKeyboardView"
+        parent="MainKeyboardView" />
+    <style name="MoreKeysKeyboardContainer" />
+    <style name="SuggestionStripView">
         <item name="suggestionsCountInStrip">@integer/suggestions_count_in_strip</item>
         <item name="centerSuggestionPercentile">@fraction/center_suggestion_percentile</item>
         <item name="maxMoreSuggestionsRow">@integer/max_more_suggestions_row</item>
         <item name="minMoreSuggestionsWidth">@fraction/min_more_suggestions_width</item>
     </style>
-</resources>
+    <style name="SuggestionWord" />
+    <style name="MoreKeysKeyboardAnimation">
+        <item name="android:windowEnterAnimation">@anim/more_keys_keyboard_fadein</item>
+        <item name="android:windowExitAnimation">@anim/more_keys_keyboard_fadeout</item>
+    </style>
+</resources>
\ No newline at end of file
diff --git a/java/res/values/themes-gb.xml b/java/res/values/themes-gb.xml
index 4a984af986..d39003d949 100644
--- a/java/res/values/themes-gb.xml
+++ b/java/res/values/themes-gb.xml
@@ -26,10 +26,9 @@
         <item name="emojiKeyboardViewStyle">@style/EmojiKeyboardView.GB</item>
         <item name="moreKeysKeyboardStyle">@style/MoreKeysKeyboard.GB</item>
         <item name="moreKeysKeyboardViewStyle">@style/MoreKeysKeyboardView.GB</item>
+        <item name="moreKeysKeyboardContainerStyle">@style/MoreKeysKeyboardContainer.GB</item>
         <item name="suggestionStripViewStyle">@style/SuggestionStripView.GB</item>
-        <item name="moreKeysKeyboardBackground">@drawable/keyboard_popup_panel_background_gb</item>
-        <item name="suggestionStripBackground">@drawable/keyboard_suggest_strip_gb</item>
-        <item name="suggestionBackground">@drawable/btn_suggestion_gb</item>
+        <item name="suggestionWordStyle">@style/SuggestionWord.GB</item>
     </style>
     <style name="KeyboardIcons.GB">
         <!-- Keyboard icons -->
@@ -122,10 +121,16 @@
         <item name="keyTypeface">normal</item>
         <item name="verticalCorrection">@dimen/more_keys_keyboard_vertical_correction_gb</item>
     </style>
+    <style
+        name="MoreKeysKeyboardContainer.GB"
+    >
+        <item name="android:background">@drawable/keyboard_popup_panel_background_gb</item>
+    </style>
     <style
         name="SuggestionStripView.GB"
         parent="SuggestionStripView"
     >
+        <item name="android:background">@drawable/keyboard_suggest_strip_gb</item>
         <item name="suggestionStripOption">autoCorrectBold|validTypedWordBold</item>
         <item name="colorValidTypedWord">@color/highlight_color_gb</item>
         <item name="colorTypedWord">@color/typed_word_color_gb</item>
@@ -133,4 +138,7 @@
         <item name="colorSuggested">@color/highlight_color_gb</item>
         <item name="alphaObsoleted">50%</item>
     </style>
+    <style name="SuggestionWord.GB">
+        <item name="android:background">@drawable/btn_suggestion_gb</item>
+    </style>
 </resources>
diff --git a/java/res/values/themes-ics.xml b/java/res/values/themes-ics.xml
index 9f2523c863..f5b74838bd 100644
--- a/java/res/values/themes-ics.xml
+++ b/java/res/values/themes-ics.xml
@@ -18,7 +18,7 @@
 */
 -->
 
-<resources>
+<resources xmlns:android="http://schemas.android.com/apk/res/android">
     <style name="KeyboardTheme.ICS" parent="KeyboardIcons.ICS">
         <item name="keyboardStyle">@style/Keyboard.ICS</item>
         <item name="keyboardViewStyle">@style/KeyboardView.ICS</item>
@@ -26,10 +26,9 @@
         <item name="emojiKeyboardViewStyle">@style/EmojiKeyboardView.ICS</item>
         <item name="moreKeysKeyboardStyle">@style/MoreKeysKeyboard.ICS</item>
         <item name="moreKeysKeyboardViewStyle">@style/MoreKeysKeyboardView.ICS</item>
+        <item name="moreKeysKeyboardContainerStyle">@style/MoreKeysKeyboardContainer.ICS</item>
         <item name="suggestionStripViewStyle">@style/SuggestionStripView.ICS</item>
-        <item name="moreKeysKeyboardBackground">@drawable/keyboard_popup_panel_background_holo</item>
-        <item name="suggestionStripBackground">@drawable/keyboard_suggest_strip_holo</item>
-        <item name="suggestionBackground">@drawable/btn_suggestion_ics</item>
+        <item name="suggestionWordStyle">@style/SuggestionWord.ICS</item>
     </style>
     <style name="KeyboardIcons.ICS">
         <!-- Keyboard icons -->
@@ -123,10 +122,16 @@
         <item name="keyTypeface">normal</item>
         <item name="verticalCorrection">@dimen/more_keys_keyboard_vertical_correction_ics</item>
     </style>
+    <style
+        name="MoreKeysKeyboardContainer.ICS"
+    >
+        <item name="android:background">@drawable/keyboard_popup_panel_background_holo</item>
+    </style>
     <style
         name="SuggestionStripView.ICS"
         parent="SuggestionStripView"
     >
+        <item name="android:background">@drawable/keyboard_suggest_strip_holo</item>
         <item name="suggestionStripOption">autoCorrectBold|validTypedWordBold</item>
         <item name="colorValidTypedWord">@color/typed_word_color_ics</item>
         <item name="colorTypedWord">@color/typed_word_color_ics</item>
@@ -134,8 +139,7 @@
         <item name="colorSuggested">@color/suggested_word_color_ics</item>
         <item name="alphaObsoleted">70%</item>
     </style>
-    <style name="MoreKeysKeyboardAnimation">
-        <item name="android:windowEnterAnimation">@anim/more_keys_keyboard_fadein</item>
-        <item name="android:windowExitAnimation">@anim/more_keys_keyboard_fadeout</item>
+    <style name="SuggestionWord.ICS">
+        <item name="android:background">@drawable/btn_suggestion_ics</item>
     </style>
 </resources>
-- 
GitLab