parent
affdd36423
commit
2312c1954f
|
@ -979,7 +979,9 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!mSettings.getCurrent().isApplicationSpecifiedCompletionsOn()) return;
|
if (!mSettings.getCurrent().isApplicationSpecifiedCompletionsOn()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (applicationSpecifiedCompletions == null) {
|
if (applicationSpecifiedCompletions == null) {
|
||||||
setNeutralSuggestionStrip();
|
setNeutralSuggestionStrip();
|
||||||
if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) {
|
if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) {
|
||||||
|
@ -993,27 +995,25 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
final ArrayList<SuggestedWords.SuggestedWordInfo> applicationSuggestedWords =
|
final ArrayList<SuggestedWords.SuggestedWordInfo> applicationSuggestedWords =
|
||||||
SuggestedWords.getFromApplicationSpecifiedCompletions(
|
SuggestedWords.getFromApplicationSpecifiedCompletions(
|
||||||
applicationSpecifiedCompletions);
|
applicationSpecifiedCompletions);
|
||||||
final SuggestedWords suggestedWords = new SuggestedWords(
|
final SuggestedWords suggestedWords = new SuggestedWords(applicationSuggestedWords,
|
||||||
applicationSuggestedWords, null /* rawSuggestions */,
|
null /* rawSuggestions */, false /* typedWordValid */, false /* willAutoCorrect */,
|
||||||
false /* typedWordValid */,
|
false /* isObsoleteSuggestions */, false /* isPrediction */);
|
||||||
false /* willAutoCorrect */,
|
// When in fullscreen mode, show completions generated by the application forcibly
|
||||||
false /* isObsoleteSuggestions */,
|
setSuggestedWords(suggestedWords, true /* isSuggestionStripVisible */,
|
||||||
false /* isPrediction */);
|
true /* needsInputViewShown */);
|
||||||
// When in fullscreen mode, show completions generated by the application
|
|
||||||
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setSuggestionStripShownInternal(final boolean shown,
|
private void setSuggestionStripShownInternal(final boolean isSuggestionStripVisible,
|
||||||
final boolean needsInputViewShown) {
|
final boolean needsInputViewShown) {
|
||||||
// TODO: Modify this if we support suggestions with hard keyboard
|
// TODO: Modify this if we support suggestions with hard keyboard
|
||||||
if (!onEvaluateInputViewShown() || null == mSuggestionStripView) {
|
if (!onEvaluateInputViewShown() || null == mSuggestionStripView) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final boolean inputViewShown = mKeyboardSwitcher.isShowingMainKeyboardOrEmojiPalettes();
|
final boolean inputViewShown = mKeyboardSwitcher.isShowingMainKeyboardOrEmojiPalettes();
|
||||||
final boolean shouldShowSuggestions = shown
|
final boolean shouldShowSuggestions = isSuggestionStripVisible
|
||||||
&& (needsInputViewShown ? inputViewShown : true);
|
&& (needsInputViewShown ? inputViewShown : true);
|
||||||
if (shouldShowSuggestions) {
|
if (shouldShowSuggestions) {
|
||||||
mSuggestionStripView.setVisibility(View.VISIBLE);
|
mSuggestionStripView.setVisibility(View.VISIBLE);
|
||||||
|
@ -1317,20 +1317,27 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO[IL]: Define a clear interface for this
|
// TODO[IL]: Define a clear interface for this
|
||||||
public boolean isSuggestionsStripVisible() {
|
public boolean isSuggestionStripVisible() {
|
||||||
final SettingsValues currentSettings = mSettings.getCurrent();
|
final SettingsValues currentSettings = mSettings.getCurrent();
|
||||||
if (mSuggestionStripView == null)
|
if (mSuggestionStripView == null) {
|
||||||
return false;
|
return false;
|
||||||
if (mSuggestionStripView.isShowingAddToDictionaryHint())
|
}
|
||||||
|
if (mSuggestionStripView.isShowingAddToDictionaryHint()) {
|
||||||
return true;
|
return true;
|
||||||
if (null == currentSettings)
|
}
|
||||||
|
if (null == currentSettings) {
|
||||||
return false;
|
return false;
|
||||||
if (ImportantNoticeUtils.shouldShowImportantNotice(this, currentSettings.mInputAttributes))
|
}
|
||||||
|
if (ImportantNoticeUtils.shouldShowImportantNotice(this,
|
||||||
|
currentSettings.mInputAttributes)) {
|
||||||
return true;
|
return true;
|
||||||
if (!currentSettings.isSuggestionStripVisible())
|
}
|
||||||
|
if (!currentSettings.isSuggestionStripVisible()) {
|
||||||
return false;
|
return false;
|
||||||
if (currentSettings.isApplicationSpecifiedCompletionsOn())
|
}
|
||||||
|
if (currentSettings.isApplicationSpecifiedCompletionsOn()) {
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
return currentSettings.isSuggestionsRequested();
|
return currentSettings.isSuggestionsRequested();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1352,8 +1359,8 @@ 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 needsInputViewShown) {
|
final boolean isSuggestionStripVisible, final boolean needsInputViewShown) {
|
||||||
mInputLogic.setSuggestedWords(suggestedWords);
|
mInputLogic.setSuggestedWords(suggestedWords);
|
||||||
if (mSuggestionStripView == null) {
|
if (mSuggestionStripView == null) {
|
||||||
return;
|
return;
|
||||||
|
@ -1373,7 +1380,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, needsInputViewShown);
|
setSuggestionStripShownInternal(isSuggestionStripVisible, needsInputViewShown);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO[IL]: Move this out of LatinIME.
|
// TODO[IL]: Move this out of LatinIME.
|
||||||
|
@ -1462,7 +1469,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
} else {
|
} else {
|
||||||
mInputLogic.mWordComposer.setAutoCorrection(autoCorrection);
|
mInputLogic.mWordComposer.setAutoCorrection(autoCorrection);
|
||||||
setSuggestedWords(
|
setSuggestedWords(
|
||||||
suggestedWords, isSuggestionsStripVisible(), true /* needsInputViewShown */);
|
suggestedWords, isSuggestionStripVisible(), 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.
|
||||||
|
@ -1496,7 +1503,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
final SettingsValues currentSettings = mSettings.getCurrent();
|
final SettingsValues currentSettings = mSettings.getCurrent();
|
||||||
final SuggestedWords neutralSuggestions = currentSettings.mBigramPredictionEnabled
|
final SuggestedWords neutralSuggestions = currentSettings.mBigramPredictionEnabled
|
||||||
? SuggestedWords.EMPTY : currentSettings.mSpacingAndPunctuations.mSuggestPuncList;
|
? SuggestedWords.EMPTY : currentSettings.mSpacingAndPunctuations.mSuggestPuncList;
|
||||||
setSuggestedWords(neutralSuggestions, isSuggestionsStripVisible(), needsInputViewShown);
|
setSuggestedWords(neutralSuggestions, isSuggestionStripVisible(), needsInputViewShown);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Make this private
|
// TODO: Make this private
|
||||||
|
|
Loading…
Reference in New Issue