TrixiEther / DashchanFork

Imageboards client for Android
GNU General Public License v3.0
40 stars 2 forks source link

Add ability to copy images to clipboard #105

Closed N3-M3-S1S closed 1 year ago

N3-M3-S1S commented 1 year ago

To copy an image to the clipboard, a user needs to open an image in the gallery, and when the image is downloaded to the cache, "Copy image" option will be available in the menu. After copying the image can be pasted in other applications.

I also refactored FileProvider class because there was a lot of duplicated code after i added clipboard logic. I made a separate commit for this, so you can not include it if you think it is not necessary now.

TrixiEther commented 1 year ago

@N3-M3-S1S I think that from the point of view of Dashchan design, it is also worth adding copying of the image to the context menu when the user calls it on the thumbnail in the thread, and in the gallery. In both cases, there is a sub-item with copying the link, but in order to copy the picture, you need to open it...

N3-M3-S1S commented 1 year ago

@TrixiEther To copy an image to the clipboard, the image must be downloaded to the cache first. The image may not be in the cache if it wasn't open in the gallery because only thumbnails are cached for the previews. That's why I implemented it this way.

If we want to add the "copy image" option to the posts list and the gallery, a new implementation must check if the image is already in the cache, and if not - download it to the cache before attaching. Downloading may take some time, so a notification with progress should be shown.

There's also a possible issue that the new implementation must consider. When a user clicks "copy image" and then opens the image in the gallery before first downloading is finished. It will lead to wasted storage space and network traffic because the same image will be downloaded twice.

Maybe, in the future, I will try to implement it properly, but in my opinion, the current implementation should be enough for now. I can add the "copy image" option to the cached images, but I think it will be unclear to the user why some images may be copied and some may not.

TrixiEther commented 1 year ago

@N3-M3-S1S got it. In this case, let's leave it as it is, since the implementation will turn out to be quite complicated