use of com.android.inputmethod.latin.settings.SettingsValues in project android_packages_inputmethods_LatinIME by CyanogenMod.
the class LatinIME method setSuggestedWords.
private void setSuggestedWords(final SuggestedWords suggestedWords) {
final SettingsValues currentSettingsValues = mSettings.getCurrent();
mInputLogic.setSuggestedWords(suggestedWords);
// TODO: Modify this when we support suggestions with hard keyboard
if (!hasSuggestionStripView()) {
return;
}
if (!onEvaluateInputViewShown()) {
return;
}
final boolean shouldShowImportantNotice = ImportantNoticeUtils.shouldShowImportantNotice(this, currentSettingsValues);
final boolean shouldShowSuggestionCandidates = currentSettingsValues.mInputAttributes.mShouldShowSuggestions && currentSettingsValues.isSuggestionsEnabledPerUserSettings();
final boolean shouldShowSuggestionsStripUnlessPassword = shouldShowImportantNotice || currentSettingsValues.mShowsVoiceInputKey || shouldShowSuggestionCandidates || currentSettingsValues.isApplicationSpecifiedCompletionsOn();
final boolean shouldShowSuggestionsStrip = shouldShowSuggestionsStripUnlessPassword && !currentSettingsValues.mInputAttributes.mIsPasswordField;
mSuggestionStripView.updateVisibility(shouldShowSuggestionsStrip, isFullscreenMode());
if (!shouldShowSuggestionsStrip) {
return;
}
final boolean isEmptyApplicationSpecifiedCompletions = currentSettingsValues.isApplicationSpecifiedCompletionsOn() && suggestedWords.isEmpty();
final boolean noSuggestionsFromDictionaries = suggestedWords.isEmpty() || suggestedWords.isPunctuationSuggestions() || isEmptyApplicationSpecifiedCompletions;
final boolean isBeginningOfSentencePrediction = (suggestedWords.mInputStyle == SuggestedWords.INPUT_STYLE_BEGINNING_OF_SENTENCE_PREDICTION);
final boolean noSuggestionsToOverrideImportantNotice = noSuggestionsFromDictionaries || isBeginningOfSentencePrediction;
if (shouldShowImportantNotice && noSuggestionsToOverrideImportantNotice) {
if (mSuggestionStripView.maybeShowImportantNoticeTitle()) {
return;
}
}
if (currentSettingsValues.isSuggestionsEnabledPerUserSettings() || currentSettingsValues.isApplicationSpecifiedCompletionsOn() || // We should clear the contextual strip if there is no suggestion from dictionaries.
noSuggestionsFromDictionaries) {
mSuggestionStripView.setSuggestions(suggestedWords, mRichImm.getCurrentSubtype().isRtlSubtype());
}
}
use of com.android.inputmethod.latin.settings.SettingsValues in project android_packages_inputmethods_LatinIME by CyanogenMod.
the class SuggestionStripLayoutHelper method getPositionInSuggestionStrip.
/**
* Convert an index of {@link SuggestedWords} to position in the suggestion strip.
* @param indexInSuggestedWords the index of {@link SuggestedWords}.
* @param suggestedWords the suggested words list
* @return Non-negative integer of the position in the suggestion strip.
* Negative integer if the word of the index shouldn't be shown on the suggestion strip.
*/
private int getPositionInSuggestionStrip(final int indexInSuggestedWords, final SuggestedWords suggestedWords) {
final SettingsValues settingsValues = Settings.getInstance().getCurrent();
final boolean shouldOmitTypedWord = shouldOmitTypedWord(suggestedWords.mInputStyle, settingsValues.mGestureFloatingPreviewTextEnabled, settingsValues.mShouldShowLxxSuggestionUi);
return getPositionInSuggestionStrip(indexInSuggestedWords, suggestedWords.mWillAutoCorrect, settingsValues.mShouldShowLxxSuggestionUi && shouldOmitTypedWord, mCenterPositionInStrip, mTypedWordPositionWhenAutocorrect);
}
use of com.android.inputmethod.latin.settings.SettingsValues in project android_packages_inputmethods_LatinIME by CyanogenMod.
the class SuggestionStripView method updateVisibility.
public void updateVisibility(final boolean shouldBeVisible, final boolean isFullscreenMode) {
final int visibility = shouldBeVisible ? VISIBLE : (isFullscreenMode ? GONE : INVISIBLE);
setVisibility(visibility);
final SettingsValues currentSettingsValues = Settings.getInstance().getCurrent();
mVoiceKey.setVisibility(currentSettingsValues.mShowsVoiceInputKey ? VISIBLE : INVISIBLE);
}
use of com.android.inputmethod.latin.settings.SettingsValues in project android_packages_inputmethods_LatinIME by CyanogenMod.
the class SuggestionStripView method maybeShowImportantNoticeTitle.
// This method checks if we should show the important notice (checks on permanent storage if
// it has been shown once already or not, and if in the setup wizard). If applicable, it shows
// the notice. In all cases, it returns true if it was shown, false otherwise.
public boolean maybeShowImportantNoticeTitle() {
final SettingsValues currentSettingsValues = Settings.getInstance().getCurrent();
if (!ImportantNoticeUtils.shouldShowImportantNotice(getContext(), currentSettingsValues)) {
return false;
}
if (getWidth() <= 0) {
return false;
}
final String importantNoticeTitle = ImportantNoticeUtils.getSuggestContactsNoticeTitle(getContext());
if (TextUtils.isEmpty(importantNoticeTitle)) {
return false;
}
if (isShowingMoreSuggestionPanel()) {
dismissMoreSuggestionsPanel();
}
mLayoutHelper.layoutImportantNotice(mImportantNoticeStrip, importantNoticeTitle);
mStripVisibilityGroup.showImportantNoticeStrip();
mImportantNoticeStrip.setOnClickListener(this);
return true;
}
Aggregations