aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/LatinIME.java
diff options
context:
space:
mode:
Diffstat (limited to 'java/src/com/android/inputmethod/latin/LatinIME.java')
-rw-r--r--java/src/com/android/inputmethod/latin/LatinIME.java34
1 files changed, 17 insertions, 17 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index 5236591f6..77a0ccf70 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -872,7 +872,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
if (ProductionFlag.IS_EXPERIMENTAL) {
ResearchLogger.latinIME_onDisplayCompletions(applicationSpecifiedCompletions);
}
- if (mInputAttributes.mApplicationSpecifiedCompletionOn) {
+ if (null != mInputAttributes && mInputAttributes.mApplicationSpecifiedCompletionOn) {
mApplicationSpecifiedCompletions = applicationSpecifiedCompletions;
if (applicationSpecifiedCompletions == null) {
clearSuggestions();
@@ -1627,8 +1627,8 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
}
public boolean isSuggestionsRequested() {
- // TODO: move this method to mSettingsValues
- return mInputAttributes.mIsSettingsSuggestionStripOn
+ // TODO: move this method to mCurrentSettings
+ return (null != mInputAttributes && mInputAttributes.mIsSettingsSuggestionStripOn)
&& (mCurrentSettings.isCorrectionOn() || isShowingSuggestionsStrip());
}
@@ -1648,7 +1648,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
return true;
if (!isShowingSuggestionsStrip())
return false;
- if (mInputAttributes.mApplicationSpecifiedCompletionOn)
+ if (null != mInputAttributes && mInputAttributes.mApplicationSpecifiedCompletionOn)
return true;
return isSuggestionsRequested();
}
@@ -1804,14 +1804,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
@Override
public void pickSuggestionManually(final int index, final CharSequence suggestion,
- int x, int y) {
- mConnection.beginBatchEdit(getCurrentInputConnection());
- pickSuggestionManuallyWhileInBatchEdit(index, suggestion, x, y);
- mConnection.endBatchEdit();
- }
-
- public void pickSuggestionManuallyWhileInBatchEdit(final int index,
- final CharSequence suggestion, final int x, final int y) {
+ final int x, final int y) {
final SuggestedWords suggestedWords = mSuggestionsView.getSuggestions();
// If this is a punctuation picked from the suggestion strip, pass it to onCodeInput
if (suggestion.length() == 1 && isShowingPunctuationList()) {
@@ -1837,7 +1830,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
}
}
- if (mInputAttributes.mApplicationSpecifiedCompletionOn
+ if ((null != mInputAttributes && mInputAttributes.mApplicationSpecifiedCompletionOn)
&& mApplicationSpecifiedCompletions != null
&& index >= 0 && index < mApplicationSpecifiedCompletions.length) {
if (mSuggestionsView != null) {
@@ -1846,7 +1839,9 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
mKeyboardSwitcher.updateShiftState();
resetComposingState(true /* alsoResetLastComposedWord */);
final CompletionInfo completionInfo = mApplicationSpecifiedCompletions[index];
+ mConnection.beginBatchEdit(getCurrentInputConnection());
mConnection.commitCompletion(completionInfo);
+ mConnection.endBatchEdit();
if (ProductionFlag.IS_EXPERIMENTAL) {
ResearchLogger.latinIME_pickApplicationSpecifiedCompletion(index,
completionInfo.getText(), x, y);
@@ -1958,12 +1953,16 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
// showSuggestions will retrieve the word near the cursor, we don't want that here)
showSuggestions(suggestedWords, "");
} else {
- if (!isShowingPunctuationList()) setPunctuationSuggestions();
+ clearSuggestions();
}
}
public void setPunctuationSuggestions() {
- setSuggestions(mCurrentSettings.mSuggestPuncList, false);
+ if (mCurrentSettings.mBigramPredictionEnabled) {
+ clearSuggestions();
+ } else {
+ setSuggestions(mCurrentSettings.mSuggestPuncList, false);
+ }
setAutoCorrectionIndicator(false);
setSuggestionStripShown(isSuggestionsStripVisible());
}
@@ -1986,10 +1985,11 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
} else {
secondWord = suggestion.toString();
}
- // We demote unrecognized word and words with 0-frequency (assuming they would be
- // profanity etc.) by specifying them as "invalid".
+ // We demote unrecognized words (frequency < 0, below) by specifying them as "invalid".
+ // We don't add words with 0-frequency (assuming they would be profanity etc.).
final int maxFreq = AutoCorrection.getMaxFrequency(
mSuggest.getUnigramDictionaries(), suggestion);
+ if (maxFreq == 0) return null;
mUserHistoryDictionary.addToUserHistory(null == prevWord ? null : prevWord.toString(),
secondWord, maxFreq > 0);
return prevWord;