Merge "Use "dp" instead of "dip""
diff --git a/java/res/layout/key_preview.xml b/java/res/layout/key_preview.xml
index b620d07..6ed892e 100644
--- a/java/res/layout/key_preview.xml
+++ b/java/res/layout/key_preview.xml
@@ -20,8 +20,8 @@
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
- android:layout_height="80sp"
- android:textSize="40sp"
- android:minWidth="32dip"
+ android:layout_height="80dp"
+ android:textSize="40dp"
+ android:minWidth="32dp"
android:gravity="center"
/>
diff --git a/java/res/layout/suggestion_info.xml b/java/res/layout/suggestion_info.xml
index a364d46..a4ad6df 100644
--- a/java/res/layout/suggestion_info.xml
+++ b/java/res/layout/suggestion_info.xml
@@ -22,6 +22,6 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:textSize="6sp"
+ android:textSize="6dp"
android:textColor="@android:color/white"
style="?attr/suggestionBackgroundStyle" />
diff --git a/java/res/layout/suggestion_preview.xml b/java/res/layout/suggestion_preview.xml
index 3c026ae..856447b 100644
--- a/java/res/layout/suggestion_preview.xml
+++ b/java/res/layout/suggestion_preview.xml
@@ -21,8 +21,8 @@
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:textSize="18sp"
+ android:textSize="18dp"
android:textColor="?android:attr/textColorPrimaryInverse"
- android:minWidth="32dip"
+ android:minWidth="32dp"
android:gravity="center"
style="?attr/suggestionPreviewBackgroundStyle" />
diff --git a/java/res/values-sw600dp/dimens.xml b/java/res/values-sw600dp/dimens.xml
index c630ed3..0f256a3 100644
--- a/java/res/values-sw600dp/dimens.xml
+++ b/java/res/values-sw600dp/dimens.xml
@@ -63,7 +63,6 @@
<dimen name="key_preview_height">15.0mm</dimen>
<dimen name="key_preview_offset">0.1in</dimen>
- <dimen name="key_preview_height_ics">15.0mm</dimen>
<dimen name="key_preview_offset_ics">0.05in</dimen>
<!-- popup_key_height x -0.5 -->
<dimen name="more_keys_keyboard_vertical_correction_ics">-5mm</dimen>
diff --git a/java/res/values-sw768dp-land/dimens.xml b/java/res/values-sw768dp-land/dimens.xml
index abaf594..535c623 100644
--- a/java/res/values-sw768dp-land/dimens.xml
+++ b/java/res/values-sw768dp-land/dimens.xml
@@ -55,7 +55,6 @@
<fraction name="spacebar_text_ratio">24.00%</fraction>
<dimen name="key_preview_height">17.0mm</dimen>
- <dimen name="key_preview_height_ics">26.5mm</dimen>
<dimen name="key_preview_offset_ics">0.05in</dimen>
<dimen name="suggestions_strip_padding">40.0mm</dimen>
diff --git a/java/res/values-sw768dp/dimens.xml b/java/res/values-sw768dp/dimens.xml
index 9bf47667..7aefa26 100644
--- a/java/res/values-sw768dp/dimens.xml
+++ b/java/res/values-sw768dp/dimens.xml
@@ -66,7 +66,6 @@
<dimen name="key_preview_height">15.0mm</dimen>
<dimen name="key_preview_offset">0.1in</dimen>
- <dimen name="key_preview_height_ics">15.0mm</dimen>
<dimen name="key_preview_offset_ics">0.05in</dimen>
<!-- popup_key_height x -0.5 -->
<dimen name="more_keys_keyboard_vertical_correction_ics">-5mm</dimen>
diff --git a/java/res/values/dimens.xml b/java/res/values/dimens.xml
index e80827e..5f74fa7 100644
--- a/java/res/values/dimens.xml
+++ b/java/res/values/dimens.xml
@@ -67,7 +67,7 @@
<fraction name="key_uppercase_letter_ratio">35%</fraction>
<fraction name="key_preview_text_ratio">82%</fraction>
<fraction name="spacebar_text_ratio">33.735%</fraction>
- <dimen name="key_preview_height">80sp</dimen>
+ <dimen name="key_preview_height">80dp</dimen>
<dimen name="key_preview_offset">0.1in</dimen>
<dimen name="key_label_horizontal_padding">4dp</dimen>
@@ -75,7 +75,6 @@
<dimen name="key_popup_hint_letter_padding">2dp</dimen>
<dimen name="key_uppercase_letter_padding">2dp</dimen>
- <dimen name="key_preview_height_ics">80sp</dimen>
<dimen name="key_preview_offset_ics">0.05in</dimen>
<!-- popup_key_height x -0.5 -->
<dimen name="more_keys_keyboard_vertical_correction_ics">-0.165in</dimen>
diff --git a/java/res/values/styles.xml b/java/res/values/styles.xml
index a4bfc1a..5628f27 100644
--- a/java/res/values/styles.xml
+++ b/java/res/values/styles.xml
@@ -315,7 +315,6 @@
<item name="keyPreviewBackgroundWidth">@dimen/keyboard_key_feedback_background_holo_width</item>
<item name="keyPreviewBackgroundHeight">@dimen/keyboard_key_feedback_background_holo_height</item>
<item name="keyPreviewTextColor">#FFFFFFFF</item>
- <item name="keyPreviewHeight">@dimen/key_preview_height_ics</item>
<item name="keyPreviewOffset">@dimen/key_preview_offset_ics</item>
<item name="shadowColor">#00000000</item>
<item name="shadowRadius">0.0</item>
diff --git a/java/src/com/android/inputmethod/latin/BinaryDictionary.java b/java/src/com/android/inputmethod/latin/BinaryDictionary.java
index 31ff4e7..dfc8c8e 100644
--- a/java/src/com/android/inputmethod/latin/BinaryDictionary.java
+++ b/java/src/com/android/inputmethod/latin/BinaryDictionary.java
@@ -149,6 +149,9 @@
int count = getBigramsNative(mNativeDict, chars, chars.length, mInputCodes, codesSize,
mOutputChars_bigrams, mBigramScores, MAX_WORD_LENGTH, MAX_BIGRAMS,
MAX_PROXIMITY_CHARS_SIZE);
+ if (count > MAX_BIGRAMS) {
+ count = MAX_BIGRAMS;
+ }
for (int j = 0; j < count; ++j) {
if (codesSize > 0 && mBigramScores[j] < 1) break;
diff --git a/java/src/com/android/inputmethod/latin/BinaryDictionaryFileDumper.java b/java/src/com/android/inputmethod/latin/BinaryDictionaryFileDumper.java
index 9ffc7d0..8ec4405 100644
--- a/java/src/com/android/inputmethod/latin/BinaryDictionaryFileDumper.java
+++ b/java/src/com/android/inputmethod/latin/BinaryDictionaryFileDumper.java
@@ -196,8 +196,8 @@
} finally {
// Ignore exceptions while closing files.
try {
- // afd.close() will close inputStream, we should not call inputStream.close().
- if (null != afd) afd.close();
+ // inputStream.close() will close afd, we should not call afd.close().
+ if (null != inputStream) inputStream.close();
} catch (Exception e) {
Log.e(TAG, "Exception while closing a cross-process file descriptor : " + e);
}
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index 99a4d54..e67f0ea 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -1288,7 +1288,7 @@
mDeleteCount++;
mExpectingUpdateSelection = true;
mShouldSwitchToLastSubtype = true;
- LatinImeLogger.logOnDelete();
+ LatinImeLogger.logOnDelete(x, y);
break;
case Keyboard.CODE_SHIFT:
case Keyboard.CODE_SWITCH_ALPHA_SYMBOL:
diff --git a/java/src/com/android/inputmethod/latin/LatinImeLogger.java b/java/src/com/android/inputmethod/latin/LatinImeLogger.java
index 683dafa..079f3b5 100644
--- a/java/src/com/android/inputmethod/latin/LatinImeLogger.java
+++ b/java/src/com/android/inputmethod/latin/LatinImeLogger.java
@@ -51,7 +51,7 @@
public static void logOnAutoCorrectionCancelled() {
}
- public static void logOnDelete() {
+ public static void logOnDelete(int x, int y) {
}
public static void logOnInputChar() {
diff --git a/java/src/com/android/inputmethod/latin/Utils.java b/java/src/com/android/inputmethod/latin/Utils.java
index a7de47c..509bd36 100644
--- a/java/src/com/android/inputmethod/latin/Utils.java
+++ b/java/src/com/android/inputmethod/latin/Utils.java
@@ -260,8 +260,8 @@
}
}
- public static void writeBackSpace() {
- UsabilityStudyLogUtils.getInstance().write("<backspace>\t0\t0");
+ public static void writeBackSpace(int x, int y) {
+ UsabilityStudyLogUtils.getInstance().write("<backspace>\t" + x + "\t" + y);
}
public void writeChar(char c, int x, int y) {
diff --git a/native/src/bigram_dictionary.cpp b/native/src/bigram_dictionary.cpp
index 84048d7..fa69de8 100644
--- a/native/src/bigram_dictionary.cpp
+++ b/native/src/bigram_dictionary.cpp
@@ -137,9 +137,10 @@
// codesSize == 0 means we are trying to find bigram predictions.
if (codesSize < 1 || checkFirstCharacter(bigramBuffer)) {
const int frequency = UnigramDictionary::MASK_ATTRIBUTE_FREQUENCY & bigramFlags;
- addWordBigram(bigramBuffer, length, frequency);
+ if (addWordBigram(bigramBuffer, length, frequency)) {
+ ++bigramCount;
+ }
}
- ++bigramCount;
} while (0 != (UnigramDictionary::FLAG_ATTRIBUTE_HAS_NEXT & bigramFlags));
return bigramCount;
}