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

[Feature]: Add share button to bottom sheet #22

Open
czlucius opened this issue Jan 5, 2022 · 13 comments
Open

[Feature]: Add share button to bottom sheet #22

czlucius opened this issue Jan 5, 2022 · 13 comments
Labels

Comments

@czlucius
Copy link
Owner

czlucius commented Jan 5, 2022

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 czlucius added the enhancement New feature or request label Jan 5, 2022
czlucius added a commit that referenced this issue Feb 4, 2022
Base implementation. Contact and other specific implementations yet to be added.
@prvn2004
Copy link

prvn2004 commented Oct 3, 2022

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

@czlucius
Copy link
Owner Author

czlucius commented Oct 3, 2022

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:

//actions.add(1, ShareAction.getInstance());

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

@prvn2004
Copy link

prvn2004 commented Oct 4, 2022

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

@czlucius
Copy link
Owner Author

czlucius commented Oct 4, 2022

Yes

@czlucius
Copy link
Owner Author

czlucius commented Oct 4, 2022

@czlucius
Copy link
Owner Author

czlucius commented Oct 4, 2022

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

@czlucius
Copy link
Owner Author

czlucius commented Oct 4, 2022

public Intent constructShareIntent()
{
Intent sendIntent = new Intent();
sendIntent.setAction(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_TEXT, getStringRepresentation());
sendIntent.setType("text/plain");
return sendIntent;
}

An example

@tripathisharad
Copy link

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

@czlucius
Copy link
Owner Author

czlucius commented Oct 4, 2022

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

@prvn2004
Copy link

prvn2004 commented Oct 5, 2022

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

@czlucius
Copy link
Owner Author

czlucius commented Oct 5, 2022

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

@prvn2004
Copy link

prvn2004 commented Oct 5, 2022

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

@prvn2004
Copy link

prvn2004 commented Oct 7, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants