Merge "Small performance fix."
diff --git a/java/res/layout/candidates_strip.xml b/java/res/layout/candidates_strip.xml
index 296ea75..88f4c38 100644
--- a/java/res/layout/candidates_strip.xml
+++ b/java/res/layout/candidates_strip.xml
@@ -42,20 +42,18 @@
         <include
             android:id="@+id/candidate_right"
             layout="@layout/candidate" />
-        <!-- TODO: These images' drawable must be determined depending on theme. -->
+        <!-- Image drawables are set in CandidateView constructor -->
         <ImageButton
             android:id="@+id/expand_candidates_pane"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
-            android:src="@drawable/btn_expand_candidates_pane"
             android:visibility="gone"
-            style="?attr/suggestionBackgroundStyle" />
+            style="?attr/suggestionsStripBackgroundStyle" />
         <ImageButton
             android:id="@+id/close_candidates_pane"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
-            android:src="@drawable/btn_close_candidates_pane"
             android:visibility="gone"
-            style="?attr/suggestionBackgroundStyle" />
+            style="?attr/suggestionsStripBackgroundStyle" />
     </LinearLayout>
 </merge>
diff --git a/java/res/layout/input_view.xml b/java/res/layout/input_view.xml
index 52b5ecc..f0a8ef9 100644
--- a/java/res/layout/input_view.xml
+++ b/java/res/layout/input_view.xml
@@ -44,8 +44,7 @@
             android:layout_weight="1.0"
             android:layout_width="0dp"
             android:layout_height="@dimen/candidate_strip_height"
-            android:gravity="center_vertical"
-            style="?attr/suggestionsStripBackgroundStyle" />
+            android:gravity="center_vertical" />
         <View
             android:layout_width="@dimen/candidate_strip_padding"
             android:layout_height="@dimen/candidate_strip_height"
diff --git a/java/res/values-sw600dp/config.xml b/java/res/values-sw600dp/config.xml
index c3d3445..6125270 100644
--- a/java/res/values-sw600dp/config.xml
+++ b/java/res/values-sw600dp/config.xml
@@ -26,7 +26,6 @@
     <bool name="config_enable_show_recorrection_option">false</bool>
     <bool name="config_enable_quick_fixes_option">false</bool>
     <bool name="config_enable_bigram_suggestions_option">false</bool>
-    <bool name="config_candidate_highlight_font_color_enabled">false</bool>
     <bool name="config_swipe_down_dismiss_keyboard_enabled">false</bool>
     <bool name="config_sliding_key_input_enabled">false</bool>
     <bool name="config_digit_popup_characters_enabled">false</bool>
diff --git a/java/res/values-sw768dp/config.xml b/java/res/values-sw768dp/config.xml
index 663332f..95d5e7e 100644
--- a/java/res/values-sw768dp/config.xml
+++ b/java/res/values-sw768dp/config.xml
@@ -26,7 +26,6 @@
     <bool name="config_enable_show_recorrection_option">false</bool>
     <bool name="config_enable_quick_fixes_option">false</bool>
     <bool name="config_enable_bigram_suggestions_option">false</bool>
-    <bool name="config_candidate_highlight_font_color_enabled">false</bool>
     <bool name="config_swipe_down_dismiss_keyboard_enabled">false</bool>
     <bool name="config_sliding_key_input_enabled">false</bool>
     <bool name="config_digit_popup_characters_enabled">false</bool>
diff --git a/java/res/values/attrs.xml b/java/res/values/attrs.xml
index 5557dde..3bed880 100644
--- a/java/res/values/attrs.xml
+++ b/java/res/values/attrs.xml
@@ -16,6 +16,10 @@
 
 <resources>
     <declare-styleable name="KeyboardTheme">
+        <!-- Keyboard style -->
+        <attr name="keyboardStyle" format="reference" />
+        <!-- LatinKeyboard style -->
+        <attr name="latinKeyboardStyle" format="reference" />
         <!-- KeyboardView style -->
         <attr name="keyboardViewStyle" format="reference" />
         <attr name="keyPreviewStyle" format="reference" />
@@ -26,6 +30,7 @@
         <attr name="suggestionsStripBackgroundStyle" format="reference" />
         <attr name="suggestionBackgroundStyle" format="reference" />
         <attr name="suggestionPreviewBackgroundStyle" format="reference" />
+        <attr name="candidateViewStyle" format="reference" />
     </declare-styleable>
 
     <declare-styleable name="KeyboardView">
@@ -86,6 +91,19 @@
 
     </declare-styleable>
 
+    <declare-styleable name="CandidateView">
+        <attr name="autoCorrectHighlight" format="integer">
+            <flag name="autoCorrectBold" value="0x01" />
+            <flag name="autoCorrectUnderline" value="0x02" />
+            <flag name="autoCorrectInvert" value="0x04" />
+        </attr>
+        <attr name="colorTypedWord" format="color" />
+        <attr name="colorAutoCorrect" format="color" />
+        <attr name="colorSuggested" format="color" />
+        <attr name="iconExpandPane" format="reference" />
+        <attr name="iconClosePane" format="reference" />
+    </declare-styleable>
+
     <declare-styleable name="Keyboard">
         <!-- Default keyboard height -->
         <attr name="keyboardHeight" format="dimension" />
@@ -113,6 +131,8 @@
         <attr name="verticalGap" format="dimension|fraction" />
         <!-- Popup keyboard layout template -->
         <attr name="popupKeyboardTemplate" format="reference" />
+        <!-- Popup hint icon -->
+        <attr name="popupHintIcon" format="reference" />
         <!-- Locale of the keyboard layout -->
         <attr name="keyboardLocale" format="string" />
     </declare-styleable>
@@ -146,10 +166,11 @@
         <!-- The key label option -->
         <attr name="keyLabelOption" format="integer">
             <!-- This should be aligned with KeyboardView.KEY_LABEL_OPTION_* -->
-            <flag name="alignLeft" value="1" />
-            <flag name="alignRight" value="2" />
-            <flag name="alignBottom" value="8" />
-            <flag name="fontNormal" value="16" />
+            <flag name="alignLeft" value="0x01" />
+            <flag name="alignRight" value="0x02" />
+            <flag name="alignBottom" value="0x08" />
+            <flag name="fontNormal" value="0x10" />
+            <flag name="popupHint" value="0x20" />
         </attr>
         <!-- The unicode that this key generates in manual temporary upper case mode. -->
         <attr name="manualTemporaryUpperCaseCode" format="integer" />
@@ -200,9 +221,9 @@
         </attr>
         <attr name="webInput" format="boolean" />
         <attr name="passwordInput" format="boolean" />
-        <attr name="hasSettingsKey" format="string" />
-        <attr name="voiceKeyEnabled" format="string" />
-        <attr name="hasVoiceKey" format="string" />
+        <attr name="hasSettingsKey" format="boolean" />
+        <attr name="voiceKeyEnabled" format="boolean" />
+        <attr name="hasVoiceKey" format="boolean" />
         <attr name="imeAction" format="enum">
             <!-- This should be aligned with EditorInfo.IME_ACTION_* -->
             <enum name="actionUnspecified" value="0" />
