Merge "Update the LatinIME app icon"
diff --git a/java/res/layout/keyboard_popup.xml b/java/res/layout/mini_keyboard.xml
similarity index 91%
rename from java/res/layout/keyboard_popup.xml
rename to java/res/layout/mini_keyboard.xml
index e2508da..6964ec5 100644
--- a/java/res/layout/keyboard_popup.xml
+++ b/java/res/layout/mini_keyboard.xml
@@ -22,9 +22,9 @@
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:orientation="horizontal"
-        style="?attr/popupMiniKeyboardPanelStyle"
+        style="?attr/miniKeyboardPanelStyle"
         >
-    <com.android.inputmethod.keyboard.PopupMiniKeyboardView
+    <com.android.inputmethod.keyboard.MiniKeyboardView
             xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
             android:id="@+id/mini_keyboard_view"
             android:layout_alignParentBottom="true"
diff --git a/java/res/values-ar/donottranslate-altchars.xml b/java/res/values-ar/donottranslate-altchars.xml
index 0e4f265..6f2a3ff 100644
--- a/java/res/values-ar/donottranslate-altchars.xml
+++ b/java/res/values-ar/donottranslate-altchars.xml
@@ -31,7 +31,7 @@
          \u064b: ARABIC FATHATAN
          \u064d: ARABIC KASRATAN -->
     <string name="alternates_for_punctuation">"\u060c,\u061b,\u061f,!,:,-,/,\',\",\u0651,\u0652,\u064c,\u0640,\u064f,\u064e,\u0650,\u064b,\u064d"</string>
-    <integer name="popup_keyboard_column_for_punctuation">9</integer>
+    <integer name="mini_keyboard_column_for_punctuation">9</integer>
     <string name="keyhintlabel_for_punctuation">\u064b</string>
     <string name="keylabel_for_symbols_1">"١"</string>
     <string name="keylabel_for_symbols_2">"٢"</string>
diff --git a/java/res/values-sw600dp/config.xml b/java/res/values-sw600dp/config.xml
index d539e0d..17aeff7 100644
--- a/java/res/values-sw600dp/config.xml
+++ b/java/res/values-sw600dp/config.xml
@@ -39,5 +39,5 @@
     <!-- This configuration is the index of the array {@link KeyboardSwitcher.KEYBOARD_THEMES}. -->
     <string name="config_default_keyboard_theme_id" translatable="false">5</string>
     <string name="config_text_size_of_language_on_spacebar" translatable="false">medium</string>
-    <integer name="config_max_popup_keyboard_column">5</integer>
+    <integer name="config_max_mini_keyboard_column">5</integer>
 </resources>
diff --git a/java/res/values-sw768dp/config.xml b/java/res/values-sw768dp/config.xml
index d880209..8b4ff36 100644
--- a/java/res/values-sw768dp/config.xml
+++ b/java/res/values-sw768dp/config.xml
@@ -37,7 +37,7 @@
     <!-- This configuration is the index of the array {@link KeyboardSwitcher.KEYBOARD_THEMES}. -->
     <string name="config_default_keyboard_theme_id" translatable="false">5</string>
     <string name="config_text_size_of_language_on_spacebar" translatable="false">medium</string>
-    <integer name="config_max_popup_keyboard_column">5</integer>
+    <integer name="config_max_mini_keyboard_column">5</integer>
     <!--  Screen metrics for logging. 0 = "mdpi", 1 = "hdpi", 2 = "xlarge" -->
     <integer name="log_screen_metrics">2</integer>
 </resources>
diff --git a/java/res/values/attrs.xml b/java/res/values/attrs.xml
index bc1bb08..734004f 100644
--- a/java/res/values/attrs.xml
+++ b/java/res/values/attrs.xml
@@ -22,9 +22,9 @@
         <attr name="latinKeyboardStyle" format="reference" />
         <!-- KeyboardView style -->
         <attr name="keyboardViewStyle" format="reference" />
-        <!-- PopupMiniKeyboardView style -->
-        <attr name="popupMiniKeyboardViewStyle" format="reference" />
-        <attr name="popupMiniKeyboardPanelStyle" format="reference" />
+        <!-- MiniKeyboardView style -->
+        <attr name="miniKeyboardViewStyle" format="reference" />
+        <attr name="miniKeyboardPanelStyle" format="reference" />
         <!-- Suggestions strip style -->
         <attr name="suggestionsStripBackgroundStyle" format="reference" />
         <attr name="suggestionBackgroundStyle" format="reference" />
@@ -95,7 +95,7 @@
         <!-- Amount to offset the touch Y coordinate by, for bias correction. -->
         <attr name="verticalCorrection" format="dimension" />
 
-        <!-- Layout resource for popup keyboards. -->
+        <!-- Layout resource for popup panel -->
         <attr name="popupLayout" format="reference" />
 
         <attr name="shadowColor" format="color" />
@@ -153,8 +153,8 @@
         <attr name="horizontalGap" format="dimension|fraction" />
         <!-- Default vertical gap between rows of keys. -->
         <attr name="verticalGap" format="dimension|fraction" />
-        <!-- Popup keyboard layout template -->
-        <attr name="popupKeyboardTemplate" format="reference" />
+        <!-- Popup panel layout template -->
+        <attr name="popupTemplate" format="reference" />
         <!-- Locale of the keyboard layout -->
         <attr name="keyboardLocale" format="string" />
         <!-- True if the keyboard is Right-To-Left -->
@@ -180,8 +180,8 @@
         <attr name="code" format="integer" />
         <!-- The characters to display in the popup keyboard. -->
         <attr name="popupCharacters" format="string" />
-        <!-- Maximum column of popup keyboard -->
-        <attr name="maxPopupKeyboardColumn" format="integer" />
+        <!-- Maximum column of mini keyboard -->
+        <attr name="maxMiniKeyboardColumn" format="integer" />
         <!-- Whether this is a functional key which has different key top than normal key. -->
         <attr name="isFunctional" format="boolean" />
         <!-- Whether this is a toggle key. -->
diff --git a/java/res/values/config.xml b/java/res/values/config.xml
index 1c7c1a1..28cbc95 100644
--- a/java/res/values/config.xml
+++ b/java/res/values/config.xml
@@ -67,7 +67,7 @@
     <!-- This configuration is the index of the array {@link KeyboardSwitcher.KEYBOARD_THEMES}. -->
     <string name="config_default_keyboard_theme_id" translatable="false">5</string>
     <string name="config_text_size_of_language_on_spacebar" translatable="false">small</string>
