code-scanner icon indicating copy to clipboard operation
code-scanner copied to clipboard

[Feature]: Add share button to bottom sheet

Open czlucius opened this issue 4 years ago • 13 comments

Is your feature request related to a problem? Please describe.

Users cannot share the scanned text and have to copy and paste in their desired app

Describe the solution you'd like

Add a share chip to the action bar on the bottom sheet dialog.

Describe alternatives you've considered

Copy and paste the text scanned.

Additional context

czlucius avatar Jan 05 '22 11:01 czlucius

can we add a share button in the bottom dialog and pass the text fields to that and share them using intent.

prvn2004 avatar Oct 03 '22 11:10 prvn2004

We can add a chip to the current Actions pane. Currently, the architecture of this app is built such that the buttons shown on the bottom dialog are created for each Action supplied. An Action (https://github.com/czlucius/code-scanner/blob/main/app/src/main/java/com/czlucius/scan/objects/actions/Action.java) is supplied to a predefined Type (https://github.com/czlucius/code-scanner/blob/main/app/src/main/java/com/czlucius/scan/objects/Type.java), which will be used by the bottom dialog to show the buttons

Currently, I have a Share Action ready, but the implementation is not quite polished: https://github.com/czlucius/code-scanner/blob/c00e75a83dbfb39ba0af41f232cf6ce880e6957f/app/src/main/java/com/czlucius/scan/objects/Type.java#L64

It calls data.constructShareIntent for the data type. https://github.com/czlucius/code-scanner/blob/main/app/src/main/java/com/czlucius/scan/objects/actions/ShareAction.java#L42

So for the data types in https://github.com/czlucius/code-scanner/tree/main/app/src/main/java/com/czlucius/scan/objects/data, you have to override the constructShareIntent here (if a custom intent is needed, else it will just share text) Especially for the contact, Wi-Fi, geolocation intents, they are not just simple plain text intents

czlucius avatar Oct 03 '22 12:10 czlucius

so we have to create intents for special cases and override the custom intent.

prvn2004 avatar Oct 04 '22 05:10 prvn2004

Yes

czlucius avatar Oct 04 '22 05:10 czlucius

In here https://github.com/czlucius/code-scanner/tree/main/app/src/main/java/com/czlucius/scan/objects/data

czlucius avatar Oct 04 '22 05:10 czlucius

For contacts you have to create a VCF file and share via the content provider

czlucius avatar Oct 04 '22 05:10 czlucius

https://github.com/czlucius/code-scanner/blob/c00e75a83dbfb39ba0af41f232cf6ce880e6957f/app/src/main/java/com/czlucius/scan/objects/data/Data.java#L36-L45 An example

czlucius avatar Oct 04 '22 05:10 czlucius

Hello @czlucius can you assign this project to me so that I will try to add share button at bottom sheet.

tripathisharad avatar Oct 04 '22 07:10 tripathisharad

You can come out with the code changes first, and make a PR. Afterwards, I will assign the issue.

czlucius avatar Oct 04 '22 08:10 czlucius

barcode library from android is deprecated. and it is giving some error in my studio.

prvn2004 avatar Oct 05 '22 15:10 prvn2004

Can I have a screenshot? ML Kit is not deprecated, its still supported by Google.

czlucius avatar Oct 05 '22 15:10 czlucius

I am still figuring it out. Will contact you if doesn't find anything.

prvn2004 avatar Oct 05 '22 15:10 prvn2004

IMG_20221007_231254378 It is giving this error on Barcode. And the android studio is not recognizing this import.

prvn2004 avatar Oct 07 '22 17:10 prvn2004