@@ -223,4 +244,15 @@
         <attr name="styleName" format="string" />
         <attr name="parentStyle" format="string" />
     </declare-styleable>
+
+    <declare-styleable name="LatinKeyboard">
+        <attr name="autoCorrectionSpacebarLedIcon" format="reference" />
+        <attr name="disabledShortcutIcon" format="reference" />
+        <attr name="spacebarTextColor" format="color" />
+        <attr name="spacebarTextShadowColor" format="color" />
+        <attr name="spacebarArrowLeftIcon" format="reference" />
+        <attr name="spacebarArrowRightIcon" format="reference" />
+        <attr name="spacebarArrowPreviewLeftIcon" format="reference" />
+        <attr name="spacebarArrowPreviewRightIcon" format="reference" />
+    </declare-styleable>
 </resources>
diff --git a/java/res/values/colors.xml b/java/res/values/colors.xml
index 05d137e..d786918 100644
--- a/java/res/values/colors.xml
+++ b/java/res/values/colors.xml
@@ -18,9 +18,6 @@
 */
 -->
 <resources>
-    <color name="candidate_typed_word">#FFFFFFFF</color>
-    <color name="candidate_auto_correct">#FFFCAE00</color>
-    <color name="candidate_suggested">#FFFCAE00</color>
     <color name="latinkeyboard_bar_language_shadow_white">#80000000</color>
     <color name="latinkeyboard_bar_language_shadow_black">#80FFFFFF</color>
     <color name="latinkeyboard_bar_language_text">#FFC0C0C0</color>
diff --git a/java/res/values/config.xml b/java/res/values/config.xml
index c61a6d5..a08e2ae 100644
--- a/java/res/values/config.xml
+++ b/java/res/values/config.xml
@@ -27,7 +27,6 @@
     <bool name="config_enable_quick_fixes_option">true</bool>
     <bool name="config_enable_bigram_suggestions_option">true</bool>
     <bool name="config_enable_usability_study_mode_option">false</bool>
-    <bool name="config_candidate_highlight_font_color_enabled">true</bool>
     <bool name="config_swipe_down_dismiss_keyboard_enabled">true</bool>
     <bool name="config_sliding_key_input_enabled">true</bool>
     <bool name="config_digit_popup_characters_enabled">true</bool>
diff --git a/java/res/values/styles.xml b/java/res/values/styles.xml
index 7cb4593..37f1fe3 100644
--- a/java/res/values/styles.xml
+++ b/java/res/values/styles.xml
@@ -16,6 +16,19 @@
 
 <resources>
     <!-- Theme "Basic" -->
+    <style name="Keyboard">
+        <item name="popupHintIcon">@drawable/hint_popup</item>
+    </style>
+    <style name="LatinKeyboard">
+        <item name="autoCorrectionSpacebarLedIcon">@drawable/sym_keyboard_space_led</item>
+        <item name="disabledShortcutIcon">@drawable/sym_keyboard_voice_off_holo</item>
+        <item name="spacebarTextColor">@color/latinkeyboard_bar_language_text</item>
+        <item name="spacebarTextShadowColor">@color/latinkeyboard_bar_language_shadow_white</item>
+        <item name="spacebarArrowLeftIcon">@drawable/sym_keyboard_language_arrows_left</item>
+        <item name="spacebarArrowRightIcon">@drawable/sym_keyboard_language_arrows_right</item>
+        <item name="spacebarArrowPreviewLeftIcon">@drawable/sym_keyboard_feedback_language_arrows_left</item>
+        <item name="spacebarArrowPreviewRightIcon">@drawable/sym_keyboard_feedback_language_arrows_right</item>
+    </style>
     <style name="KeyboardView">
         <item name="android:background">@drawable/keyboard_background</item>
         <item name="keyBackground">@drawable/btn_keyboard_key</item>
@@ -57,12 +70,24 @@
     <style name="SuggestionPreviewBackgroundStyle">
         <item name="android:background">@drawable/candidate_feedback_background</item>
     </style>
+    <style name="CandidateViewStyle" parent="SuggestionsStripBackgroundStyle">
+        <item name="colorTypedWord">#FFFFFFFF</item>
+        <item name="colorAutoCorrect">#FFFCAE00</item>
+        <item name="colorSuggested">#FFFCAE00</item>
+        <item name="iconExpandPane">@drawable/btn_expand_candidates_pane</item>
+        <item name="iconClosePane">@drawable/btn_close_candidates_pane</item>"
+    </style>
     <!-- Theme "Basic high contrast" -->
     <style name="KeyboardView.HighContrast" parent="KeyboardView">
         <item name="android:background">@android:color/black</item>
         <item name="keyBackground">@drawable/btn_keyboard_key3</item>
     </style>
     <!-- Theme "Stone" -->
+    <style name="LatinKeyboard.Stone" patent="LatinKeyboard">
+        <item name="spacebarTextColor">#FF444444</item>
+        <item name="spacebarTextShadowColor">@color/latinkeyboard_bar_language_shadow_black</item>
+        <item name="disabledShortcutIcon">@drawable/sym_bkeyboard_voice_off</item>
+    </style>
     <style name="KeyboardView.Stone" parent="KeyboardView">
         <item name="keyBackground">@drawable/btn_keyboard_key_stone</item>
         <item name="keyTextColor">@color/latinkeyboard_key_color_black</item>
@@ -89,6 +114,13 @@
         <item name="android:background">@null</item>
     </style>
     <!-- Theme "Honeycomb" -->
+    <style name="Keyboard.Honeycomb" parent="Keyboard" >
+        <item name="popupHintIcon">@drawable/hint_popup_holo</item>
+    </style>
+    <style name="LatinKeyboard.Honeycomb" parent="LatinKeyboard">
+        <item name="autoCorrectionSpacebarLedIcon">@null</item>
+        <item name="disabledShortcutIcon">@drawable/sym_keyboard_voice_off_holo</item>
+    </style>
     <style name="KeyboardView.Honeycomb" parent="KeyboardView">
         <item name="android:background">@drawable/keyboard_background_holo</item>
         <item name="keyBackground">@drawable/btn_keyboard_key_honeycomb</item>
@@ -111,15 +143,23 @@
         <item name="android:paddingLeft">@dimen/mini_keyboard_horizontal_padding_holo</item>
         <item name="android:paddingRight">@dimen/mini_keyboard_horizontal_padding_holo</item>
     </style>
-    <style name="SuggestionsStripBackgroundStyle.Holo">
+    <style name="SuggestionsStripBackgroundStyle.Honeycomb">
         <item name="android:background">@drawable/keyboard_suggest_strip_holo</item>
     </style>
-    <style name="SuggestionBackgroundStyle.Holo">
+    <style name="SuggestionBackgroundStyle.Honeycomb">
         <item name="android:background">@drawable/btn_candidate_holo</item>
     </style>