-    <integer name="config_max_popup_keyboard_column">5</integer>
+    <integer name="config_max_mini_keyboard_column">5</integer>
     <string-array name="auto_correction_threshold_values" translatable="false">
         <!-- Off, When auto correction setting is Off, this value is not used. -->
         <item></item>
diff --git a/java/res/values/donottranslate-altchars.xml b/java/res/values/donottranslate-altchars.xml
index acd4b37..acbf7df 100644
--- a/java/res/values/donottranslate-altchars.xml
+++ b/java/res/values/donottranslate-altchars.xml
@@ -51,7 +51,7 @@
     <string name="alternates_for_currency_general">¢,$,€,£,¥,₱</string>
     <string name="alternates_for_smiley">":-)|:-) ,:-(|:-( ,;-)|;-) ,:-P|:-P ,=-O|=-O ,:-*|:-* ,:O|:O ,B-)|B-) ,:-$|:-$ ,:-!|:-! ,:-[|:-[ ,O:-)|O:-) ,:-\\\\\\\\|:-\\\\\\\\ ,:\'(|:\'( ,:-D|:-D "</string>
     <string name="alternates_for_punctuation">"\\,,\?,!,:,-,\',\",(,),/,;,+,&amp;,\@"</string>
-    <integer name="popup_keyboard_column_for_punctuation">7</integer>
+    <integer name="mini_keyboard_column_for_punctuation">7</integer>
     <string name="keyhintlabel_for_punctuation"></string>
     <string name="keylabel_for_popular_domain">".com"</string>
     <!-- popular web domains for the locale - most popular, displayed on the keyboard -->
diff --git a/java/res/values/styles.xml b/java/res/values/styles.xml
index 7936f3c..eb5b749 100644
--- a/java/res/values/styles.xml
+++ b/java/res/values/styles.xml
@@ -21,12 +21,12 @@
         <item name="keyboardHeight">@dimen/keyboardHeight</item>
         <item name="maxKeyboardHeight">@fraction/maxKeyboardHeight</item>
         <item name="minKeyboardHeight">@fraction/minKeyboardHeight</item>
-        <item name="popupKeyboardTemplate">@xml/kbd_popup_template</item>
+        <item name="popupTemplate">@xml/kbd_mini_keyboard_template</item>
         <item name="keyboardTopPadding">@fraction/keyboard_top_padding</item>
         <item name="keyboardBottomPadding">@fraction/keyboard_bottom_padding</item>
         <item name="horizontalGap">@fraction/key_horizontal_gap</item>
         <item name="verticalGap">@fraction/key_bottom_gap</item>
-        <item name="maxPopupKeyboardColumn">@integer/config_max_popup_keyboard_column</item>
+        <item name="maxMiniKeyboardColumn">@integer/config_max_mini_keyboard_column</item>
     </style>
     <style name="LatinKeyboard">
         <item name="autoCorrectionSpacebarLedEnabled">@bool/config_auto_correction_spacebar_led_enabled
@@ -61,20 +61,20 @@
         <item name="keyPreviewOffset">@dimen/key_preview_offset</item>
         <item name="keyPreviewHeight">@dimen/key_preview_height</item>
         <item name="keyPreviewTextRatio">@fraction/key_preview_text_ratio</item>
-        <item name="popupLayout">@layout/keyboard_popup</item>
+        <item name="popupLayout">@layout/mini_keyboard</item>
         <item name="verticalCorrection">@dimen/keyboard_vertical_correction</item>
         <item name="shadowColor">#BB000000</item>
         <item name="shadowRadius">2.75</item>
         <item name="backgroundDimAmount">0.5</item>
     </style>
     <style
-        name="PopupMiniKeyboardView"
+        name="MiniKeyboardView"
         parent="KeyboardView"
     >
         <item name="keyBackground">@drawable/btn_keyboard_key_popup</item>
         <item name="verticalCorrection">@dimen/mini_keyboard_vertical_correction</item>
     </style>
-    <style name="PopupMiniKeyboardPanelStyle">
+    <style name="MiniKeyboardPanelStyle">
         <item name="android:background">@drawable/keyboard_popup_panel_background</item>
         <item name="android:paddingLeft">@dimen/mini_keyboard_horizontal_edges_padding</item>
         <item name="android:paddingRight">@dimen/mini_keyboard_horizontal_edges_padding</item>
@@ -139,8 +139,8 @@
         <item name="shadowColor">#FFFFFFFF</item>
     </style>
     <style
-        name="PopupMiniKeyboardView.Stone"
-        parent="PopupMiniKeyboardView"
+        name="MiniKeyboardView.Stone"
+        parent="MiniKeyboardView"
     >
         <item name="keyBackground">@drawable/btn_keyboard_key_stone</item>
         <item name="keyTextColor">#FF000000</item>
@@ -170,8 +170,8 @@
         <item name="keyTextStyle">bold</item>
     </style>
     <style
-        name="PopupMiniKeyboardView.Gingerbread"
-        parent="PopupMiniKeyboardView"
+        name="MiniKeyboardView.Gingerbread"
+        parent="MiniKeyboardView"
     >
         <item name="android:background">@null</item>
     </style>
@@ -213,13 +213,13 @@
         <item name="shadowRadius">0.0</item>
     </style>
     <style
-        name="PopupMiniKeyboardView.IceCreamSandwich"
-        parent="PopupMiniKeyboardView"
+        name="MiniKeyboardView.IceCreamSandwich"
+        parent="MiniKeyboardView"
     >
         <item name="android:background">@null</item>
         <item name="keyBackground">@drawable/btn_keyboard_key_popup_ics</item>
     </style>
-    <style name="PopupMiniKeyboardPanelStyle.IceCreamSandwich">
+    <style name="MiniKeyboardPanelStyle.IceCreamSandwich">
         <item name="android:background">@drawable/btn_keyboard_key_popup_background_holo</item>
         <item name="android:paddingLeft">@dimen/mini_keyboard_horizontal_edges_padding_ics</item>
         <item name="android:paddingRight">@dimen/mini_keyboard_horizontal_edges_padding_ics</item>
@@ -232,7 +232,7 @@
     </style>
     <style
         name="SuggestionPreviewBackgroundStyle.IceCreamSandwich"
-        parent="PopupMiniKeyboardPanelStyle.IceCreamSandwich"
+        parent="MiniKeyboardPanelStyle.IceCreamSandwich"
     >
     </style>
     <style
@@ -246,7 +246,7 @@
         <item name="candidateCountInStrip">@integer/candidate_count_in_strip</item>
         <item name="centerCandidatePercentile">@integer/center_candidate_percentile</item>
     </style>
