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

clipboard images #722

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

clipboard images #722

wants to merge 7 commits into from

Conversation

codokie
Copy link
Contributor

@codokie codokie commented Apr 19, 2024

This PR adds support for pasting URIs (images, videos, and other media types) copied to the primary clipboard, provided that the current input field editor supports the MIME type of the URI (currently, due to the lack of notification permission, there would be no indication if the URI could not be pasted).

Many instant messengers and some rich text editors (such as Samsung Notes/Google Keep) nowadays can paste images from the clipboard.

If clipboard history is enabled in settings, copied images will be stored in the app internal storage.
They will be available in the clipboard history view, and you will be able to paste them from there:
1000139817

Unpinned images will be deleted from the storage when the clipboard history first initializes, at retention time, and when pressing "Clear history" toolbar key.
Individual images manually removed from the history view by swiping will also be removed from the storage.

To paste a URI copied to the primary clipboard even if it is not an image, you can short press the clipboard key if history is disabled, otherwise you will need to pin the clipboard key and long press it.
When my other PR #647 will be finally merged, it should also be possible to show a suggestion of a clipboard image (only if the current editor supports that) which would make it even easier to paste clipboard images.

No database is used, may lead to performance issues if there are many clipboard images in the history. If someone could add one that would be really great (sadly I don't know yet how to create one myself).
I am also not sure if the current implementation of file operations is bound to concurrency issuess, please let me know if it does and what can be done to mitigate them.

I've tested the feature in multiple apps in Android 14, if others could test it too, preferably in older versions, that could really help make this feature a release candidate. If you tried it out and could not paste an image in some app, please check if a different keyboard that does support clipboard images like GBoard/Florisboard is able paste the copied content.

Thanks for reading!

P.S. GIFs are not animated in the history view currently as that would likely require adding a new dependency

@codokie codokie mentioned this pull request Apr 24, 2024
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.

1 participant