Show suggestion strip on password input when paste enabled

This commit is contained in:
Trevor Terris 2021-11-22 06:36:16 -05:00
parent 31b4a28471
commit ff7406fb98
2 changed files with 4 additions and 2 deletions

View file

@ -1588,10 +1588,11 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
currentSettingsValues.mInputAttributes.mShouldShowSuggestions currentSettingsValues.mInputAttributes.mShouldShowSuggestions
&& currentSettingsValues.isSuggestionsEnabledPerUserSettings(); && currentSettingsValues.isSuggestionsEnabledPerUserSettings();
final boolean shouldShowSuggestionsStripUnlessPassword = currentSettingsValues.mShowsVoiceInputKey final boolean shouldShowSuggestionsStripUnlessPassword = currentSettingsValues.mShowsVoiceInputKey
|| currentSettingsValues.mShowsPasteKey
|| shouldShowSuggestionCandidates || shouldShowSuggestionCandidates
|| currentSettingsValues.isApplicationSpecifiedCompletionsOn(); || currentSettingsValues.isApplicationSpecifiedCompletionsOn();
final boolean shouldShowSuggestionsStrip = shouldShowSuggestionsStripUnlessPassword final boolean shouldShowSuggestionsStrip = shouldShowSuggestionsStripUnlessPassword
&& !currentSettingsValues.mInputAttributes.mIsPasswordField; && (!currentSettingsValues.mInputAttributes.mIsPasswordField || currentSettingsValues.mShowsPasteKey);
mSuggestionStripView.updateVisibility(shouldShowSuggestionsStrip, isFullscreenMode()); mSuggestionStripView.updateVisibility(shouldShowSuggestionsStrip, isFullscreenMode());
if (!shouldShowSuggestionsStrip) { if (!shouldShowSuggestionsStrip) {
return; return;

View file

@ -443,7 +443,8 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick
} }
if (view == mPasteKey) { if (view == mPasteKey) {
CharSequence selectionSequence = mListener.getSelection(); CharSequence selectionSequence = mListener.getSelection();
if (selectionSequence != null && selectionSequence.length() > 0) { if (selectionSequence != null && selectionSequence.length() > 0
&& !Settings.getInstance().getCurrent().mInputAttributes.mIsPasswordField) {
ClipboardManager clipboardManager = (ClipboardManager) getContext().getSystemService(Context.CLIPBOARD_SERVICE); ClipboardManager clipboardManager = (ClipboardManager) getContext().getSystemService(Context.CLIPBOARD_SERVICE);
clipboardManager.setPrimaryClip(ClipData.newPlainText(selectionSequence, selectionSequence)); clipboardManager.setPrimaryClip(ClipData.newPlainText(selectionSequence, selectionSequence));
} }