-    <style name="PopupMiniKeyboardAnimation">
+    <style name="MiniKeyboardAnimation">
         <item name="android:windowEnterAnimation">@anim/mini_keyboard_fadein</item>
         <item name="android:windowExitAnimation">@anim/mini_keyboard_fadeout</item>
     </style>
diff --git a/java/res/values/themes-basic-highcontrast.xml b/java/res/values/themes-basic-highcontrast.xml
index 820f962..17c06a2 100644
--- a/java/res/values/themes-basic-highcontrast.xml
+++ b/java/res/values/themes-basic-highcontrast.xml
@@ -19,8 +19,8 @@
         <item name="keyboardStyle">@style/Keyboard</item>
         <item name="latinKeyboardStyle">@style/LatinKeyboard</item>
         <item name="keyboardViewStyle">@style/KeyboardView.HighContrast</item>
-        <item name="popupMiniKeyboardViewStyle">@style/PopupMiniKeyboardView</item>
-        <item name="popupMiniKeyboardPanelStyle">@style/PopupMiniKeyboardPanelStyle</item>
+        <item name="miniKeyboardViewStyle">@style/MiniKeyboardView</item>
+        <item name="miniKeyboardPanelStyle">@style/MiniKeyboardPanelStyle</item>
         <item name="suggestionsStripBackgroundStyle">@style/SuggestionsStripBackgroundStyle</item>
         <item name="suggestionBackgroundStyle">@style/SuggestionBackgroundStyle</item>
         <item name="suggestionPreviewBackgroundStyle">@style/SuggestionPreviewBackgroundStyle</item>
diff --git a/java/res/values/themes-basic.xml b/java/res/values/themes-basic.xml
index 18cae4e..23c71bd 100644
--- a/java/res/values/themes-basic.xml
+++ b/java/res/values/themes-basic.xml
@@ -19,8 +19,8 @@
         <item name="keyboardStyle">@style/Keyboard</item>
         <item name="latinKeyboardStyle">@style/LatinKeyboard</item>
         <item name="keyboardViewStyle">@style/KeyboardView</item>
-        <item name="popupMiniKeyboardViewStyle">@style/PopupMiniKeyboardView</item>
-        <item name="popupMiniKeyboardPanelStyle">@style/PopupMiniKeyboardPanelStyle</item>
+        <item name="miniKeyboardViewStyle">@style/MiniKeyboardView</item>
+        <item name="miniKeyboardPanelStyle">@style/MiniKeyboardPanelStyle</item>
         <item name="suggestionsStripBackgroundStyle">@style/SuggestionsStripBackgroundStyle</item>
         <item name="suggestionBackgroundStyle">@style/SuggestionBackgroundStyle</item>
         <item name="suggestionPreviewBackgroundStyle">@style/SuggestionPreviewBackgroundStyle</item>
diff --git a/java/res/values/themes-gingerbread.xml b/java/res/values/themes-gingerbread.xml
index 60f2261..1e3419f 100644
--- a/java/res/values/themes-gingerbread.xml
+++ b/java/res/values/themes-gingerbread.xml
@@ -19,8 +19,8 @@
         <item name="keyboardStyle">@style/Keyboard.Gingerbread</item>
         <item name="latinKeyboardStyle">@style/LatinKeyboard</item>
         <item name="keyboardViewStyle">@style/KeyboardView.Gingerbread</item>
-        <item name="popupMiniKeyboardViewStyle">@style/PopupMiniKeyboardView.Gingerbread</item>
-        <item name="popupMiniKeyboardPanelStyle">@style/PopupMiniKeyboardPanelStyle</item>
+        <item name="miniKeyboardViewStyle">@style/MiniKeyboardView.Gingerbread</item>
+        <item name="miniKeyboardPanelStyle">@style/MiniKeyboardPanelStyle</item>
         <item name="suggestionsStripBackgroundStyle">@style/SuggestionsStripBackgroundStyle</item>
         <item name="suggestionBackgroundStyle">@style/SuggestionBackgroundStyle</item>
         <item name="suggestionPreviewBackgroundStyle">@style/SuggestionPreviewBackgroundStyle</item>
diff --git a/java/res/values/themes-ics.xml b/java/res/values/themes-ics.xml
index 97c5944..7fa879c 100644
--- a/java/res/values/themes-ics.xml
+++ b/java/res/values/themes-ics.xml
@@ -19,8 +19,8 @@
         <item name="keyboardStyle">@style/Keyboard.IceCreamSandwich</item>
         <item name="latinKeyboardStyle">@style/LatinKeyboard.IceCreamSandwich</item>
         <item name="keyboardViewStyle">@style/KeyboardView.IceCreamSandwich</item>
-        <item name="popupMiniKeyboardViewStyle">@style/PopupMiniKeyboardView.IceCreamSandwich</item>
-        <item name="popupMiniKeyboardPanelStyle">@style/PopupMiniKeyboardPanelStyle.IceCreamSandwich</item>
+        <item name="miniKeyboardViewStyle">@style/MiniKeyboardView.IceCreamSandwich</item>
+        <item name="miniKeyboardPanelStyle">@style/MiniKeyboardPanelStyle.IceCreamSandwich</item>
         <item name="suggestionsStripBackgroundStyle">@style/SuggestionsStripBackgroundStyle.IceCreamSandwich</item>
         <item name="suggestionBackgroundStyle">@style/SuggestionBackgroundStyle.IceCreamSandwich</item>
         <item name="suggestionPreviewBackgroundStyle">@style/SuggestionPreviewBackgroundStyle.IceCreamSandwich</item>
diff --git a/java/res/values/themes-stone-bold.xml b/java/res/values/themes-stone-bold.xml
index d33e6bf..fa2ee2d 100644
--- a/java/res/values/themes-stone-bold.xml
+++ b/java/res/values/themes-stone-bold.xml
@@ -19,8 +19,8 @@
         <item name="keyboardStyle">@style/Keyboard.Stone</item>
         <item name="latinKeyboardStyle">@style/LatinKeyboard.Stone</item>
         <item name="keyboardViewStyle">@style/KeyboardView.Stone.Bold</item>
-        <item name="popupMiniKeyboardViewStyle">@style/PopupMiniKeyboardView.Stone</item>
-        <item name="popupMiniKeyboardPanelStyle">@style/PopupMiniKeyboardPanelStyle</item>
+        <item name="miniKeyboardViewStyle">@style/MiniKeyboardView.Stone</item>
+        <item name="miniKeyboardPanelStyle">@style/MiniKeyboardPanelStyle</item>
         <item name="suggestionsStripBackgroundStyle">@style/SuggestionsStripBackgroundStyle</item>
         <item name="suggestionBackgroundStyle">@style/SuggestionBackgroundStyle</item>
         <item name="suggestionPreviewBackgroundStyle">@style/SuggestionPreviewBackgroundStyle</item>
diff --git a/java/res/values/themes-stone.xml b/java/res/values/themes-stone.xml
index 230b2ca..494bae6 100644
--- a/java/res/values/themes-stone.xml
+++ b/java/res/values/themes-stone.xml
@@ -19,8 +19,8 @@
         <item name="keyboardStyle">@style/Keyboard.Stone</item>
         <item name="latinKeyboardStyle">@style/LatinKeyboard.Stone</item>
         <item name="keyboardViewStyle">@style/KeyboardView.Stone</item>
-        <item name="popupMiniKeyboardViewStyle">@style/PopupMiniKeyboardView.Stone</item>
-        <item name="popupMiniKeyboardPanelStyle">@style/PopupMiniKeyboardPanelStyle</item>
+        <item name="miniKeyboardViewStyle">@style/MiniKeyboardView.Stone</item>
+        <item name="miniKeyboardPanelStyle">@style/MiniKeyboardPanelStyle</item>
         <item name="suggestionsStripBackgroundStyle">@style/SuggestionsStripBackgroundStyle</item>
         <item name="suggestionBackgroundStyle">@style/SuggestionBackgroundStyle</item>
         <item name="suggestionPreviewBackgroundStyle">@style/SuggestionPreviewBackgroundStyle</item>
diff --git a/java/res/xml-sw600dp/kbd_key_styles.xml b/java/res/xml-sw600dp/kbd_key_styles.xml
index b93d300..43b6623 100644
--- a/java/res/xml-sw600dp/kbd_key_styles.xml
+++ b/java/res/xml-sw600dp/kbd_key_styles.xml
@@ -73,7 +73,7 @@
         latin:keyOutputText=":-) "
         latin:keyLabelOption="hasPopupHint"
         latin:popupCharacters="@string/alternates_for_smiley"
-        latin:maxPopupKeyboardColumn="5" />
+        latin:maxMiniKeyboardColumn="5" />
     <key-style
         latin:styleName="shortcutKeyStyle"
         latin:code="@integer/key_shortcut"
diff --git a/java/res/xml-sw768dp/kbd_key_styles.xml b/java/res/xml-sw768dp/kbd_key_styles.xml
index 7c74bb5..52ee91a 100644
--- a/java/res/xml-sw768dp/kbd_key_styles.xml
+++ b/java/res/xml-sw768dp/kbd_key_styles.xml
@@ -55,7 +55,7 @@
         latin:keyOutputText=":-) "
         latin:keyLabelOption="hasPopupHint"
         latin:popupCharacters="@string/alternates_for_smiley"
-        latin:maxPopupKeyboardColumn="5" />
+        latin:maxMiniKeyboardColumn="5" />
     <key-style
         latin:styleName="settingsKeyStyle"
         latin:code="@integer/key_settings"
diff --git a/java/res/xml/kbd_key_styles.xml b/java/res/xml/kbd_key_styles.xml
index 4846898..86f0bf2 100644
--- a/java/res/xml/kbd_key_styles.xml
+++ b/java/res/xml/kbd_key_styles.xml
@@ -91,7 +91,7 @@
                 latin:keyOutputText=":-) "
                 latin:keyLabelOption="hasPopupHint"
                 latin:popupCharacters="@string/alternates_for_smiley"
-                latin:maxPopupKeyboardColumn="5"
+                latin:maxMiniKeyboardColumn="5"
                 latin:parentStyle="functionalKeyStyle" />
         </case>
         <case
@@ -221,6 +221,6 @@
         latin:keyHintLabel="@string/keyhintlabel_for_punctuation"
         latin:keyLabelOption="hasPopupHint"
         latin:popupCharacters="@string/alternates_for_punctuation"
-        latin:maxPopupKeyboardColumn="@integer/popup_keyboard_column_for_punctuation"
+        latin:maxMiniKeyboardColumn="@integer/mini_keyboard_column_for_punctuation"
         latin:parentStyle="functionalKeyStyle" />
 </merge>
diff --git a/java/res/xml/kbd_popup_template.xml b/java/res/xml/kbd_mini_keyboard_template.xml
similarity index 100%
rename from java/res/xml/kbd_popup_template.xml
rename to java/res/xml/kbd_mini_keyboard_template.xml
diff --git a/java/res/xml/kbd_rows_symbols.xml b/java/res/xml/kbd_rows_symbols.xml
index 75e21a0..5880d52 100644
--- a/java/res/xml/kbd_rows_symbols.xml
+++ b/java/res/xml/kbd_rows_symbols.xml
@@ -106,7 +106,7 @@
         <Key
             latin:keyLabel="&quot;"
             latin:popupCharacters="“,”,«,»"
-            latin:maxPopupKeyboardColumn="6" />
+            latin:maxMiniKeyboardColumn="6" />
         <Key
             latin:keyLabel="\'"
             latin:popupCharacters="‘,’,‚,‛" />
diff --git a/java/res/xml/prefs.xml b/java/res/xml/prefs.xml
index 6d2218d..2f32181 100644
--- a/java/res/xml/prefs.xml
+++ b/java/res/xml/prefs.xml
@@ -91,23 +91,6 @@
             android:defaultValue="@string/prefs_suggestion_visibility_default_value" />
     </PreferenceCategory>
     <PreferenceCategory
-        android:title="@string/ngram_category"
-        android:key="ngram_settings">
-        <CheckBoxPreference
-            android:key="bigram_suggestion"
-            android:title="@string/bigram_suggestion"
-            android:summary="@string/bigram_suggestion_summary"
-            android:persistent="true"
-            android:defaultValue="true" />
-        <CheckBoxPreference
-            android:key="bigram_prediction"
-            android:dependency="bigram_suggestion"
-            android:title="@string/bigram_prediction"
-            android:summary="@string/bigram_prediction_summary"
-            android:persistent="true"
-            android:defaultValue="false" />
-    </PreferenceCategory>
-    <PreferenceCategory
         android:title="@string/misc_category"
         android:key="misc_settings">
       <CheckBoxPreference
@@ -143,6 +126,20 @@
              android:summary="@string/use_contacts_dict_summary"
              android:persistent="true"
              android:defaultValue="true" />
