aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin
diff options
context:
space:
mode:
Diffstat (limited to 'java/src/com/android/inputmethod/latin')
-rw-r--r--java/src/com/android/inputmethod/latin/MoreSuggestions.java7
-rw-r--r--java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java49
2 files changed, 36 insertions, 20 deletions
diff --git a/java/src/com/android/inputmethod/latin/MoreSuggestions.java b/java/src/com/android/inputmethod/latin/MoreSuggestions.java
index 24011c41e..1afa07214 100644
--- a/java/src/com/android/inputmethod/latin/MoreSuggestions.java
+++ b/java/src/com/android/inputmethod/latin/MoreSuggestions.java
@@ -92,8 +92,9 @@ public class MoreSuggestions extends Keyboard {
}
mNumColumnsInRow[row] = pos - rowStartPos;
mNumRows = row + 1;
- mWidth = mOccupiedWidth = Math.max(minWidth, calcurateMaxRowWidth(fromPos, pos));
- mHeight = mOccupiedHeight = mNumRows * mDefaultRowHeight + mVerticalGap;
+ mBaseWidth = mOccupiedWidth = Math.max(
+ minWidth, calcurateMaxRowWidth(fromPos, pos));
+ mBaseHeight = mOccupiedHeight = mNumRows * mDefaultRowHeight + mVerticalGap;
return pos - fromPos;
}
@@ -149,7 +150,7 @@ public class MoreSuggestions extends Keyboard {
public int getWidth(int pos) {
final int numColumnInRow = getNumColumnInRow(pos);
- return (mWidth - mDividerWidth * (numColumnInRow - 1)) / numColumnInRow;
+ return (mOccupiedWidth - mDividerWidth * (numColumnInRow - 1)) / numColumnInRow;
}
public int getFlags(int pos) {
diff --git a/java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java b/java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java
index 915c40572..77fbe3ec6 100644
--- a/java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java
+++ b/java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java
@@ -334,10 +334,19 @@ public class AndroidSpellCheckerService extends SpellCheckerService {
final String text = textInfo.getText();
if (shouldFilterOut(text)) {
- final DictAndProximity dictInfo = mDictionaryPool.takeOrGetNull();
- if (null == dictInfo) return NOT_IN_DICT_EMPTY_SUGGESTIONS;
- return dictInfo.mDictionary.isValidWord(text) ? IN_DICT_EMPTY_SUGGESTIONS
- : NOT_IN_DICT_EMPTY_SUGGESTIONS;
+ DictAndProximity dictInfo = null;
+ try {
+ dictInfo = mDictionaryPool.takeOrGetNull();
+ if (null == dictInfo) return NOT_IN_DICT_EMPTY_SUGGESTIONS;
+ return dictInfo.mDictionary.isValidWord(text) ? IN_DICT_EMPTY_SUGGESTIONS
+ : NOT_IN_DICT_EMPTY_SUGGESTIONS;
+ } finally {
+ if (null != dictInfo) {
+ if (!mDictionaryPool.offer(dictInfo)) {
+ Log.e(TAG, "Can't re-insert a dictionary into its pool");
+ }
+ }
+ }
}
final SuggestionsGatherer suggestionsGatherer =
@@ -361,19 +370,25 @@ public class AndroidSpellCheckerService extends SpellCheckerService {
final int capitalizeType = getCapitalizationType(text);
boolean isInDict = true;
- final DictAndProximity dictInfo = mDictionaryPool.takeOrGetNull();
- if (null == dictInfo) return NOT_IN_DICT_EMPTY_SUGGESTIONS;
- dictInfo.mDictionary.getWords(composer, suggestionsGatherer,
- dictInfo.mProximityInfo);
- isInDict = dictInfo.mDictionary.isValidWord(text);
- if (!isInDict && CAPITALIZE_NONE != capitalizeType) {
- // We want to test the word again if it's all caps or first caps only.
- // If it's fully down, we already tested it, if it's mixed case, we don't
- // want to test a lowercase version of it.
- isInDict = dictInfo.mDictionary.isValidWord(text.toLowerCase(mLocale));
- }
- if (!mDictionaryPool.offer(dictInfo)) {
- Log.e(TAG, "Can't re-insert a dictionary into its pool");
+ DictAndProximity dictInfo = null;
+ try {
+ dictInfo = mDictionaryPool.takeOrGetNull();
+ if (null == dictInfo) return NOT_IN_DICT_EMPTY_SUGGESTIONS;
+ dictInfo.mDictionary.getWords(composer, suggestionsGatherer,
+ dictInfo.mProximityInfo);
+ isInDict = dictInfo.mDictionary.isValidWord(text);
+ if (!isInDict && CAPITALIZE_NONE != capitalizeType) {
+ // We want to test the word again if it's all caps or first caps only.
+ // If it's fully down, we already tested it, if it's mixed case, we don't
+ // want to test a lowercase version of it.
+ isInDict = dictInfo.mDictionary.isValidWord(text.toLowerCase(mLocale));
+ }
+ } finally {
+ if (null != dictInfo) {
+ if (!mDictionaryPool.offer(dictInfo)) {
+ Log.e(TAG, "Can't re-insert a dictionary into its pool");
+ }
+ }
}
final SuggestionsGatherer.Result result = suggestionsGatherer.getResults(text,