am ce86e39e: Merge "Cleanup."

* commit 'ce86e39e002caf0507305754e2c39010866e7ecc':
  Cleanup.
main
Jean Chalard 2011-11-21 00:56:03 -08:00 committed by Android Git Automerger
commit 940d6250bf
2 changed files with 8 additions and 5 deletions

View File

@ -193,7 +193,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
private UserDictionary mUserDictionary;
private UserBigramDictionary mUserBigramDictionary;
private UserUnigramDictionary mUserUnigramDictionary;
private boolean mIsUserDictionaryAvaliable;
private boolean mIsUserDictionaryAvailable;
// TODO: Create an inner class to group options and pseudo-options to improve readability.
// These variables are initialized according to the {@link EditorInfo#inputType}.
@ -582,7 +582,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
mUserDictionary = new UserDictionary(this, localeStr);
mSuggest.setUserDictionary(mUserDictionary);
mIsUserDictionaryAvaliable = mUserDictionary.isEnabled();
mIsUserDictionaryAvailable = mUserDictionary.isEnabled();
resetContactsDictionary(oldContactsDictionary);
@ -2007,7 +2007,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
// take a noticeable delay to update them which may feel uneasy.
}
if (showingAddToDictionaryHint) {
if (mIsUserDictionaryAvaliable) {
if (mIsUserDictionaryAvailable) {
mSuggestionsView.showAddToDictionaryHint(
suggestion, mSettingsValues.mHintToSaveText);
} else {

View File

@ -134,7 +134,11 @@ public class UserDictionary extends ExpandableDictionary {
final Cursor cursor = getContext().getContentResolver()
.query(Words.CONTENT_URI, PROJECTION_QUERY, request.toString(),
requestArguments, null);
addWords(cursor);
try {
addWords(cursor);
} finally {
if (null != cursor) cursor.close();
}
}
public boolean isEnabled() {
@ -242,6 +246,5 @@ public class UserDictionary extends ExpandableDictionary {
cursor.moveToNext();
}
}
cursor.close();
}
}