+          <CheckBoxPreference
+             android:key="bigram_suggestion"
+             android:title="@string/bigram_suggestion"
+             android:summary="@string/bigram_suggestion_summary"
+             android:persistent="true"
+             android:defaultValue="true" />
+          <!-- TODO: evaluate results and revive this option. The code already supports it. -->
+          <!-- <CheckBoxPreference -->
+          <!--    android:key="bigram_prediction" -->
+          <!--    android:dependency="bigram_suggestion" -->
+          <!--    android:title="@string/bigram_prediction" -->
+          <!--    android:summary="@string/bigram_prediction_summary" -->
+          <!--    android:persistent="true" -->
+          <!--    android:defaultValue="false" /> -->
     </PreferenceScreen>
     <!-- <Preference
         android:title="Debug Settings"
diff --git a/java/src/com/android/inputmethod/keyboard/Key.java b/java/src/com/android/inputmethod/keyboard/Key.java
index 9cf64e1..8baf3f7 100644
--- a/java/src/com/android/inputmethod/keyboard/Key.java
+++ b/java/src/com/android/inputmethod/keyboard/Key.java
@@ -93,7 +93,7 @@
     /** Popup characters */
     public final CharSequence[] mPopupCharacters;
     /** Popup keyboard maximum column number */
-    public final int mMaxPopupColumn;
+    public final int mMaxMiniKeyboardColumn;
 
     /**
      * Flags that specify the anchoring to edges of the keyboard for detecting touch events
@@ -228,7 +228,7 @@
         mSticky = false;
         mRepeatable = false;
         mPopupCharacters = null;
-        mMaxPopupColumn = 0;
+        mMaxMiniKeyboardColumn = 0;
         mLabel = label;
         mOutputText = outputText;
         mCode = code;
@@ -323,9 +323,9 @@
             } else {
                 mPopupCharacters = popupCharacters;
             }
-            mMaxPopupColumn = style.getInt(keyboardAttr,
-                    R.styleable.Keyboard_Key_maxPopupKeyboardColumn,
-                    params.mMaxPopupColumn);
+            mMaxMiniKeyboardColumn = style.getInt(keyboardAttr,
+                    R.styleable.Keyboard_Key_maxMiniKeyboardColumn,
+                    params.mMaxMiniKeyboardColumn);
 
             mRepeatable = style.getBoolean(keyAttr, R.styleable.Keyboard_Key_isRepeatable, false);
             mFunctional = style.getBoolean(keyAttr, R.styleable.Keyboard_Key_isFunctional, false);
diff --git a/java/src/com/android/inputmethod/keyboard/Keyboard.java b/java/src/com/android/inputmethod/keyboard/Keyboard.java
index f8e08b0..5dabb93 100644
--- a/java/src/com/android/inputmethod/keyboard/Keyboard.java
+++ b/java/src/com/android/inputmethod/keyboard/Keyboard.java
@@ -102,10 +102,10 @@
     public final int mMostCommonKeyWidth;
 
     /** Popup keyboard template */
-    public final int mPopupKeyboardResId;
+    public final int mPopupTemplateId;
 
-    /** Maximum column for popup keyboard */
-    public final int mMaxPopupColumn;
+    /** Maximum column for mini keyboard */
+    public final int mMaxMiniKeyboardColumn;
 
     /** True if Right-To-Left keyboard */
     public final boolean mIsRtlKeyboard;
@@ -130,8 +130,8 @@
         mWidth = params.mWidth;
         mMostCommonKeyWidth = params.mMostCommonKeyWidth;
         mIsRtlKeyboard = params.mIsRtlKeyboard;
-        mPopupKeyboardResId = params.mPopupKeyboardResId;
-        mMaxPopupColumn = params.mMaxPopupColumn;
+        mPopupTemplateId = params.mPopupTemplateId;
+        mMaxMiniKeyboardColumn = params.mMaxMiniKeyboardColumn;
 
         mDefaultRowHeight = params.mDefaultRowHeight;
         mVerticalGap = params.mVerticalGap;
diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardView.java b/java/src/com/android/inputmethod/keyboard/KeyboardView.java
index 5f82453..4c5c2bc 100644
--- a/java/src/com/android/inputmethod/keyboard/KeyboardView.java
+++ b/java/src/com/android/inputmethod/keyboard/KeyboardView.java
@@ -77,7 +77,9 @@
     // Miscellaneous constants
     private static final int[] LONG_PRESSABLE_STATE_SET = { android.R.attr.state_long_pressable };
 
-    // XML attribute
+    // XML attributes
+    protected final float mVerticalCorrection;
+    protected final int mPopupLayout;
     private final float mBackgroundDimAmount;
 
     // HORIZONTAL ELLIPSIS "...", character for popup hint.
@@ -122,9 +124,6 @@
             new HashMap<Integer, Float>();
     private static final String KEY_LABEL_REFERENCE_CHAR = "M";
 
-    private static final int MEASURESPEC_UNSPECIFIED = MeasureSpec.makeMeasureSpec(
-            0, MeasureSpec.UNSPECIFIED);
-
     private final DrawingHandler mDrawingHandler = new DrawingHandler(this);
 
     public static class DrawingHandler extends StaticInnerHandlerWrapper<KeyboardView> {
@@ -342,6 +341,9 @@
         if (mKeyPreviewLayoutId == 0) {
             mShowKeyPreviewPopup = false;
         }
+        mVerticalCorrection = a.getDimensionPixelOffset(
+                R.styleable.KeyboardView_verticalCorrection, 0);
+        mPopupLayout = a.getResourceId(R.styleable.KeyboardView_popupLayout, 0);
         mBackgroundDimAmount = a.getFloat(R.styleable.KeyboardView_backgroundDimAmount, 0.5f);
         a.recycle();
 
@@ -859,7 +861,8 @@
         }
         previewText.setBackgroundDrawable(params.mPreviewBackground);
 
