am 6a96c508: Fix logic to show suggestions

* commit '6a96c508fddde10827b8f0822a7096bf4b708cf0':
  Fix logic to show suggestions
This commit is contained in:
Tadashi G. Takaoka 2014-06-11 03:05:26 +00:00 committed by Android Git Automerger
commit 9e272bdde2
2 changed files with 13 additions and 6 deletions

View file

@ -1336,9 +1336,12 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
final SettingsValues currentSettingsValues = mSettings.getCurrent(); final SettingsValues currentSettingsValues = mSettings.getCurrent();
final boolean shouldShowImportantNotice = final boolean shouldShowImportantNotice =
ImportantNoticeUtils.shouldShowImportantNotice(this); ImportantNoticeUtils.shouldShowImportantNotice(this);
final boolean shouldShowSuggestionCandidates =
currentSettingsValues.mInputAttributes.mShouldShowSuggestions
&& currentSettingsValues.isCurrentOrientationAllowingSuggestionsPerUserSettings();
final boolean shouldShowSuggestionsStripUnlessPassword = shouldShowImportantNotice final boolean shouldShowSuggestionsStripUnlessPassword = shouldShowImportantNotice
|| currentSettingsValues.mShowsVoiceInputKey || currentSettingsValues.mShowsVoiceInputKey
|| currentSettingsValues.isSuggestionsRequested() || shouldShowSuggestionCandidates
|| currentSettingsValues.isApplicationSpecifiedCompletionsOn(); || currentSettingsValues.isApplicationSpecifiedCompletionsOn();
final boolean shouldShowSuggestionsStrip = shouldShowSuggestionsStripUnlessPassword final boolean shouldShowSuggestionsStrip = shouldShowSuggestionsStripUnlessPassword
&& !currentSettingsValues.mInputAttributes.mIsPasswordField; && !currentSettingsValues.mInputAttributes.mIsPasswordField;
@ -1353,14 +1356,16 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
final boolean noSuggestionsToShow = (SuggestedWords.EMPTY == suggestedWords) final boolean noSuggestionsToShow = (SuggestedWords.EMPTY == suggestedWords)
|| suggestedWords.isPunctuationSuggestions() || suggestedWords.isPunctuationSuggestions()
|| isEmptyApplicationSpecifiedCompletions; || isEmptyApplicationSpecifiedCompletions;
final boolean isShowingImportantNotice;
if (shouldShowImportantNotice && noSuggestionsToShow) { if (shouldShowImportantNotice && noSuggestionsToShow) {
isShowingImportantNotice = mSuggestionStripView.maybeShowImportantNoticeTitle(); if (mSuggestionStripView.maybeShowImportantNoticeTitle()) {
} else { return;
isShowingImportantNotice = false; }
} }
if (currentSettingsValues.isSuggestionsRequested() && !isShowingImportantNotice) { if (currentSettingsValues.isCurrentOrientationAllowingSuggestionsPerUserSettings()
// We should clear suggestions if there is no suggestion to show.
|| noSuggestionsToShow
|| currentSettingsValues.isApplicationSpecifiedCompletionsOn()) {
mSuggestionStripView.setSuggestions(suggestedWords, mSuggestionStripView.setSuggestions(suggestedWords,
SubtypeLocaleUtils.isRtlLanguage(mSubtypeSwitcher.getCurrentSubtype())); SubtypeLocaleUtils.isRtlLanguage(mSubtypeSwitcher.getCurrentSubtype()));
} }

View file

@ -85,6 +85,7 @@ public final class SettingsValues {
public final int mKeyPreviewPopupDismissDelay; public final int mKeyPreviewPopupDismissDelay;
private final boolean mAutoCorrectEnabled; private final boolean mAutoCorrectEnabled;
public final float mAutoCorrectionThreshold; public final float mAutoCorrectionThreshold;
// TODO: Rename this to mAutoCorrectionEnabledPerUserSettings.
public final boolean mAutoCorrectionEnabled; public final boolean mAutoCorrectionEnabled;
public final int mSuggestionVisibility; public final int mSuggestionVisibility;
public final int mDisplayOrientation; public final int mDisplayOrientation;
@ -193,6 +194,7 @@ public final class SettingsValues {
return mInputAttributes.mApplicationSpecifiedCompletionOn; return mInputAttributes.mApplicationSpecifiedCompletionOn;
} }
// TODO: Rename this to needsToLookupSuggestions().
public boolean isSuggestionsRequested() { public boolean isSuggestionsRequested() {
return mInputAttributes.mShouldShowSuggestions return mInputAttributes.mShouldShowSuggestions
&& (mAutoCorrectionEnabled && (mAutoCorrectionEnabled