Skip to content

PApplet does not extends anything now same as java mode. #187

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

Merged
merged 1 commit into from
Feb 2, 2016

Conversation

suheb
Copy link
Contributor

@suheb suheb commented Jan 29, 2016

Currently, PApplet extends Fragment in android mode while it doesn't extends anything in java mode.
This is to make sure PApplet follows the same API in both android and java mode.
Signed-off-by: Suhaib Khan [email protected]

@omerjerk
Copy link
Contributor

@codeanticode @Manindra29
I myself support this change for the following reasons.

Now Android's PApplet exposes same APIs as that of Java mode. So, theoretically there won't be anything special required in the error checker service now. ErrorCheckerService is treating Android APIs normally, but the only problem was that it wasn't loading the correct core.jar. Now, since both PApplet exposes the same APIs, there shouldn't be any issue. Although, this is not the main reason I support this change.

As discussed with Ben and Andres previously, we would want to add support for Live wallpapers, watch faces and Android TV. For that we'd have to make this change anyways. Because Fragment can't be used just like that in those scenarios. So now, there will be generic PApplet class for all the options I listed, and accordingly, changes will be made inside AndroidBuild.java to use this generic PApplet class for each type of output.

@codeanticode
Copy link
Contributor

Thanks for the PR... making this change in order to prepare the mode for other app types (watch faces, wallpapers, etc) does sound like a good approach. I will look into it in more detail very soon.

codeanticode added a commit that referenced this pull request Feb 2, 2016
PApplet does not extends anything now same as java mode.
@codeanticode codeanticode merged commit a0c805c into processing:master Feb 2, 2016
@suheb
Copy link
Contributor Author

suheb commented Feb 9, 2016

I think we could just add a method to access the activity variable in PApplet.
@codeanticode @omerjerk what do you think?

@omerjerk
Copy link
Contributor

omerjerk commented Feb 9, 2016

I agree. The processing-video-android library will also not work without that.
@codeanticode Are we still getting the getActivity() issue ? I have not been able to test Manindra's fixes yet.

@Manindra29
Copy link
Member

You guys are probably aware of this, but the PR is causing the build to fail with the following message:

    [javac] /Users/mmoharana/Workspaces/p5Workspace/processing-android/core/src/processing/core/PGraphicsAndroid2D.java:1092: error: cannot find symbol
    [javac]     ActivityManager activityManager = (ActivityManager) parent.getActivity().getSystemService(android.content.Context.ACTIVITY_SERVICE);
    [javac]                                                               ^

@suheb
Copy link
Contributor Author

suheb commented Feb 15, 2016

@Manindra29 I did not get this error, which ideally I should have. Maybe it's because ant does not compile unmodified files.
Anyway, we should just add a getActivity() method in PApplet for now.
@codeanticode Should I open another PR for that or you'll re-open this?

@Manindra29
Copy link
Member

@suheb I get the error after doing a clean build: ant clean;ant build;. It's a good idea to perform a clean build before submitting a PR.

Adding getActivity() should fix it.

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.

6 participants