-    <style name="SuggestionPreviewBackgroundStyle.Holo">
+    <style name="SuggestionPreviewBackgroundStyle.Honeycomb">
         <item name="android:background">@drawable/keyboard_popup_panel_background_holo</item>
     </style>
+    <style name="CandidateViewStyle.Honeycomb" parent="SuggestionsStripBackgroundStyle.Honeycomb">
+        <item name="autoCorrectHighlight">autoCorrectUnderline|autoCorrectInvert</item>
+        <item name="colorTypedWord">#FFFFFFFF</item>
+        <item name="colorAutoCorrect">#FFFFFFFF</item>
+        <item name="colorSuggested">#FFFFFFFF</item>
+        <item name="iconExpandPane">@drawable/btn_expand_candidates_pane</item>
+        <item name="iconClosePane">@drawable/btn_close_candidates_pane</item>"
+    </style>
     <style name="PopupMiniKeyboardAnimation">
         <item name="android:windowEnterAnimation">@anim/mini_keyboard_fadein</item>
         <item name="android:windowExitAnimation">@anim/mini_keyboard_fadeout</item>
diff --git a/java/res/values/themes.xml b/java/res/values/themes.xml
index 5315a9a..728ce5a 100644
--- a/java/res/values/themes.xml
+++ b/java/res/values/themes.xml
@@ -16,6 +16,8 @@
 
 <resources>
     <style name="KeyboardTheme" parent="android:Theme">
+        <item name="keyboardStyle">@style/Keyboard</item>
+        <item name="latinKeyboardStyle">@style/LatinKeyboard</item>
         <item name="keyboardViewStyle">@style/KeyboardView</item>
         <item name="keyPreviewStyle">@style/KeyPreviewStyle</item>
         <item name="popupMiniKeyboardViewStyle">@style/PopupMiniKeyboardView</item>
@@ -23,45 +25,61 @@
         <item name="suggestionsStripBackgroundStyle">@style/SuggestionsStripBackgroundStyle</item>
         <item name="suggestionBackgroundStyle">@style/SuggestionBackgroundStyle</item>
         <item name="suggestionPreviewBackgroundStyle">@style/SuggestionPreviewBackgroundStyle</item>
+        <item name="candidateViewStyle">@style/CandidateViewStyle</item>
     </style>
     <style name="KeyboardTheme.HighContrast" parent="android:Theme">
+        <item name="keyboardStyle">@style/Keyboard</item>
+        <item name="latinKeyboardStyle">@style/LatinKeyboard</item>
         <item name="keyboardViewStyle">@style/KeyboardView.HighContrast</item>
         <item name="keyPreviewStyle">@style/KeyPreviewStyle</item>
         <item name="popupMiniKeyboardViewStyle">@style/PopupMiniKeyboardView</item>
         <item name="popupMiniKeyboardPanelStyle">@style/PopupMiniKeyboardPanelStyle</item>
         <item name="suggestionsStripBackgroundStyle">@style/SuggestionsStripBackgroundStyle</item>
         <item name="suggestionBackgroundStyle">@style/SuggestionBackgroundStyle</item>
+        <item name="candidateViewStyle">@style/CandidateViewStyle</item>
     </style>
     <style name="KeyboardTheme.Stone" parent="android:Theme.Light">
+        <item name="keyboardStyle">@style/Keyboard</item>
+        <item name="latinKeyboardStyle">@style/LatinKeyboard.Stone</item>
         <item name="keyboardViewStyle">@style/KeyboardView.Stone</item>
         <item name="keyPreviewStyle">@style/KeyPreviewStyle</item>
         <item name="popupMiniKeyboardViewStyle">@style/PopupMiniKeyboardView.Stone</item>
         <item name="popupMiniKeyboardPanelStyle">@style/PopupMiniKeyboardPanelStyle</item>
         <item name="suggestionsStripBackgroundStyle">@style/SuggestionsStripBackgroundStyle</item>
         <item name="suggestionBackgroundStyle">@style/SuggestionBackgroundStyle</item>
+        <item name="candidateViewStyle">@style/CandidateViewStyle</item>
     </style>
     <style name="KeyboardTheme.Stone.Bold" parent="android:Theme.Light">
+        <item name="keyboardStyle">@style/Keyboard</item>
+        <item name="latinKeyboardStyle">@style/LatinKeyboard.Stone</item>
         <item name="keyboardViewStyle">@style/KeyboardView.Stone.Bold</item>
         <item name="keyPreviewStyle">@style/KeyPreviewStyle</item>
         <item name="popupMiniKeyboardViewStyle">@style/PopupMiniKeyboardView.Stone</item>
         <item name="popupMiniKeyboardPanelStyle">@style/PopupMiniKeyboardPanelStyle</item>
         <item name="suggestionsStripBackgroundStyle">@style/SuggestionsStripBackgroundStyle</item>
         <item name="suggestionBackgroundStyle">@style/SuggestionBackgroundStyle</item>
+        <item name="candidateViewStyle">@style/CandidateViewStyle</item>
     </style>
     <style name="KeyboardTheme.Gingerbread" parent="android:Theme.Black">
+        <item name="keyboardStyle">@style/Keyboard</item>
+        <item name="latinKeyboardStyle">@style/LatinKeyboard</item>
         <item name="keyboardViewStyle">@style/KeyboardView.Gingerbread</item>
         <item name="keyPreviewStyle">@style/KeyPreviewStyle</item>
         <item name="popupMiniKeyboardViewStyle">@style/PopupMiniKeyboardView.Gingerbread</item>
         <item name="popupMiniKeyboardPanelStyle">@style/PopupMiniKeyboardPanelStyle</item>
         <item name="suggestionsStripBackgroundStyle">@style/SuggestionsStripBackgroundStyle</item>
         <item name="suggestionBackgroundStyle">@style/SuggestionBackgroundStyle</item>
+        <item name="candidateViewStyle">@style/CandidateViewStyle</item>
     </style>
     <style name="KeyboardTheme.Honeycomb" parent="android:Theme.Holo">
+        <item name="keyboardStyle">@style/Keyboard.Honeycomb</item>
+        <item name="latinKeyboardStyle">@style/LatinKeyboard.Honeycomb</item>
         <item name="keyboardViewStyle">@style/KeyboardView.Honeycomb</item>
         <item name="keyPreviewStyle">@style/KeyPreviewStyle.Honeycomb</item>
         <item name="popupMiniKeyboardViewStyle">@style/PopupMiniKeyboardView.Honeycomb</item>
         <item name="popupMiniKeyboardPanelStyle">@style/PopupMiniKeyboardPanelStyle.Honeycomb</item>
