-
-
Notifications
You must be signed in to change notification settings - Fork 97
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.
In 7ce9d9f I made the following changes:
Thanks for the feedback, and let me know what you think |
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 can easily set it to a constant time but personally feel that even 120 seconds is too short. If I copied something and something has caught my attention for 2 minutes (may happen frequently), I still want to be suggested the copied content afterwards. If retention is set to "No limit", then the content will be suggested until the user has picked the suggestion or deleted it (by long pressing and pressing the bin button, very easy). It is possible to add a slider for setting the time but I haven't seen a keyboard who actually has such a setting. Glad you liked the other additions :) |
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. |
Is the time limit specified somewhere? I'm not 100% sure but In Gboard at least the suggestion doesn't seem to disappear after 120 seconds |
on my phone's Gboard the clipboard suggestion disappears after about 120 seconds. Is this more than 120 seconds on your phone? |
@RHJihan If you have the time, could you please review the code or test this PR? Also, I've noticed that in many cases when there are no (clipboard) suggestions and we are not in the middle of composing text, the suggestions are empty. So in ba3f49b I've added that functionality, but if that's problematic it can be moved to a separate PR (will cause a merge conflict though). |
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. |
If others won't claim that 2 min is too short then I'll leave it at that.
I have added a setting called "Clear primary clipboard" in #611 (still open) to clear the primary clipboard too after history retention time.
I think it is because the variables that keep information (timestamp, etc.) about the last primary clipboard entry are destroyed when the keyboard is changed. To fix this I can move those variables to the companion object.
That's exactly what I was looking for. Thank you for the feedback! |
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. |
If you force stop the app, the companion object will be wiped. To keep track of the clipboard timestamp,
Depending on how you look on it. The X button just dismisses the suggestion but keeps it buried in history. I could adjust the bin button to just dismiss the suggestion without affecting the primary/internal clipboard, but I think the icon may convey a message that the entry should be deleted. If you don't like the suggestion you can also collapse the toolbar to get it out of view. Granted, it will reappear within 2 minutes if you restart the input By the way, I would appreciate some help in making the suggestion background distinct from the suggestion strip view background like in other apps. I tried modifying it programmatically but it seems to affect only the pressed state of the TextView. |
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. |
That's ok thanks for the genuine feedback. I'll see if I can add such button |
On a second thought, such a button would have to replace the pinned toolbar keys to ensure the suggestion strip view is not cluttered/confusing. |
Is it possible to place that button after any pinned toolbar button or on the left side right after the toolbar button? |
Since you still don't use The idea when clipboard suggestion could be shown: Is there anything fundamentally wrong with this approach? |
It sounds doable and may reduce code from SuggestionStripView, but it would litter ClipboardHistoryManager, so I don't know about that.. |
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. |
But I did not use inline suggestion view for creating the clipboard suggestion view which is a TextView mostly defined in the xml. Sorry but I don't think it's worthwhile to use the inline view for this, if it's at all possible. I understand wanting the reduce the code footprint but I think it makes sense to set the touch listener in the suggestion strip view and not in a utility file. After 40 commits it sounds very tiring to make such a change that won't affect the appearance or usability of the feature |
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). |
This PR is for adding clipboard suggestions, not abstracting the creation of views in the suggestion strip view. |
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. |
@Helium314 Thanks for finalizing this pull request. I look forward to test this feature in the upcoming beta |
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).
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:
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