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

Added onActivityResult to MainActivity.java and IPythonApp.java #25

Merged
merged 1 commit into from
Mar 7, 2021

Conversation

t-arn
Copy link
Contributor

@t-arn t-arn commented Dec 7, 2020

This PR adds the method onActivityResult() in MainActivity.java and IPythonApp.java
This allows us to invoke Android Intents from Python and get the result back.

This template is used by following pull-request: beeware/toga#1158

PR Checklist:

  • All new features have been tested
  • All new features have been documented
  • I have read the CONTRIBUTING.md file
  • I will abide by the code of conduct

@t-arn t-arn mentioned this pull request Dec 7, 2020
4 tasks
{
Log.d(TAG, "onActivityResult() start");
super.onActivityResult(requestCode, resultCode, data);
pythonApp.onActivityResult(requestCode, resultCode, data);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@freakboy3742 Should we do as hasattr check for pythonApp.onActivityResult here? I think it's OK to skip that check if the template can expect a version of Toga with the new onActivityResult code in beeware/toga#1158 . Wanted to double-check with you.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I get the intention, but I think this will be safe without the hasattr guard. We're only going to get an activity result if the code starts an activity... and that won't be happening until the code is merged into Toga to start activities in the first place.

@paulproteus
Copy link
Contributor

@t-arn This is really cool! I think it's great. From my perspective, it looks good to me.

I'll allow @freakboy3742 to more-officially review it.

Copy link
Member

@freakboy3742 freakboy3742 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR - apologies for the delay in reviewing/merging.

{
Log.d(TAG, "onActivityResult() start");
super.onActivityResult(requestCode, resultCode, data);
pythonApp.onActivityResult(requestCode, resultCode, data);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I get the intention, but I think this will be safe without the hasattr guard. We're only going to get an activity result if the code starts an activity... and that won't be happening until the code is merged into Toga to start activities in the first place.

@freakboy3742 freakboy3742 merged commit 9730029 into beeware:dev Mar 7, 2021
freakboy3742 added a commit that referenced this pull request Mar 7, 2021
Added onActivityResult to MainActivity.java and IPythonApp.java
@t-arn t-arn deleted the onActivityResult branch March 7, 2021 15:52
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.

3 participants