-        <item name="suggestionsStripBackgroundStyle">@style/SuggestionsStripBackgroundStyle.Holo</item>
-        <item name="suggestionBackgroundStyle">@style/SuggestionBackgroundStyle.Holo</item>
+        <item name="suggestionsStripBackgroundStyle">@style/SuggestionsStripBackgroundStyle.Honeycomb</item>
+        <item name="suggestionBackgroundStyle">@style/SuggestionBackgroundStyle.Honeycomb</item>
+        <item name="candidateViewStyle">@style/CandidateViewStyle.Honeycomb</item>
     </style>
 </resources>
diff --git a/java/res/xml-sw600dp/kbd_key_styles.xml b/java/res/xml-sw600dp/kbd_key_styles.xml
index a98ffe6..a388879 100644
--- a/java/res/xml-sw600dp/kbd_key_styles.xml
+++ b/java/res/xml-sw600dp/kbd_key_styles.xml
@@ -75,7 +75,7 @@
                 latin:styleName="smileyKeyStyle"
                 latin:keyLabel=":-)"
                 latin:keyOutputText=":-) "
-                latin:keyHintIcon="@drawable/hint_popup_holo"
+                latin:keyLabelOption="popupHint"
                 latin:popupCharacters="@string/alternates_for_smiley"
                 latin:maxPopupKeyboardColumn="5" />
             <switch>
@@ -87,7 +87,7 @@
                         latin:code="@integer/key_shortcut"
                         latin:keyIcon="@drawable/sym_keyboard_voice_holo"
                         latin:iconPreview="@drawable/sym_keyboard_feedback_mic"
-                        latin:keyHintIcon="@drawable/hint_popup_holo"
+                        latin:keyLabelOption="popupHint"
                         latin:popupCharacters="\@drawable/sym_keyboard_settings|\@integer/key_settings"
                         latin:parentStyle="functionalKeyStyle" />
                 </case>
@@ -137,7 +137,7 @@
                 latin:styleName="smileyKeyStyle"
                 latin:keyLabel=":-)"
                 latin:keyOutputText=":-) "
-                latin:keyHintIcon="@drawable/hint_popup_holo"
+                latin:keyLabelOption="popupHint"
                 latin:popupCharacters="@string/alternates_for_smiley"
                 latin:maxPopupKeyboardColumn="5" />
             <switch>
@@ -149,7 +149,7 @@
                         latin:code="@integer/key_shortcut"
                         latin:keyIcon="@drawable/sym_bkeyboard_mic"
                         latin:iconPreview="@drawable/sym_keyboard_feedback_mic"
-                        latin:keyHintIcon="@drawable/hint_popup_holo"
+                        latin:keyLabelOption="popupHint"
                         latin:popupCharacters="\@drawable/sym_keyboard_settings|\@integer/key_settings"
                         latin:parentStyle="functionalKeyStyle" />
                 </case>
@@ -192,9 +192,8 @@
     <key-style
         latin:styleName="comKeyStyle"
         latin:keyLabel="@string/keylabel_for_popular_domain"
-        latin:keyLabelOption="fontNormal"
+        latin:keyLabelOption="fontNormal|popupHint"
         latin:keyOutputText="@string/keylabel_for_popular_domain"
-        latin:keyHintIcon="@drawable/hint_popup_holo"
         latin:popupCharacters="@string/alternates_for_popular_domain" />
     <switch>
         <case
diff --git a/java/res/xml-sw768dp/kbd_key_styles.xml b/java/res/xml-sw768dp/kbd_key_styles.xml
index 57eaccb..4388e89 100644
--- a/java/res/xml-sw768dp/kbd_key_styles.xml
+++ b/java/res/xml-sw768dp/kbd_key_styles.xml
@@ -62,7 +62,7 @@
                 latin:styleName="smileyKeyStyle"
                 latin:keyLabel=":-)"
                 latin:keyOutputText=":-) "
-                latin:keyHintIcon="@drawable/hint_popup_holo"
+                latin:keyLabelOption="popupHint"
                 latin:popupCharacters="@string/alternates_for_smiley"
                 latin:maxPopupKeyboardColumn="5" />
             <key-style
@@ -116,7 +116,7 @@
                 latin:styleName="smileyKeyStyle"
                 latin:keyLabel=":-)"
                 latin:keyOutputText=":-) "
-                latin:keyHintIcon="@drawable/hint_popup_holo"
+                latin:keyLabelOption="popupHint"
                 latin:popupCharacters="@string/alternates_for_smiley"
                 latin:maxPopupKeyboardColumn="5" />
             <key-style
@@ -161,9 +161,8 @@
     <key-style
         latin:styleName="comKeyStyle"
         latin:keyLabel="@string/keylabel_for_popular_domain"
-        latin:keyLabelOption="fontNormal"
+        latin:keyLabelOption="fontNormal|popupHint"
         latin:keyOutputText="@string/keylabel_for_popular_domain"
-        latin:keyHintIcon="@drawable/hint_popup_holo"
         latin:popupCharacters="@string/alternates_for_popular_domain" />
     <switch>
         <case
diff --git a/java/res/xml/kbd_key_styles.xml b/java/res/xml/kbd_key_styles.xml
index f888b23..63c019d 100644
--- a/java/res/xml/kbd_key_styles.xml
+++ b/java/res/xml/kbd_key_styles.xml
@@ -50,7 +50,7 @@
         <default>
             <key-style
                 latin:styleName="settingsPopupStyle"
-                latin:keyHintIcon="@drawable/hint_popup"
+                latin:keyLabelOption="popupHint"
                 latin:popupCharacters="\@drawable/sym_keyboard_settings_holo|\@integer/key_settings"
                 latin:parentStyle="functionalKeyStyle" />
         </default>
@@ -308,7 +308,7 @@
         latin:styleName="smileyKeyStyle"
         latin:keyLabel=":-)"
         latin:keyOutputText=":-) "
-        latin:keyHintIcon="@drawable/hint_popup"
+        latin:keyLabelOption="popupHint"
         latin:popupCharacters="@string/alternates_for_smiley"
         latin:maxPopupKeyboardColumn="5"
         latin:parentStyle="functionalKeyStyle" />
diff --git a/java/res/xml/kbd_qwerty_row4.xml b/java/res/xml/kbd_qwerty_row4.xml
index 21d80eb..dfe5de3 100644
--- a/java/res/xml/kbd_qwerty_row4.xml
+++ b/java/res/xml/kbd_qwerty_row4.xml
@@ -59,15 +59,15 @@
                 latin:webInput="true"
             >
                 <Key
-                    latin:keyHintIcon="@drawable/hint_popup"
+                    latin:keyStyle="tabKeyStyle"
+                    latin:keyLabelOption="popupHint"
                     latin:popupCharacters="@string/alternates_for_web_tab_punctuation"
-                    latin:maxPopupKeyboardColumn="8"
-                    latin:keyStyle="tabKeyStyle" />
+                    latin:maxPopupKeyboardColumn="8" />
             </case>
             <default>
                 <Key
                     latin:keyLabel="."