-        previewText.measure(MEASURESPEC_UNSPECIFIED, MEASURESPEC_UNSPECIFIED);
+        previewText.measure(
+                ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
         final int previewWidth = Math.max(previewText.getMeasuredWidth(), keyDrawWidth
                 + previewText.getPaddingLeft() + previewText.getPaddingRight());
         final int previewHeight = params.mPreviewHeight;
diff --git a/java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java b/java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java
index 69cbcb1..1e7ec9e 100644
--- a/java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java
+++ b/java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java
@@ -19,7 +19,6 @@
 import android.content.Context;
 import android.content.pm.PackageManager;
 import android.content.res.Resources;
-import android.content.res.TypedArray;
 import android.graphics.Canvas;
 import android.os.Message;
 import android.os.SystemClock;
@@ -30,6 +29,7 @@
 import android.view.MotionEvent;
 import android.view.View;
 import android.view.ViewConfiguration;
+import android.view.ViewGroup;
 import android.view.accessibility.AccessibilityEvent;
 import android.widget.PopupWindow;
 
@@ -63,10 +63,6 @@
     // Timing constants
     private final int mKeyRepeatInterval;
 
-    // XML attribute
-    private final float mVerticalCorrection;
-    private final int mPopupLayout;
-
     // Mini keyboard
     private PopupWindow mPopupWindow;
     private PopupPanel mPopupPanel;
@@ -218,13 +214,6 @@
 
         mTouchScreenRegulator = new SuddenJumpingTouchEventHandler(getContext(), this);
 
-        final TypedArray a = context.obtainStyledAttributes(
-                attrs, R.styleable.KeyboardView, defStyle, R.style.KeyboardView);
-        mVerticalCorrection = a.getDimensionPixelOffset(
-                R.styleable.KeyboardView_verticalCorrection, 0);
-        mPopupLayout = a.getResourceId(R.styleable.KeyboardView_popupLayout, 0);
-        a.recycle();
-
         final Resources res = getResources();
         mConfigShowMiniKeyboardAtTouchedPoint = res.getBoolean(
                 R.bool.config_show_mini_keyboard_at_touched_point);
@@ -373,15 +362,13 @@
         if (container == null)
             throw new NullPointerException();
 
-        final PopupMiniKeyboardView miniKeyboardView =
-                (PopupMiniKeyboardView)container.findViewById(R.id.mini_keyboard_view);
+        final MiniKeyboardView miniKeyboardView =
+                (MiniKeyboardView)container.findViewById(R.id.mini_keyboard_view);
         final Keyboard parentKeyboard = getKeyboard();
         final Keyboard miniKeyboard = new MiniKeyboard.Builder(
-                this, parentKeyboard.mPopupKeyboardResId, parentKey, parentKeyboard).build();
+                this, parentKeyboard.mPopupTemplateId, parentKey, parentKeyboard).build();
         miniKeyboardView.setKeyboard(miniKeyboard);
-
-        container.measure(MeasureSpec.makeMeasureSpec(getWidth(), MeasureSpec.AT_MOST),
-                MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED));
+        container.measure(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
 
         return miniKeyboardView;
     }
@@ -455,7 +442,7 @@
         if (mPopupWindow == null) {
             mPopupWindow = new PopupWindow(getContext());
             mPopupWindow.setBackgroundDrawable(null);
-            mPopupWindow.setAnimationStyle(R.style.PopupMiniKeyboardAnimation);
+            mPopupWindow.setAnimationStyle(R.style.MiniKeyboardAnimation);
             // Allow popup window to be drawn off the screen.
             mPopupWindow.setClippingEnabled(false);
         }
diff --git a/java/src/com/android/inputmethod/keyboard/MiniKeyboard.java b/java/src/com/android/inputmethod/keyboard/MiniKeyboard.java
index e6045dc..6119fa2 100644
--- a/java/src/com/android/inputmethod/keyboard/MiniKeyboard.java
+++ b/java/src/com/android/inputmethod/keyboard/MiniKeyboard.java
@@ -227,8 +227,8 @@
             mPopupCharacters = parentKey.mPopupCharacters;
 
             final int keyWidth = getMaxKeyWidth(view, mPopupCharacters, mParams.mDefaultKeyWidth);
-            mParams.setParameters(mPopupCharacters.length, parentKey.mMaxPopupColumn, keyWidth,
-                    parentKeyboard.mDefaultRowHeight, parentKey.mX
+            mParams.setParameters(mPopupCharacters.length, parentKey.mMaxMiniKeyboardColumn,
+                    keyWidth, parentKeyboard.mDefaultRowHeight, parentKey.mX
                             + (mParams.mDefaultKeyWidth - keyWidth) / 2, view.getMeasuredWidth());
         }
 
diff --git a/java/src/com/android/inputmethod/keyboard/PopupMiniKeyboardView.java b/java/src/com/android/inputmethod/keyboard/MiniKeyboardView.java
similarity index 92%
rename from java/src/com/android/inputmethod/keyboard/PopupMiniKeyboardView.java
rename to java/src/com/android/inputmethod/keyboard/MiniKeyboardView.java
index 7ace46c..7a0f73f 100644
--- a/java/src/com/android/inputmethod/keyboard/PopupMiniKeyboardView.java
+++ b/java/src/com/android/inputmethod/keyboard/MiniKeyboardView.java
@@ -18,7 +18,6 @@
 
 import android.content.Context;
 import android.content.res.Resources;
-import android.content.res.TypedArray;
 import android.util.AttributeSet;
 import android.view.Gravity;
 import android.view.View;
@@ -34,11 +33,10 @@
  * A view that renders a virtual {@link MiniKeyboard}. It handles rendering of keys and detecting
  * key presses and touch movements.
  */
-public class PopupMiniKeyboardView extends KeyboardView implements PopupPanel {
+public class MiniKeyboardView extends KeyboardView implements PopupPanel {
     private final int[] mCoordinates = new int[2];
 
     private final KeyDetector mKeyDetector;
-    private final int mVerticalCorrection;
 
     private Controller mController;
     private KeyboardActionListener mListener;
@@ -128,19 +126,13 @@
         }
     };
 
