-
-
Notifications
You must be signed in to change notification settings - Fork 117
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
auto toggle toolbar when suggestions are available #674
Conversation
I was about to open a feature request for exactly that! Thanks for the PR, I will look through it/test it and give feedback in the next days! 👍🏻 |
Could you also add a separate settings for just auto-hiding the toolbar when suggestions are available? When you have pinned keys, they will flash when you type e.g. |
When there are default suggestions on opening an input field (with next-word-suggestions on), the toolbar shortly shows up, and then disappears once the suggestions arrive. |
There is really no need for that, here I'm much worse...
Yes, it still happens |
It was added in e337f74. |
Flickering looks mostly good now. There are a few more cases where it happens, like when the toolbar was showing, you close the keyboard, and then tap inside some text field where toolbar should not show. But that's more obscure, and not necessary to fix. One think I noticed when re-reading: boolean suppressResume = currentSettingsValues.mAutoShowToolbar
&& mInputLogic.mConnection.getTextAfterCursor(1, 0).length() == 0
&& mInputLogic.mConnection.getCodePointBeforeCursor() == Constants.NOT_A_CODE;
if (!suppressResume)
mHandler.postResumeSuggestions(true /* shouldDelay */); right above the first |
I think it makes sense to also show it in this case, because (at least for me) those initial suggestions are rarely something I actually want to type.
The code above essentially checks whether the text field is empty, which does not depend on the cursor position. (maybe that could be checked more efficiently) |
A summary when the toolbar shows automatically, depending on other settings (auto-show and auto-hide enabled)
|
I wasn't sure whether everything was working as you intended, that's why I wrote the summary.
👍
Not sure about the "even if the input field is not empty" part, but at least some uses will want this.
This seems to be a very specific and rare situation. It should only be considered if it doesn't introduce much complexity.
👍
I think hiding words properly already, didn't test inline suggestions though.
Possible yes, but it might not be particularly useful (and then the app is showing next-word suggestions despite the setting being disabled). |
@@ -1144,7 +1154,7 @@ public void onExtractedCursorMovement(final int dx, final int dy) { | |||
|
|||
@Override | |||
public void hideWindow() { | |||
if (mSuggestionStripView != null) | |||
if (mSuggestionStripView != null && !mSettings.getCurrent().mAutoShowToolbar) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add some comment to the code on why hiding the toolbar depends on the auto-show setting? When reading just the code here, and not the entire PR one could easily assume it's a mistake.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you remove it? I just would have liked a comment in the code to avoid confusion, but now I am confused with this change...
// Auto hide the toolbar if dictionary suggestions are available | ||
if (currentSettingsValues.mAutoHideToolbar | ||
&& !noSuggestionsFromDictionaries | ||
&& !suggestedWords.isPrediction()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why don't hide if it's a prediction?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just wanted to know why you added it like this, it was not a criticism or request for change.
Now you changed it to (!suggestedWords.isPrediction() || !currentSettingsValues.mAutoShowToolbar)) {
, but I'm still not sure I understand why. (and really, this is not a request to change it, just for clarification)
app/src/main/java/helium314/keyboard/latin/settings/CorrectionSettingsFragment.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Helium314 feee2f2 is 100% going to cause a flicker on input start every time..
if you really think this is needed then you might to implement this function:
@Override
public void showWindow(boolean showInput) {
if (mSuggestionStripView != null && mSettings.getCurrent().mAutoShowToolbar)
mSuggestionStripView.setToolbarVisibility(true);
super.showWindow(showInput);
}
so that the toolbar visibility will be set ASAP, likely before the someone could notice it
Wouldn't it be better to have these settings in the new "Toolbar" page? 🤔 |
Wow. Sorry @codokie, GitHub didn't show me any of your comments from the past 2 days, only the pushes. So I was really confused first and then annoyed as it looked like you just pushed changes instead of answering my questions.
The toolbar settings don't exist in https://github.com/codokie/HeliBoard/tree/autotoggle-toolbar, but the plan to move the settings should be somewhere in here. |
Under which conditions? I tried a quite a few different things, but never managed to get that flicker.. |
I added a new setting that makes the suggestions appear automatically as they become available without having to touch the expand toolbar key. If there is no character before the cursor (when starting input or after a newline), the main toolbar will be shown. This functionality is present in many other mainstream keyboards. I believe this fixes #449
Here is a short demo
toolbar.mp4