am affdd364: Set neutral suggestions should be called after load settings
* commit 'affdd364232549d2062fc180f924f5b6496c26fd': Set neutral suggestions should be called after load settingsmain
commit
b512946c90
|
@ -200,13 +200,19 @@ public final class InputAttributes {
|
|||
// Pretty print
|
||||
@Override
|
||||
public String toString() {
|
||||
return "\n mInputTypeNoAutoCorrect = " + mInputTypeNoAutoCorrect
|
||||
+ "\n mIsSettingsSuggestionStripOn = " + mIsSettingsSuggestionStripOn
|
||||
+ "\n mApplicationSpecifiedCompletionOn = " + mApplicationSpecifiedCompletionOn;
|
||||
return String.format(
|
||||
"%s: inputType=0x%08x%s%s%s%s%s targetApp=%s\n", getClass().getSimpleName(),
|
||||
mInputType,
|
||||
(mInputTypeNoAutoCorrect ? " noAutoCorrect" : ""),
|
||||
(mIsPasswordField ? " password" : ""),
|
||||
(mIsSettingsSuggestionStripOn ? " suggestionStrip" : ""),
|
||||
(mApplicationSpecifiedCompletionOn ? " appSpecified" : ""),
|
||||
(mShouldInsertSpacesAutomatically ? " insertSpaces" : ""),
|
||||
mTargetApplicationPackageName);
|
||||
}
|
||||
|
||||
public static boolean inPrivateImeOptions(String packageName, String key,
|
||||
EditorInfo editorInfo) {
|
||||
public static boolean inPrivateImeOptions(final String packageName, final String key,
|
||||
final EditorInfo editorInfo) {
|
||||
if (editorInfo == null) return false;
|
||||
final String findingKey = (packageName != null) ? packageName + "." + key : key;
|
||||
return StringUtils.containsInCommaSplittableText(findingKey, editorInfo.privateImeOptions);
|
||||
|
|
|
@ -781,11 +781,6 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
|||
if (null != suggest && null != currentLocale && !currentLocale.equals(suggest.mLocale)) {
|
||||
initSuggest();
|
||||
}
|
||||
if (mSuggestionStripView != null) {
|
||||
// This will set the punctuation suggestions if next word suggestion is off;
|
||||
// otherwise it will clear the suggestion strip.
|
||||
setNeutralSuggestionStrip();
|
||||
}
|
||||
|
||||
// Sometimes, while rotating, for some reason the framework tells the app we are not
|
||||
// connected to it and that means we can't refresh the cache. In this case, schedule a
|
||||
|
@ -834,8 +829,9 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
|||
// Space state must be updated before calling updateShiftState
|
||||
switcher.updateShiftState();
|
||||
}
|
||||
setSuggestionStripShownInternal(
|
||||
isSuggestionsStripVisible(), /* needsInputViewShown */ false);
|
||||
// This will set the punctuation suggestions if next word suggestion is off;
|
||||
// otherwise it will clear the suggestion strip.
|
||||
setNeutralSuggestionStripInternal(false /* needsInputViewShown */);
|
||||
|
||||
mHandler.cancelUpdateSuggestionStrip();
|
||||
mHandler.cancelDoubleSpacePeriodTimer();
|
||||
|
@ -1004,7 +1000,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
|||
false /* isObsoleteSuggestions */,
|
||||
false /* isPrediction */);
|
||||
// When in fullscreen mode, show completions generated by the application
|
||||
setSuggestedWords(suggestedWords, true /* shouldShow */);
|
||||
setSuggestedWords(suggestedWords, true /* shouldShow */, true /* needsInputViewShown */);
|
||||
if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) {
|
||||
ResearchLogger.latinIME_onDisplayCompletions(applicationSpecifiedCompletions);
|
||||
}
|
||||
|
@ -1356,26 +1352,28 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
|||
}
|
||||
|
||||
// TODO[IL]: Define a clear interface for this
|
||||
public void setSuggestedWords(final SuggestedWords suggestedWords, final boolean shouldShow) {
|
||||
public void setSuggestedWords(final SuggestedWords suggestedWords, final boolean shouldShow,
|
||||
final boolean needsInputViewShown) {
|
||||
mInputLogic.setSuggestedWords(suggestedWords);
|
||||
if (mSuggestionStripView != null) {
|
||||
final SettingsValues currentSettings = mSettings.getCurrent();
|
||||
final boolean showSuggestions;
|
||||
if (SuggestedWords.EMPTY == suggestedWords
|
||||
|| suggestedWords.isPunctuationSuggestions()
|
||||
|| !currentSettings.isSuggestionsRequested()) {
|
||||
showSuggestions = !mSuggestionStripView.maybeShowImportantNoticeTitle(
|
||||
currentSettings.mInputAttributes);
|
||||
} else {
|
||||
showSuggestions = true;
|
||||
}
|
||||
if (showSuggestions) {
|
||||
mSuggestionStripView.setSuggestions(suggestedWords,
|
||||
SubtypeLocaleUtils.isRtlLanguage(mSubtypeSwitcher.getCurrentSubtype()));
|
||||
}
|
||||
mKeyboardSwitcher.onAutoCorrectionStateChanged(suggestedWords.mWillAutoCorrect);
|
||||
setSuggestionStripShownInternal(shouldShow, true /* needsInputViewShown */);
|
||||
if (mSuggestionStripView == null) {
|
||||
return;
|
||||
}
|
||||
final SettingsValues currentSettings = mSettings.getCurrent();
|
||||
final boolean showSuggestions;
|
||||
if (SuggestedWords.EMPTY == suggestedWords
|
||||
|| suggestedWords.isPunctuationSuggestions()
|
||||
|| !currentSettings.isSuggestionsRequested()) {
|
||||
showSuggestions = !mSuggestionStripView.maybeShowImportantNoticeTitle(
|
||||
currentSettings.mInputAttributes);
|
||||
} else {
|
||||
showSuggestions = true;
|
||||
}
|
||||
if (showSuggestions) {
|
||||
mSuggestionStripView.setSuggestions(suggestedWords,
|
||||
SubtypeLocaleUtils.isRtlLanguage(mSubtypeSwitcher.getCurrentSubtype()));
|
||||
}
|
||||
mKeyboardSwitcher.onAutoCorrectionStateChanged(suggestedWords.mWillAutoCorrect);
|
||||
setSuggestionStripShownInternal(shouldShow, needsInputViewShown);
|
||||
}
|
||||
|
||||
// TODO[IL]: Move this out of LatinIME.
|
||||
|
@ -1463,7 +1461,8 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
|||
setNeutralSuggestionStrip();
|
||||
} else {
|
||||
mInputLogic.mWordComposer.setAutoCorrection(autoCorrection);
|
||||
setSuggestedWords(suggestedWords, isSuggestionsStripVisible());
|
||||
setSuggestedWords(
|
||||
suggestedWords, isSuggestionsStripVisible(), true /* needsInputViewShown */);
|
||||
}
|
||||
// Cache the auto-correction in accessibility code so we can speak it if the user
|
||||
// touches a key that will insert it.
|
||||
|
@ -1490,13 +1489,14 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
|||
// punctuation suggestions (if it's disabled).
|
||||
@Override
|
||||
public void setNeutralSuggestionStrip() {
|
||||
setNeutralSuggestionStripInternal(true /* needsInputViewShown */);
|
||||
}
|
||||
|
||||
private void setNeutralSuggestionStripInternal(final boolean needsInputViewShown) {
|
||||
final SettingsValues currentSettings = mSettings.getCurrent();
|
||||
if (currentSettings.mBigramPredictionEnabled) {
|
||||
setSuggestedWords(SuggestedWords.EMPTY, isSuggestionsStripVisible());
|
||||
} else {
|
||||
setSuggestedWords(currentSettings.mSpacingAndPunctuations.mSuggestPuncList,
|
||||
isSuggestionsStripVisible());
|
||||
}
|
||||
final SuggestedWords neutralSuggestions = currentSettings.mBigramPredictionEnabled
|
||||
? SuggestedWords.EMPTY : currentSettings.mSpacingAndPunctuations.mSuggestPuncList;
|
||||
setSuggestedWords(neutralSuggestions, isSuggestionsStripVisible(), needsInputViewShown);
|
||||
}
|
||||
|
||||
// TODO: Make this private
|
||||
|
|
|
@ -233,7 +233,9 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick
|
|||
return false;
|
||||
}
|
||||
final int width = getWidth();
|
||||
if (width <= 0) return false;
|
||||
if (width <= 0) {
|
||||
return false;
|
||||
}
|
||||
mLayoutHelper.layoutImportantNotice(mImportantNoticeStrip, width);
|
||||
mStripVisibilityGroup.showImportantNoticeStrip();
|
||||
mImportantNoticeStrip.setOnClickListener(this);
|
||||
|
@ -429,9 +431,11 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
|
||||
protected void onSizeChanged(final int w, final int h, final int oldw, final int oldh) {
|
||||
// Called by the framework when the size is known. Show the important notice if applicable.
|
||||
// This may be overriden by showing suggestions later, if applicable.
|
||||
maybeShowImportantNoticeTitle(Settings.getInstance().getCurrent().mInputAttributes);
|
||||
if (oldw <= 0 && w > 0) {
|
||||
maybeShowImportantNoticeTitle(Settings.getInstance().getCurrent().mInputAttributes);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue