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