mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-04-28 02:29:09 +00:00
always show suggestion strip
This commit is contained in:
parent
b5d68986be
commit
c19441310d
2 changed files with 6 additions and 24 deletions
|
@ -1690,29 +1690,12 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final boolean shouldShowSuggestionCandidates =
|
|
||||||
currentSettingsValues.mInputAttributes.mShouldShowSuggestions
|
|
||||||
&& currentSettingsValues.isSuggestionsEnabledPerUserSettings();
|
|
||||||
final boolean shouldShowSuggestionsStripUnlessPassword = !currentSettingsValues.mPinnedKeys.isEmpty()
|
|
||||||
|| shouldShowSuggestionCandidates
|
|
||||||
|| currentSettingsValues.isApplicationSpecifiedCompletionsOn();
|
|
||||||
final boolean shouldShowSuggestionsStrip = shouldShowSuggestionsStripUnlessPassword
|
|
||||||
&& (!currentSettingsValues.mInputAttributes.mIsPasswordField || !currentSettingsValues.mPinnedKeys.isEmpty());
|
|
||||||
mSuggestionStripView.updateVisibility(shouldShowSuggestionsStrip, isFullscreenMode());
|
|
||||||
if (!shouldShowSuggestionsStrip) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
final boolean isEmptyApplicationSpecifiedCompletions =
|
final boolean isEmptyApplicationSpecifiedCompletions =
|
||||||
currentSettingsValues.isApplicationSpecifiedCompletionsOn()
|
currentSettingsValues.isApplicationSpecifiedCompletionsOn()
|
||||||
&& suggestedWords.isEmpty();
|
&& suggestedWords.isEmpty();
|
||||||
final boolean noSuggestionsFromDictionaries = suggestedWords.isEmpty()
|
final boolean noSuggestionsFromDictionaries = suggestedWords.isEmpty()
|
||||||
|| suggestedWords.isPunctuationSuggestions()
|
|| suggestedWords.isPunctuationSuggestions()
|
||||||
|| isEmptyApplicationSpecifiedCompletions;
|
|| isEmptyApplicationSpecifiedCompletions;
|
||||||
final boolean isBeginningOfSentencePrediction = (suggestedWords.mInputStyle
|
|
||||||
== SuggestedWords.INPUT_STYLE_BEGINNING_OF_SENTENCE_PREDICTION);
|
|
||||||
final boolean noSuggestionsToOverrideImportantNotice = noSuggestionsFromDictionaries
|
|
||||||
|| isBeginningOfSentencePrediction;
|
|
||||||
|
|
||||||
if (currentSettingsValues.isSuggestionsEnabledPerUserSettings()
|
if (currentSettingsValues.isSuggestionsEnabledPerUserSettings()
|
||||||
|| currentSettingsValues.isApplicationSpecifiedCompletionsOn()
|
|| currentSettingsValues.isApplicationSpecifiedCompletionsOn()
|
||||||
|
|
|
@ -231,9 +231,7 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick
|
||||||
mMainKeyboardView = inputView.findViewById(R.id.keyboard_view);
|
mMainKeyboardView = inputView.findViewById(R.id.keyboard_view);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateVisibility(final boolean shouldBeVisible, final boolean isFullscreenMode) {
|
private void updateKeys() {
|
||||||
final int visibility = shouldBeVisible ? VISIBLE : (isFullscreenMode ? GONE : INVISIBLE);
|
|
||||||
setVisibility(visibility);
|
|
||||||
final SettingsValues currentSettingsValues = Settings.getInstance().getCurrent();
|
final SettingsValues currentSettingsValues = Settings.getInstance().getCurrent();
|
||||||
final View toolbarVoiceKey = mToolbar.findViewWithTag(ToolbarKey.VOICE);
|
final View toolbarVoiceKey = mToolbar.findViewWithTag(ToolbarKey.VOICE);
|
||||||
if (toolbarVoiceKey != null)
|
if (toolbarVoiceKey != null)
|
||||||
|
@ -244,13 +242,13 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick
|
||||||
mToolbarExpandKey.setImageDrawable(currentSettingsValues.mIncognitoModeEnabled ? mIncognitoIcon : mToolbarArrowIcon);
|
mToolbarExpandKey.setImageDrawable(currentSettingsValues.mIncognitoModeEnabled ? mIncognitoIcon : mToolbarArrowIcon);
|
||||||
mToolbarExpandKey.setScaleX(mToolbarContainer.getVisibility() != VISIBLE ? 1f : -1f);
|
mToolbarExpandKey.setScaleX(mToolbarContainer.getVisibility() != VISIBLE ? 1f : -1f);
|
||||||
|
|
||||||
// hide toolbar and pinned keys if device is locked
|
// hide pinned keys if device is locked, and avoid expanding toolbar
|
||||||
final KeyguardManager km = (KeyguardManager) getContext().getSystemService(Context.KEYGUARD_SERVICE);
|
final KeyguardManager km = (KeyguardManager) getContext().getSystemService(Context.KEYGUARD_SERVICE);
|
||||||
final boolean hideClipboard = Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1
|
final boolean hideToolbarKeys = Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1
|
||||||
? km.isDeviceLocked()
|
? km.isDeviceLocked()
|
||||||
: km.isKeyguardLocked();
|
: km.isKeyguardLocked();
|
||||||
mToolbarExpandKey.setVisibility(hideClipboard ? GONE : VISIBLE);
|
mToolbarExpandKey.setOnClickListener(hideToolbarKeys ? null : this);
|
||||||
mPinnedKeys.setVisibility(hideClipboard ? GONE : VISIBLE);
|
mPinnedKeys.setVisibility(hideToolbarKeys ? GONE : VISIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRtl(final boolean isRtlLanguage) {
|
public void setRtl(final boolean isRtlLanguage) {
|
||||||
|
@ -260,6 +258,7 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick
|
||||||
public void setSuggestions(final SuggestedWords suggestedWords, final boolean isRtlLanguage) {
|
public void setSuggestions(final SuggestedWords suggestedWords, final boolean isRtlLanguage) {
|
||||||
clear();
|
clear();
|
||||||
setRtl(isRtlLanguage);
|
setRtl(isRtlLanguage);
|
||||||
|
updateKeys();
|
||||||
mSuggestedWords = suggestedWords;
|
mSuggestedWords = suggestedWords;
|
||||||
mStartIndexOfMoreSuggestions = mLayoutHelper.layoutAndReturnStartIndexOfMoreSuggestions(
|
mStartIndexOfMoreSuggestions = mLayoutHelper.layoutAndReturnStartIndexOfMoreSuggestions(
|
||||||
getContext(), mSuggestedWords, mSuggestionsStrip, this);
|
getContext(), mSuggestedWords, mSuggestionsStrip, this);
|
||||||
|
|
Loading…
Add table
Reference in a new issue