-    public PopupMiniKeyboardView(Context context, AttributeSet attrs) {
-        this(context, attrs, R.attr.popupMiniKeyboardViewStyle);
+    public MiniKeyboardView(Context context, AttributeSet attrs) {
+        this(context, attrs, R.attr.miniKeyboardViewStyle);
     }
 
-    public PopupMiniKeyboardView(Context context, AttributeSet attrs, int defStyle) {
+    public MiniKeyboardView(Context context, AttributeSet attrs, int defStyle) {
         super(context, attrs, defStyle);
 
-        final TypedArray a = context.obtainStyledAttributes(
-                attrs, R.styleable.KeyboardView, defStyle, R.style.KeyboardView);
-        mVerticalCorrection = a.getDimensionPixelOffset(
-                R.styleable.KeyboardView_verticalCorrection, 0);
-        a.recycle();
-
         final Resources res = context.getResources();
         // Override default ProximityKeyDetector.
         mKeyDetector = new MiniKeyboardKeyDetector(res.getDimension(
diff --git a/java/src/com/android/inputmethod/keyboard/internal/KeyStyles.java b/java/src/com/android/inputmethod/keyboard/internal/KeyStyles.java
index c0dba41..66dde05 100644
--- a/java/src/com/android/inputmethod/keyboard/internal/KeyStyles.java
+++ b/java/src/com/android/inputmethod/keyboard/internal/KeyStyles.java
@@ -171,7 +171,7 @@
             readInt(keyAttr, R.styleable.Keyboard_Key_keyIcon);
             readInt(keyAttr, R.styleable.Keyboard_Key_keyIconPreview);
             readInt(keyAttr, R.styleable.Keyboard_Key_keyIconShifted);
-            readInt(keyAttr, R.styleable.Keyboard_Key_maxPopupKeyboardColumn);
+            readInt(keyAttr, R.styleable.Keyboard_Key_maxMiniKeyboardColumn);
             readBoolean(keyAttr, R.styleable.Keyboard_Key_isFunctional);
             readBoolean(keyAttr, R.styleable.Keyboard_Key_isSticky);
             readBoolean(keyAttr, R.styleable.Keyboard_Key_isRepeatable);
diff --git a/java/src/com/android/inputmethod/keyboard/internal/KeyboardBuilder.java b/java/src/com/android/inputmethod/keyboard/internal/KeyboardBuilder.java
index f599def..5c76fac 100644
--- a/java/src/com/android/inputmethod/keyboard/internal/KeyboardBuilder.java
+++ b/java/src/com/android/inputmethod/keyboard/internal/KeyboardBuilder.java
@@ -255,10 +255,10 @@
 
             mParams.mIsRtlKeyboard = keyboardAttr.getBoolean(
                     R.styleable.Keyboard_isRtlKeyboard, false);
-            mParams.mPopupKeyboardResId = keyboardAttr.getResourceId(
-                    R.styleable.Keyboard_popupKeyboardTemplate, 0);
-            mParams.mMaxPopupColumn = keyAttr.getInt(
-                    R.styleable.Keyboard_Key_maxPopupKeyboardColumn, 5);
+            mParams.mPopupTemplateId = keyboardAttr.getResourceId(
+                    R.styleable.Keyboard_popupTemplate, 0);
+            mParams.mMaxMiniKeyboardColumn = keyAttr.getInt(
+                    R.styleable.Keyboard_Key_maxMiniKeyboardColumn, 5);
 
             mParams.mIconsSet.loadIcons(keyboardAttr);
         } finally {
diff --git a/java/src/com/android/inputmethod/keyboard/internal/KeyboardParams.java b/java/src/com/android/inputmethod/keyboard/internal/KeyboardParams.java
index 9801152..e748dbb 100644
--- a/java/src/com/android/inputmethod/keyboard/internal/KeyboardParams.java
+++ b/java/src/com/android/inputmethod/keyboard/internal/KeyboardParams.java
@@ -49,8 +49,8 @@
     public int mVerticalGap;
 
     public boolean mIsRtlKeyboard;
-    public int mPopupKeyboardResId;
-    public int mMaxPopupColumn;
+    public int mPopupTemplateId;
+    public int mMaxMiniKeyboardColumn;
 
     public int GRID_WIDTH;
     public int GRID_HEIGHT;
diff --git a/java/src/com/android/inputmethod/latin/BinaryDictionaryFileDumper.java b/java/src/com/android/inputmethod/latin/BinaryDictionaryFileDumper.java
index e95172d..38563be 100644
--- a/java/src/com/android/inputmethod/latin/BinaryDictionaryFileDumper.java
+++ b/java/src/com/android/inputmethod/latin/BinaryDictionaryFileDumper.java
@@ -25,12 +25,15 @@
 import android.text.TextUtils;
 import android.util.Log;
 
+import java.io.BufferedInputStream;
+import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
 import java.util.Locale;
@@ -46,7 +49,9 @@
     /**
      * The size of the temporary buffer to copy files.
      */
-    static final int FILE_READ_BUFFER_SIZE = 1024;
+    private static final int FILE_READ_BUFFER_SIZE = 1024;
+    // TODO: make the following data common with the native code
+    private static final byte[] MAGIC_NUMBER = new byte[] { 0x78, (byte)0xB1 };
 
     private static final String DICTIONARY_PROJECTION[] = { "id" };
 
@@ -135,6 +140,7 @@
         for (int mode = MODE_MIN; mode <= MODE_MAX; ++mode) {
             InputStream originalSourceStream = null;
             InputStream inputStream = null;
+            File outputFile = null;
             FileOutputStream outputStream = null;
             AssetFileDescriptor afd = null;
             try {
@@ -144,7 +150,8 @@
                 if (null == afd) return null;
                 originalSourceStream = afd.createInputStream();
                 // Open output.
-                outputStream = new FileOutputStream(outputFileName);
+                outputFile = new File(outputFileName);
+                outputStream = new FileOutputStream(outputFile);
                 // Get the appropriate decryption method for this try
                 switch (mode) {
                     case COMPRESSED_CRYPTED_COMPRESSED:
@@ -171,7 +178,7 @@
                         inputStream = originalSourceStream;
                         break;
                     }
-                copyFileTo(inputStream, outputStream);
+                checkMagicAndCopyFileTo(new BufferedInputStream(inputStream), outputStream);
                 if (0 >= resolver.delete(wordListUri, null, null)) {
                     Log.e(TAG, "Could not have the dictionary pack delete a word list");
                 }
@@ -181,6 +188,12 @@
                 if (DEBUG) {
                     Log.i(TAG, "Can't open word list in mode " + mode + " : " + e);
                 }
+                if (null != outputFile) {
+                    // This may or may not fail. The file may not have been created if the
+                    // exception was thrown before it could be. Hence, both failure and
+                    // success are expected outcomes, so we don't check the return value.
+                    outputFile.delete();
+                }
                 // Try the next method.
             } finally {
                 // Ignore exceptions while closing files.
@@ -234,12 +247,29 @@
     }
 
     /**
-     * Copies the data in an input stream to a target file.
+     * Copies the data in an input stream to a target file if the magic number matches.
+     *
+     * If the magic number does not match the expected value, this method throws an
+     * IOException. Other usual conditions for IOException or FileNotFoundException
+     * also apply.
+     *
      * @param input the stream to be copied.
      * @param outputFile an outputstream to copy the data to.
      */
-    private static void copyFileTo(final InputStream input, final FileOutputStream output)
-            throws FileNotFoundException, IOException {
+    private static void checkMagicAndCopyFileTo(final BufferedInputStream input,
+            final FileOutputStream output) throws FileNotFoundException, IOException {
+        // Check the magic number
+        final byte[] magicNumberBuffer = new byte[MAGIC_NUMBER.length];
+        final int readMagicNumberSize = input.read(magicNumberBuffer, 0, MAGIC_NUMBER.length);
+        if (readMagicNumberSize < MAGIC_NUMBER.length) {
+            throw new IOException("Less bytes to read than the magic number length");
+        }
+        if (!Arrays.equals(MAGIC_NUMBER, magicNumberBuffer)) {
+            throw new IOException("Wrong magic number for downloaded file");
+        }
+        output.write(MAGIC_NUMBER);
+
+        // Actually copy the file
         final byte[] buffer = new byte[FILE_READ_BUFFER_SIZE];
         for (int readBytes = input.read(buffer); readBytes >= 0; readBytes = input.read(buffer))
             output.write(buffer, 0, readBytes);
diff --git a/java/src/com/android/inputmethod/latin/CandidateView.java b/java/src/com/android/inputmethod/latin/CandidateView.java
index f445abf..b9ded31 100644
--- a/java/src/com/android/inputmethod/latin/CandidateView.java
+++ b/java/src/com/android/inputmethod/latin/CandidateView.java
@@ -59,8 +59,6 @@
 
     // The maximum number of suggestions available. See {@link Suggest#mPrefMaxSuggestions}.
     private static final int MAX_SUGGESTIONS = 18;
-    private static final int WRAP_CONTENT = ViewGroup.LayoutParams.WRAP_CONTENT;
-    private static final int MATCH_PARENT = ViewGroup.LayoutParams.MATCH_PARENT;
 
     private static final boolean DBG = LatinImeLogger.sDBG;
 
@@ -155,7 +153,8 @@
             final TextView word = words.get(0);
             final View divider = dividers.get(0);
             mPadding = word.getCompoundPaddingLeft() + word.getCompoundPaddingRight();
-            divider.measure(WRAP_CONTENT, MATCH_PARENT);
+            divider.measure(
+                    ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
             mDividerWidth = divider.getMeasuredWidth();
             mDividerHeight = divider.getMeasuredHeight();
 
@@ -224,7 +223,7 @@
                 lastView = word;
                 if (x == 0)
                     centeringFrom = word;
-                word.measure(WRAP_CONTENT,
+                word.measure(ViewGroup.LayoutParams.WRAP_CONTENT,
                         MeasureSpec.makeMeasureSpec(mCandidateStripHeight, MeasureSpec.EXACTLY));
                 final int width = word.getMeasuredWidth();
                 final int height = word.getMeasuredHeight();
@@ -234,7 +233,8 @@
                 if (info != null) {
                     paneView.addView(info);
                     lastView = info;
-                    info.measure(WRAP_CONTENT, WRAP_CONTENT);
+                    info.measure(ViewGroup.LayoutParams.WRAP_CONTENT,
+                            ViewGroup.LayoutParams.WRAP_CONTENT);
                     final int infoWidth = info.getMeasuredWidth();
                     FrameLayoutCompatUtils.placeViewAt(
                             info, x - infoWidth, y, infoWidth, info.getMeasuredHeight());
@@ -430,7 +430,8 @@
                 word.setText(text); // TextView.setText() resets text scale x to 1.0.
                 word.setTextScaleX(scaleX);
                 stripView.addView(word);
-                setLayoutWeight(word, getCandidateWeight(index), MATCH_PARENT);
+                setLayoutWeight(
+                        word, getCandidateWeight(index), ViewGroup.LayoutParams.MATCH_PARENT);
                 x += word.getMeasuredWidth();
 
                 if (DBG) {
@@ -439,7 +440,8 @@
                         final TextView info = mInfos.get(pos);
                         info.setText(debugInfo);
                         placer.addView(info);
-                        info.measure(WRAP_CONTENT, WRAP_CONTENT);
+                        info.measure(ViewGroup.LayoutParams.WRAP_CONTENT,
+                                ViewGroup.LayoutParams.WRAP_CONTENT);
                         final int infoWidth = info.getMeasuredWidth();
                         final int y = info.getMeasuredHeight();
                         FrameLayoutCompatUtils.placeViewAt(
@@ -515,7 +517,7 @@
             wordView.setText(text);
             wordView.setTextScaleX(wordScaleX);
             stripView.addView(wordView);
-            setLayoutWeight(wordView, mCenterCandidateWeight, MATCH_PARENT);
+            setLayoutWeight(wordView, mCenterCandidateWeight, ViewGroup.LayoutParams.MATCH_PARENT);
 
             stripView.addView(mDividers.get(0));
 
@@ -526,7 +528,8 @@
             hintView.setText(mHintToSaveText);
             hintView.setTextScaleX(hintScaleX);
             stripView.addView(hintView);
-            setLayoutWeight(hintView, 1.0f - mCenterCandidateWeight, MATCH_PARENT);
+            setLayoutWeight(
+                    hintView, 1.0f - mCenterCandidateWeight, ViewGroup.LayoutParams.MATCH_PARENT);
         }
     }
 
@@ -558,7 +561,8 @@
 
         mPreviewPopup = new PopupWindow(context);
         mPreviewText = (TextView) inflater.inflate(R.layout.candidate_preview, null);
-        mPreviewPopup.setWindowLayoutMode(WRAP_CONTENT, WRAP_CONTENT);
+        mPreviewPopup.setWindowLayoutMode(
+                ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
         mPreviewPopup.setContentView(mPreviewText);
         mPreviewPopup.setBackgroundDrawable(null);
 
@@ -796,8 +800,8 @@
         final TextView previewText = mPreviewText;
         previewText.setTextColor(mStripParams.mColorTypedWord);
         previewText.setText(word);
-        previewText.measure(MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED),
-                MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED));
+        previewText.measure(
+                ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
         final int[] offsetInWindow = new int[2];
         view.getLocationInWindow(offsetInWindow);
         final int posX = offsetInWindow[0];
diff --git a/java/src/com/android/inputmethod/latin/Settings.java b/java/src/com/android/inputmethod/latin/Settings.java
index a5eed90..b79c441 100644
--- a/java/src/com/android/inputmethod/latin/Settings.java
+++ b/java/src/com/android/inputmethod/latin/Settings.java
@@ -73,7 +73,6 @@
     public static final String PREF_AUTO_CORRECTION_THRESHOLD = "auto_correction_threshold";
     public static final String PREF_DEBUG_SETTINGS = "debug_settings";
 
-    public static final String PREF_NGRAM_SETTINGS_KEY = "ngram_settings";
     public static final String PREF_BIGRAM_SUGGESTIONS = "bigram_suggestion";
     public static final String PREF_BIGRAM_PREDICTIONS = "bigram_prediction";