-                    latin:keyHintIcon="@drawable/hint_popup"
+                    latin:keyLabelOption="popupHint"
                     latin:popupCharacters="@string/alternates_for_punctuation"
                     latin:maxPopupKeyboardColumn="7"
                     latin:keyStyle="functionalKeyStyle" />
diff --git a/java/res/xml/kbd_symbols_row4.xml b/java/res/xml/kbd_symbols_row4.xml
index 726f7c3..704402a 100644
--- a/java/res/xml/kbd_symbols_row4.xml
+++ b/java/res/xml/kbd_symbols_row4.xml
@@ -56,7 +56,7 @@
         </switch>
         <Key
             latin:keyLabel="."
-            latin:keyHintIcon="@drawable/hint_popup"
+            latin:keyLabelOption="popupHint"
             latin:popupCharacters="@string/alternates_for_punctuation"
             latin:maxPopupKeyboardColumn="7"
             latin:keyStyle="functionalKeyStyle" />
diff --git a/java/src/com/android/inputmethod/keyboard/Keyboard.java b/java/src/com/android/inputmethod/keyboard/Keyboard.java
index 267abcc..77a4cde 100644
--- a/java/src/com/android/inputmethod/keyboard/Keyboard.java
+++ b/java/src/com/android/inputmethod/keyboard/Keyboard.java
@@ -16,15 +16,16 @@
 
 package com.android.inputmethod.keyboard;
 
+import android.content.Context;
+import android.content.res.Resources;
+import android.content.res.TypedArray;
+import android.graphics.drawable.Drawable;
+import android.util.Log;
+
 import com.android.inputmethod.latin.R;
 
 import org.xmlpull.v1.XmlPullParserException;
 
-import android.content.Context;
-import android.content.res.Resources;
-import android.graphics.drawable.Drawable;
-import android.util.Log;
-
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.HashMap;
@@ -146,6 +147,8 @@
 
     private final ProximityInfo mProximityInfo;
 
+    public final Drawable mPopupHintIcon;
+
     /**
      * Creates a keyboard from the given xml key layout file.
      * @param context the application or service context
@@ -171,8 +174,14 @@
         mDefaultVerticalGap = 0;
         mDefaultHeight = mDefaultWidth;
         mId = id;
-        loadKeyboard(context, xmlLayoutResId);
         mProximityInfo = new ProximityInfo(GRID_WIDTH, GRID_HEIGHT);
+
+        final TypedArray attrs = context.obtainStyledAttributes(
+                null, R.styleable.Keyboard, R.attr.keyboardStyle, R.style.Keyboard);
+        mPopupHintIcon = attrs.getDrawable(R.styleable.Keyboard_popupHintIcon);
+        attrs.recycle();
+
+        loadKeyboard(context, xmlLayoutResId);
     }
 
     public int getProximityInfo() {
diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardParser.java b/java/src/com/android/inputmethod/keyboard/KeyboardParser.java
index c2db62a..07166b1 100644
--- a/java/src/com/android/inputmethod/keyboard/KeyboardParser.java
+++ b/java/src/com/android/inputmethod/keyboard/KeyboardParser.java
@@ -16,12 +16,6 @@
 
 package com.android.inputmethod.keyboard;
 
-import com.android.inputmethod.compat.EditorInfoCompatUtils;
-import com.android.inputmethod.latin.R;
-
-import org.xmlpull.v1.XmlPullParser;
-import org.xmlpull.v1.XmlPullParserException;
-
 import android.content.Context;
 import android.content.res.Resources;
 import android.content.res.TypedArray;
@@ -31,6 +25,12 @@
 import android.util.Xml;
 import android.view.InflateException;
 
+import com.android.inputmethod.compat.EditorInfoCompatUtils;
+import com.android.inputmethod.latin.R;
+
+import org.xmlpull.v1.XmlPullParser;
+import org.xmlpull.v1.XmlPullParserException;
+
 import java.io.IOException;
 import java.util.Arrays;
 import java.util.List;
diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java b/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java
index 8e9c7ef..50c61ff 100644
--- a/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java
+++ b/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java
@@ -202,7 +202,9 @@
             final Locale savedLocale = Utils.setSystemLocale(res,
                     mSubtypeSwitcher.getInputLocale());
 
-            keyboard = new LatinKeyboard(mInputMethodService, id, id.mWidth);
+            final Context themeContext = new ContextThemeWrapper(mInputMethodService,
+                    KEYBOARD_THEMES[mThemeIndex]);
+            keyboard = new LatinKeyboard(themeContext, id, id.mWidth);
 
             if (id.mEnableShiftLock) {
                 keyboard.enableShiftLock();
diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardView.java b/java/src/com/android/inputmethod/keyboard/KeyboardView.java
index f8bce40..7182634 100644
--- a/java/src/com/android/inputmethod/keyboard/KeyboardView.java
+++ b/java/src/com/android/inputmethod/keyboard/KeyboardView.java
@@ -16,9 +16,6 @@
 
 package com.android.inputmethod.keyboard;
 
-import com.android.inputmethod.latin.LatinImeLogger;
-import com.android.inputmethod.latin.R;
-
 import android.content.Context;
 import android.content.pm.PackageManager;
 import android.content.res.Resources;
@@ -50,6 +47,9 @@
 import android.widget.PopupWindow;
 import android.widget.TextView;
 
+import com.android.inputmethod.latin.LatinImeLogger;
+import com.android.inputmethod.latin.R;
+
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.WeakHashMap;
@@ -176,10 +176,11 @@
     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;
-    private final int KEY_LABEL_OPTION_ALIGN_RIGHT = 2;
-    private final int KEY_LABEL_OPTION_ALIGN_BOTTOM = 8;
-    private final int KEY_LABEL_OPTION_FONT_NORMAL = 16;
+    private final int KEY_LABEL_OPTION_ALIGN_LEFT = 0x01;
+    private final int KEY_LABEL_OPTION_ALIGN_RIGHT = 0x02;
+    private final int KEY_LABEL_OPTION_ALIGN_BOTTOM = 0x08;
+    private final int KEY_LABEL_OPTION_FONT_NORMAL = 0x10;
+    private final int KEY_LABEL_OPTION_POPUP_HINT = 0x20;
     private final int mKeyLabelHorizontalPadding;
 
     private final UIHandler mHandler = new UIHandler();
@@ -333,6 +334,7 @@
         mKeyLetterStyle = Typeface.defaultFromStyle(
                 a.getInt(R.styleable.KeyboardView_keyLetterStyle, Typeface.NORMAL));
         mColorScheme = a.getInt(R.styleable.KeyboardView_colorScheme, COLOR_SCHEME_WHITE);
+        a.recycle();
 
         final Resources res = getResources();
 
@@ -762,14 +764,15 @@
         }
 
         // Draw hint icon.
-        if (key.mHintIcon != null) {
+        if (key.mHintIcon != null || (key.mLabelOption & KEY_LABEL_OPTION_POPUP_HINT) != 0) {
             final int drawableWidth = keyDrawWidth;
             final int drawableHeight = key.mHeight;
             final int drawableX = 0;
             final int drawableY = HINT_ICON_VERTICAL_ADJUSTMENT_PIXEL;
             Drawable hintIcon = (isManualTemporaryUpperCase
                     && key.mManualTemporaryUpperCaseHintIcon != null)
-                    ? key.mManualTemporaryUpperCaseHintIcon : key.mHintIcon;
+                    ? key.mManualTemporaryUpperCaseHintIcon
+                    : (key.mHintIcon != null ? key.mHintIcon : mKeyboard.mPopupHintIcon);
             drawIcon(canvas, hintIcon, drawableX, drawableY, drawableWidth, drawableHeight);
             if (DEBUG_SHOW_ALIGN)
                 drawRectangle(canvas, drawableX, drawableY, drawableWidth, drawableHeight,
diff --git a/java/src/com/android/inputmethod/keyboard/LatinKeyboard.java b/java/src/com/android/inputmethod/keyboard/LatinKeyboard.java
index fe27ab4..a6ac767 100644
--- a/java/src/com/android/inputmethod/keyboard/LatinKeyboard.java
+++ b/java/src/com/android/inputmethod/keyboard/LatinKeyboard.java
@@ -57,9 +57,9 @@
     private final Drawable mSpaceIcon;
     private final Drawable mSpacePreviewIcon;
     private final int mSpaceKeyIndex;
-    private final Drawable mSpaceAutoCorrectionIndicator;
-    private final Drawable mButtonArrowLeftIcon;
-    private final Drawable mButtonArrowRightIcon;
+    private final Drawable mAutoCorrectionSpacebarLedIcon;
+    private final Drawable mSpacebarArrowLeftIcon;
+    private final Drawable mSpacebarArrowRightIcon;
     private final int mSpacebarTextColor;
     private final int mSpacebarTextShadowColor;
     private float mSpacebarTextFadeFactor = 0.0f;
@@ -90,7 +90,6 @@
 
     public LatinKeyboard(Context context, KeyboardId id, int width) {
         super(context, id.getXmlId(), id, width);
-        final Resources res = context.getResources();
         mContext = context;
 
         final List<Key> keys = getKeys();
@@ -118,19 +117,20 @@
         mShortcutKey = (shortcutKeyIndex >= 0) ? keys.get(shortcutKeyIndex) : null;
         mEnabledShortcutIcon = (mShortcutKey != null) ? mShortcutKey.getIcon() : null;
 
-        mSpacebarTextColor = res.getColor(R.color.latinkeyboard_bar_language_text);
-        if (id.mColorScheme == KeyboardView.COLOR_SCHEME_BLACK) {
-            mSpacebarTextShadowColor = res.getColor(
-                    R.color.latinkeyboard_bar_language_shadow_black);
-            mDisabledShortcutIcon = res.getDrawable(R.drawable.sym_bkeyboard_voice_off);
-        } else { // default color scheme is KeyboardView.COLOR_SCHEME_WHITE
-            mSpacebarTextShadowColor = res.getColor(
-                    R.color.latinkeyboard_bar_language_shadow_white);
-            mDisabledShortcutIcon = res.getDrawable(R.drawable.sym_keyboard_voice_off_holo);
-        }
-        mSpaceAutoCorrectionIndicator = res.getDrawable(R.drawable.sym_keyboard_space_led);
-        mButtonArrowLeftIcon = res.getDrawable(R.drawable.sym_keyboard_language_arrows_left);
-        mButtonArrowRightIcon = res.getDrawable(R.drawable.sym_keyboard_language_arrows_right);
+        final TypedArray a = context.obtainStyledAttributes(
+                null, R.styleable.LatinKeyboard, R.attr.latinKeyboardStyle, R.style.LatinKeyboard);
+        mAutoCorrectionSpacebarLedIcon = a.getDrawable(
+                R.styleable.LatinKeyboard_autoCorrectionSpacebarLedIcon);
+        mDisabledShortcutIcon = a.getDrawable(R.styleable.LatinKeyboard_disabledShortcutIcon);
+        mSpacebarTextColor = a.getColor(R.styleable.LatinKeyboard_spacebarTextColor, 0);
+        mSpacebarTextShadowColor = a.getColor(
+                R.styleable.LatinKeyboard_spacebarTextShadowColor, 0);
+        mSpacebarArrowLeftIcon = a.getDrawable(
+                R.styleable.LatinKeyboard_spacebarArrowLeftIcon);
+        mSpacebarArrowRightIcon = a.getDrawable(
+                R.styleable.LatinKeyboard_spacebarArrowRightIcon);
+        a.recycle();
+
         // The threshold is "key width" x 1.25
         mSpacebarLanguageSwitchThreshold = (getMostCommonKeyWidth() * 5) / 4;
     }
@@ -163,6 +163,10 @@
             view.invalidateKey(mShortcutKey);
     }
 
+    public boolean needsAutoCorrectionSpacebarLed() {
+        return mAutoCorrectionSpacebarLedIcon != null;
+    }
+
     /**
      * @return a key which should be invalidated.
      */
@@ -282,7 +286,7 @@
             }
 
             final String language = layoutSpacebar(paint, inputLocale,
-                    mButtonArrowLeftIcon, mButtonArrowRightIcon, width, height,
+                    mSpacebarArrowLeftIcon, mSpacebarArrowRightIcon, width, height,
                     getTextSizeFromTheme(mContext.getTheme(), textStyle, defaultTextSize));
 
             // Draw language text with shadow
@@ -303,21 +307,21 @@
             if (mSubtypeSwitcher.useSpacebarLanguageSwitcher()
                     && mSubtypeSwitcher.getEnabledKeyboardLocaleCount() > 1
                     && !(isPhoneKeyboard() || isNumberKeyboard())) {
-                mButtonArrowLeftIcon.setColorFilter(getSpacebarDrawableFilter(textFadeFactor));
-                mButtonArrowRightIcon.setColorFilter(getSpacebarDrawableFilter(textFadeFactor));
-                mButtonArrowLeftIcon.draw(canvas);
-                mButtonArrowRightIcon.draw(canvas);
+                mSpacebarArrowLeftIcon.setColorFilter(getSpacebarDrawableFilter(textFadeFactor));
+                mSpacebarArrowRightIcon.setColorFilter(getSpacebarDrawableFilter(textFadeFactor));
+                mSpacebarArrowLeftIcon.draw(canvas);
+                mSpacebarArrowRightIcon.draw(canvas);
             }
         }
 
         // Draw the spacebar icon at the bottom
         if (isAutoCorrection) {
             final int iconWidth = width * SPACE_LED_LENGTH_PERCENT / 100;
-            final int iconHeight = mSpaceAutoCorrectionIndicator.getIntrinsicHeight();
+            final int iconHeight = mAutoCorrectionSpacebarLedIcon.getIntrinsicHeight();
             int x = (width - iconWidth) / 2;
             int y = height - iconHeight;
-            mSpaceAutoCorrectionIndicator.setBounds(x, y, x + iconWidth, y + iconHeight);
-            mSpaceAutoCorrectionIndicator.draw(canvas);
+            mAutoCorrectionSpacebarLedIcon.setBounds(x, y, x + iconWidth, y + iconHeight);
+            mAutoCorrectionSpacebarLedIcon.draw(canvas);
         } else if (mSpaceIcon != null) {
             final int iconWidth = mSpaceIcon.getIntrinsicWidth();
             final int iconHeight = mSpaceIcon.getIntrinsicHeight();
diff --git a/java/src/com/android/inputmethod/keyboard/SlidingLocaleDrawable.java b/java/src/com/android/inputmethod/keyboard/SlidingLocaleDrawable.java
index 5cf31cb..a20bf1c 100644
--- a/java/src/com/android/inputmethod/keyboard/SlidingLocaleDrawable.java
+++ b/java/src/com/android/inputmethod/keyboard/SlidingLocaleDrawable.java
@@ -16,22 +16,21 @@
 
 package com.android.inputmethod.keyboard;
 
-import com.android.inputmethod.latin.R;
-import com.android.inputmethod.latin.SubtypeSwitcher;
-
 import android.content.Context;
-import android.content.res.Resources;
 import android.content.res.TypedArray;
 import android.graphics.Canvas;
 import android.graphics.Color;
 import android.graphics.ColorFilter;
 import android.graphics.Paint;
-import android.graphics.PixelFormat;
 import android.graphics.Paint.Align;
+import android.graphics.PixelFormat;
 import android.graphics.drawable.Drawable;
 import android.text.TextPaint;
 import android.view.ViewConfiguration;
 
+import com.android.inputmethod.latin.R;
+import com.android.inputmethod.latin.SubtypeSwitcher;
+
 /**
  * Animation to be displayed on the spacebar preview popup when switching languages by swiping the
  * spacebar. It draws the current, previous and next languages and moves them by the delta of touch
@@ -39,16 +38,16 @@
  */
 public class SlidingLocaleDrawable extends Drawable {
     private static final int SLIDE_SPEED_MULTIPLIER_RATIO = 150;
-    private final Context mContext;
-    private final Resources mRes;
     private final int mWidth;
     private final int mHeight;
     private final Drawable mBackground;
+    private final int mSpacebarTextColor;
     private final TextPaint mTextPaint;
     private final int mMiddleX;
     private final Drawable mLeftDrawable;
     private final Drawable mRightDrawable;
     private final int mThreshold;
+
     private int mDiff;
     private boolean mHitThreshold;
     private String mCurrentLanguage;
@@ -56,29 +55,31 @@
     private String mPrevLanguage;
 
     public SlidingLocaleDrawable(Context context, Drawable background, int width, int height) {
-        mContext = context;
-        mRes = context.getResources();
         mBackground = background;
         Keyboard.setDefaultBounds(mBackground);
         mWidth = width;
         mHeight = height;
         final TextPaint textPaint = new TextPaint();
-        textPaint.setTextSize(getTextSizeFromTheme(android.R.style.TextAppearance_Medium, 18));
+        textPaint.setTextSize(getTextSizeFromTheme(
+                context, android.R.style.TextAppearance_Medium, 18));
         textPaint.setColor(Color.TRANSPARENT);
         textPaint.setTextAlign(Align.CENTER);
         textPaint.setAntiAlias(true);
         mTextPaint = textPaint;
         mMiddleX = (mWidth - mBackground.getIntrinsicWidth()) / 2;
-        final Resources res = mRes;
-        mLeftDrawable = res.getDrawable(
-                R.drawable.sym_keyboard_feedback_language_arrows_left);
-        mRightDrawable = res.getDrawable(
-                R.drawable.sym_keyboard_feedback_language_arrows_right);
-        mThreshold = ViewConfiguration.get(mContext).getScaledTouchSlop();
+
+        final TypedArray a = context.obtainStyledAttributes(
+                null, R.styleable.LatinKeyboard, R.attr.latinKeyboardStyle, R.style.LatinKeyboard);
+        mSpacebarTextColor = a.getColor(R.styleable.LatinKeyboard_spacebarTextColor, 0);
+        mLeftDrawable = a.getDrawable(R.styleable.LatinKeyboard_spacebarArrowPreviewLeftIcon);
+        mRightDrawable = a.getDrawable(R.styleable.LatinKeyboard_spacebarArrowPreviewRightIcon);
+        a.recycle();
+
+        mThreshold = ViewConfiguration.get(context).getScaledTouchSlop();
     }
 
-    private int getTextSizeFromTheme(int style, int defValue) {
-        TypedArray array = mContext.getTheme().obtainStyledAttributes(
+    private static int getTextSizeFromTheme(Context context, int style, int defValue) {
+        TypedArray array = context.getTheme().obtainStyledAttributes(
                 style, new int[] { android.R.attr.textSize });
         int textSize = array.getDimensionPixelSize(array.getResourceId(0, 0), defValue);
         return textSize;
@@ -118,7 +119,7 @@
             // Draw language text with shadow
             final float baseline = mHeight * LatinKeyboard.SPACEBAR_LANGUAGE_BASELINE
                     - paint.descent();
-            paint.setColor(mRes.getColor(R.color.latinkeyboard_feedback_language_text));
+            paint.setColor(mSpacebarTextColor);
             canvas.drawText(mCurrentLanguage, width / 2 + diff, baseline, paint);
             canvas.drawText(mNextLanguage, diff - width / 2, baseline, paint);
             canvas.drawText(mPrevLanguage, diff + width + width / 2, baseline, paint);
diff --git a/java/src/com/android/inputmethod/latin/CandidateView.java b/java/src/com/android/inputmethod/latin/CandidateView.java
index 481092c..2a29e1f 100644
--- a/java/src/com/android/inputmethod/latin/CandidateView.java
+++ b/java/src/com/android/inputmethod/latin/CandidateView.java
@@ -18,6 +18,7 @@
 
 import android.content.Context;
 import android.content.res.Resources;
+import android.content.res.TypedArray;
 import android.graphics.Color;
 import android.graphics.Typeface;
 import android.os.Handler;
@@ -38,6 +39,7 @@
 import android.view.View.OnClickListener;
 import android.view.View.OnLongClickListener;
 import android.view.ViewGroup;
+import android.widget.ImageView;
 import android.widget.LinearLayout;
 import android.widget.PopupWindow;
 import android.widget.TextView;
@@ -64,8 +66,8 @@
     private static final boolean DBG = LatinImeLogger.sDBG;
 
     private static final int NUM_CANDIDATES_IN_STRIP = 3;
-    private final View mExpandCandidatesPane;
-    private final View mCloseCandidatesPane;
+    private final ImageView mExpandCandidatesPane;
+    private final ImageView mCloseCandidatesPane;
     private ViewGroup mCandidatesPane;
     private ViewGroup mCandidatesPaneContainer;
     private View mKeyboardView;
@@ -73,9 +75,12 @@
     private final ArrayList<View> mDividers = new ArrayList<View>();
     private final int mCandidatePadding;
     private final int mCandidateStripHeight;
-    private final boolean mConfigCandidateHighlightFontColorEnabled;
     private final CharacterStyle mInvertedForegroundColorSpan;
     private final CharacterStyle mInvertedBackgroundColorSpan;
+    private final int mAutoCorrectHighlight;
+    private static final int AUTO_CORRECT_BOLD = 0x01;
+    private static final int AUTO_CORRECT_UNDERLINE = 0x02;
+    private static final int AUTO_CORRECT_INVERT = 0x04;
     private final int mColorTypedWord;
     private final int mColorAutoCorrect;
     private final int mColorSuggestedCandidate;
@@ -139,7 +144,11 @@
      * @param attrs
      */
     public CandidateView(Context context, AttributeSet attrs) {
-        super(context, attrs);
+        this(context, attrs, R.attr.candidateViewStyle);
+    }
+
+    public CandidateView(Context context, AttributeSet attrs, int defStyle) {
+        super(context, attrs, defStyle);
 
         Resources res = context.getResources();
         LayoutInflater inflater = LayoutInflater.from(context);
@@ -151,13 +160,6 @@
                 ViewGroup.LayoutParams.WRAP_CONTENT);
         mPreviewPopup.setContentView(mPreviewText);
         mPreviewPopup.setBackgroundDrawable(null);
-        mConfigCandidateHighlightFontColorEnabled =
-                res.getBoolean(R.bool.config_candidate_highlight_font_color_enabled);
-        mColorTypedWord = res.getColor(R.color.candidate_typed_word);
-        mColorAutoCorrect = res.getColor(R.color.candidate_auto_correct);
-        mColorSuggestedCandidate = res.getColor(R.color.candidate_suggested);
-        mInvertedForegroundColorSpan = new ForegroundColorSpan(mColorTypedWord ^ 0x00ffffff);
-        mInvertedBackgroundColorSpan = new BackgroundColorSpan(mColorTypedWord);
 
         mCandidatePadding = res.getDimensionPixelOffset(R.dimen.candidate_padding);
         mCandidateStripHeight = res.getDimensionPixelOffset(R.dimen.candidate_strip_height);
@@ -192,20 +194,35 @@
             }
         }
 
-        mExpandCandidatesPane = findViewById(R.id.expand_candidates_pane);
+        final TypedArray a = context.obtainStyledAttributes(
+                attrs, R.styleable.CandidateView, defStyle, R.style.CandidateViewStyle);
+        mAutoCorrectHighlight = a.getInt(R.styleable.CandidateView_autoCorrectHighlight, 0);
+        mColorTypedWord = a.getColor(R.styleable.CandidateView_colorTypedWord, 0);
+        mColorAutoCorrect = a.getColor(R.styleable.CandidateView_colorAutoCorrect, 0);
+        mColorSuggestedCandidate = a.getColor(R.styleable.CandidateView_colorSuggested, 0);
+        mInvertedForegroundColorSpan = new ForegroundColorSpan(mColorTypedWord ^ 0x00ffffff);
+        mInvertedBackgroundColorSpan = new BackgroundColorSpan(mColorTypedWord);
+
+        mExpandCandidatesPane = (ImageView)findViewById(R.id.expand_candidates_pane);
+        mExpandCandidatesPane.setImageDrawable(
+                a.getDrawable(R.styleable.CandidateView_iconExpandPane));
         mExpandCandidatesPane.setOnClickListener(new OnClickListener() {
             @Override
             public void onClick(View view) {
                 expandCandidatesPane();
             }
         });
-        mCloseCandidatesPane = findViewById(R.id.close_candidates_pane);
+        mCloseCandidatesPane = (ImageView)findViewById(R.id.close_candidates_pane);
+        mCloseCandidatesPane.setImageDrawable(
+                a.getDrawable(R.styleable.CandidateView_iconClosePane));
         mCloseCandidatesPane.setOnClickListener(new OnClickListener() {
             @Override
             public void onClick(View view) {
                 closeCandidatesPane();
             }
         });
+
+        a.recycle();
     }
 
     /**
@@ -244,19 +261,20 @@
     private CharSequence getStyledCandidateWord(CharSequence word, boolean isAutoCorrect) {
         if (!isAutoCorrect)
             return word;
-        final CharacterStyle style = mConfigCandidateHighlightFontColorEnabled ? BOLD_SPAN
-                : UNDERLINE_SPAN;
         final Spannable spannedWord = new SpannableString(word);
-        spannedWord.setSpan(style, 0, word.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
+        if ((mAutoCorrectHighlight & AUTO_CORRECT_BOLD) != 0)
+            spannedWord.setSpan(BOLD_SPAN, 0, word.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
+        if ((mAutoCorrectHighlight & AUTO_CORRECT_UNDERLINE) != 0)
+            spannedWord.setSpan(UNDERLINE_SPAN, 0, word.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
         return spannedWord;
     }
 
     private int getCandidateTextColor(boolean isAutoCorrect, boolean isSuggestedCandidate,
             SuggestedWordInfo info) {
         final int color;
-        if (isAutoCorrect && mConfigCandidateHighlightFontColorEnabled) {
+        if (isAutoCorrect) {
             color = mColorAutoCorrect;
-        } else if (isSuggestedCandidate && mConfigCandidateHighlightFontColorEnabled) {
+        } else if (isSuggestedCandidate) {
             color = mColorSuggestedCandidate;
         } else {
             color = mColorTypedWord;
@@ -388,9 +406,7 @@
     }
 
     public void onAutoCorrectionInverted(CharSequence autoCorrectedWord) {
-        // Displaying auto corrected word as inverted is enabled only when highlighting candidate
-        // with color is disabled.
-        if (mConfigCandidateHighlightFontColorEnabled)
+        if ((mAutoCorrectHighlight & AUTO_CORRECT_INVERT) == 0)
             return;
         final TextView tv = mWords.get(1);
         final Spannable word = new SpannableString(autoCorrectedWord);
@@ -403,10 +419,6 @@
         mShowingAutoCorrectionInverted = true;
     }
 
-    public boolean isConfigCandidateHighlightFontColorEnabled() {
-        return mConfigCandidateHighlightFontColorEnabled;
-    }
-
     public boolean isShowingAddToDictionaryHint() {
         return mShowingAddToDictionary;
     }
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index 75bca99..87912eb 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -1464,7 +1464,7 @@
 
         if (mCandidateView != null) {
             mCandidateView.setSuggestions(words);
-            if (mCandidateView.isConfigCandidateHighlightFontColorEnabled()) {
+            if (mKeyboardSwitcher.getLatinKeyboard().needsAutoCorrectionSpacebarLed()) {
                 mKeyboardSwitcher.onAutoCorrectionStateChanged(
                         words.hasWordAboveAutoCorrectionScoreThreshold());
             }