Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the inline suggestions remaning visible when switching keyboards and fix missing toolbar #386

Merged
merged 4 commits into from
Jan 7, 2024

Conversation

arcarum
Copy link
Contributor

@arcarum arcarum commented Jan 5, 2024

This PR fixes the inline suggestions remaning visible when switching to the emoji or clipboard history keyboards. It also brings back the old changes in clear() as they are required to make the toolbar and pinnedkeys visible after calling setInlineSuggestionsView() (with a minor modification to fix the flashing pinned key bug).

I accidentally closed the last PR and I am sorry for that.

@arcarum arcarum changed the title Fix the inline suggestions remaning visible Fix the inline suggestions remaning visible when switching keyboards and fix missing toolbar Jan 6, 2024
@Helium314
Copy link
Owner

I would really like to understand why the inline suggestions don't go away, but normal suggestions do....
It might be a weird behavior of the inline suggestions, but I fear it could be an issue in the suggestion strip that really should be fixed.

When (without the fix in this PR) you add at the end of LatinIME.onStartInputViewInternal

        HorizontalScrollView v = new HorizontalScrollView(mDisplayContext);
        LinearLayout l = new LinearLayout(mDisplayContext);
        TextView tv = new TextView(mDisplayContext);
        tv.setText("HorizontalScrollView v = new HorizontalScrollView(mDisplayContext);");
        tv.setBackgroundColor(Color.WHITE);
        l.addView(tv);
        TextView tv2 = new TextView(mDisplayContext);
        tv2.setText("      "); // just some space
        l.addView(tv2);
        TextView tv3 = new TextView(mDisplayContext);
        tv3.setText("v.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, 60));");
        tv3.setBackgroundColor(Color.WHITE);
        l.addView(tv3);
        v.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, getResources().getDimensionPixelSize(R.dimen.config_suggestions_strip_height)));
        v.addView(l);
        mHandler.postDelayed(() -> mSuggestionStripView.setInlineSuggestionsView(v), 200);

you will get some fake inline suggestions on every text field. Do you also have issues with those suggestions remaining visible?

When you use mSuggestionStripView = mCurrentInputView.findViewById(R.id.suggestions_strip_wrapper); (instead of suggestion_strip_view) in KeyboardSwitcher.onCreateInputView, does it change anything?

@arcarum
Copy link
Contributor Author

arcarum commented Jan 6, 2024

I do not have the same issue with the fake inline suggestions. Their visibility works as expected when changing to the emoji or clipboard history keyboards.

The issue remains if I use R.id.suggestions_strip_wrapper (with the real inline suggestions).

@Helium314
Copy link
Owner

Thanks, so at least it's clear that the issue is caused by weird behavior of inline suggestions.

I would still like to contain dealing with inline suggestions to SuggestionStripView if possible.
Does it work if you add to SuggestionStripView

    @Override
    public void onVisibilityChanged(@NonNull final View view, final int visibility) {
        super.onVisibilityChanged(view, visibility);
        if (view == this)
            mSuggestionsStrip.setVisibility(visibility);
    }

I really hope it does, as mSuggestionsStrip is R.id.suggestions_strip, i.e. what you currently change in KeyboardSwitcher

@arcarum
Copy link
Contributor Author

arcarum commented Jan 7, 2024

Does it work if you add to SuggestionStripView

Yes that works. For now I put it underneath setInlineSuggestionsView.

@Helium314
Copy link
Owner

Great, thanks for all the testing!

@Helium314 Helium314 merged commit e5af924 into Helium314:new Jan 7, 2024
@arcarum arcarum deleted the inline_autofill branch January 7, 2024 21:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants