-
-
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
Clipboard suggestions #647
Conversation
…etting that collapses it
Nice work. ❤ |
As usual, the PR is already 2 days old but I didn't even have time to go through the code... I haven't tested, but "whenever neutral suggestions are to be shown" might not be quite the right thing. And maybe the icon should be the normal clipboard icon instead? I can imagine the icon looking a bit out of place depending on the theme / colors. Maybe also the input field type should be considered, because e.g. clipboard text content should not be shown for a number field. |
My opinion is up to 90 seconds right after copying any text. Samsung keyboard does this for about 120 seconds. |
setting now toggles suggestions.
I am a little bit confused. What if someone toggles off the clipboard history (the default is 10 min) or sets the retention time to a bigger one? Or set that to No limit? Is it convenient to match the history retention time or to set some specific time, i.e., 90 seconds or 120 seconds?
It's impressive. Loved it.
It's looking good. |
I will suggest seeing what other keyboards are doing in this situation, i.e., Gboard, Swiftkey, or Samsung Keyboard. I guess it will bring a better user experience. |
on my phone's Gboard the clipboard suggestion disappears after about 120 seconds. Is this more than 120 seconds on your phone? |
I am confused here, too. But I think clipboard suggestions shouldn't be very long. Anyone needing clipboard content after a specific time can always have it on the clipboard history view. I tested the PR. Here are my thoughts: If I copy text when another keyboard is active, after 120 seconds, it still shows as a clipboard suggestion on this PR. I am not sure if it is related to this PR. Maybe it's start counting the time after loading the keyboard. But it's not an important thing after all. I am not that level of coder. So, I am giving my experience and perspective as a user and/or tester.
I think it's cool. |
It is perfect now for me.
After a quick try, this still happening. Force stop the keyboard app and enable it again will suggest old clipboard content as suggestion. |
As I said earlier, I am not that level of coder. So I cannot help you with this. @Helium314 might help you.
What about both? X button to dismiss the clipboard suggestion, but it can be accessed later on the clipboard history if a user would like to retain history. And the long press bin button to delete the clipboard entry. I'm probably asking for much change. I am sorry for that. |
Is it possible to place that button after any pinned toolbar button or on the left side right after the toolbar button? |
If you think having 2 keys is redundant, I agree with that. I like your simple approach. For dismissing the clipboard suggestion, the x button is more discoverable compared to the long press dismissal from my point of view. What do you think about this? |
I am totally delighted with the way it is now, and I am waiting for this PR to be merged.
Yes, you can mention this to the Readme and Hidden features. |
I wonder, is there a way to put the clipboard suggestion like an inline suggestion view? |
Right, I hadn't noticed that the style is actually coupled to inline suggestions.
It should be easy to generalize the inline suggestion part in public View createClipView(String clipText) {
TextView view = new TextView(getContext());
view.setOnClickListener((v) -> mListener.onClipboardSuggestionPicked(clipText));
// add some styling
return view;
} and |
Since you still don't use The idea when clipboard suggestion could be shown: Is there anything fundamentally wrong with this approach? |
If you think ClipboardHistoryManager is going to grow too much, you could have the view creation happen in a utility file. The re-use of the inline suggestion view should also reduce the need for clipboard-suggestion specific code in LatinIME.
Possibly, depending on how often it's really created. If this is an issue, a prepared view can be cached, and updated before use.
Why is this? I don't have a full overview over the PR right now. |
Seriously, those parts of the contribution guidelines have been there since OpenBoard times. And they don't exist just because someone likes writing guidelines. I really would like to spend my time on code instead of discussions, but this kind of adding yet another thing for almost the same functionality is making the app harder to maintain. And I understand you might not be concerned about maintainability ("won't affect the appearance or usability of the feature"). I'm trying to improve the current situation, and I've had "Internal cleanup (a lot of over-complicated and convoluted code)" in the to do section for a while now. Currently it feels like I have to not just (slowly) work on this, but also have to do discussions over and over again that such things do not find their way into the app via PRs. I have "still it would be good if you announced that you are working on it, so we can discuss how changes are best implemented" in the contribution guidelines, and I think discussing on how to implement larger changes before most of the code is written is a good way to avoid me asking to completely change your code. I'm sorry if this comment comes across as overly criticising, so I want to explicitly mention that I definitely do value your contributions (and I'm not happy that I don't have time to keep up with your pace of PRs). |
I adjusted the PR to use the (now renamed)
Further I removed some crash sources (using methods / resources not available on devices with the current minApi). I'll have another look at it in the next few days and plan to merge it then. |
I haven't tested this merged PR yet. But I just wanted to know:
So, will the clipboard suggestion appear every time (if the clipboard has something copied already) I try to type something unless I dismiss it manually? |
It will not appear if the clip is more than 3 min old. But it will not disappear on its own if you just wait and stare at the keyboard for 3 minutes. |
I hope the implementation is ok for you. I tried to keep behavior close to your version when moving most of the stuff into that one view. |
I made the primary clipboard appear in the suggestion strip view as a suggested word whenever neutral suggestions are to be shown like in a beginning of sentence (fixes #167).
![example](https://private-user-images.githubusercontent.com/151087174/334993337-521054eb-cdc6-406d-b393-fb550b65ab53.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkxMjUwNjksIm5iZiI6MTczOTEyNDc2OSwicGF0aCI6Ii8xNTEwODcxNzQvMzM0OTkzMzM3LTUyMTA1NGViLWNkYzYtNDA2ZC1iMzkzLWZiNTUwYjY1YWI1My5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjA5JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIwOVQxODEyNDlaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1jYjJiZTQzMjk2NTgyYmZlNTg5NWRlMGQ4ZGU3MDlmOWMyZTFhZjg1Y2NkZmQ4MGFmM2RlZmRiYjMxMTRiMjk3JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.gkv8B6wUigw1uBoc7vOds9Hu4TdFfquiO_F7m0Z0_3c)
Here is an example of the feature:
In android 7.0+, the API allows detection of sensitive clipboard content, and when that happens the content is redacted like this:
![password](https://private-user-images.githubusercontent.com/151087174/320876398-cd1b3443-4cbc-4f2b-99ae-3b26d4446a5c.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkxMjUwNjksIm5iZiI6MTczOTEyNDc2OSwicGF0aCI6Ii8xNTEwODcxNzQvMzIwODc2Mzk4LWNkMWIzNDQzLTRjYmMtNGYyYi05OWFlLTNiMjZkNDQ0NmE1Yy5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjA5JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIwOVQxODEyNDlaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1lNGNkZTgyZGIyZWU5YWMxODhjM2VkMDgwYTllYTk1Nzc3YzViODQ3MzhmMzRmNjEwMzI1NmZjMmJjYmEyMGJmJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.L_DMOAOHrl9ECFAycWvMObCRC-MwqpEASCUUobm5Elo)
Suggestions will disappear if they are picked or 3 minutes have passed.
There is also new setting in Suggestions settings that allows to toggle the suggestions.
There will be a suggestion for number input fields only if the clipboard content is a number.
P.S. You can long press the clipboard suggestion and then press the X icon to dismiss it