haxenme/NME — pull request #16 by mikestead (2012-08-31 06:38:05+00:00)
Title: Android Extensions - Support for Merging AndroidManifest.xml and Copying Resources

### Overview

In order to build any type of fully fledged Android extension you need the ability to add custom activities to the manifest and declare custom layouts/animations/styles/localised files etc as resources.

This change adds support for Android extensions to declare their own manifest file and for these custom declaration to be merged into the templated `AndroidManifest.xml`.

It also allows an Android extension to declare an android resource directory, the contents of which will be copied over to the `res` directory in the generated Android project.

To achieve this I've added optional `manifest` and `resources` properties to the java nmml node. e.g.

I added these to the existing java node as these are Android specific and didn't want to introduce yet more node types. Happy to change this if the latter is preferred.

### Limitations

One limitation with this code is that I do a simple copy of the resources directory into `res`. If multiple extensions have resources we'd want to merge common ones. Specifically files like strings.xml. I figured this was a good enough first drop and further merging complexity could be added later.

When merging the manifest files into the master I add everything verbatim except the sdk min/max version element. This I simply replace the values with the highest found of each. Again more complex merging could be added later to avoid duplicates in the manifest, specifically around configuration settings.

### Example

To give an example of the above changes I've updated **[Sample 21](https://github.com/mikestead/NME/tree/master/samples/21-Extension)** to use a custom activity to open a browser, together with simple view transition and progress bar. I removed some of the code I believed wasn't really used. Happy to add anything back in that you feel should be in there.

I also fixed up the JNI classpaths to use '/' instead of '.' as that was causing runtime errors. See:
- http://www.haxenme.org/community/forums/general-discussion/extensions2
- http://code.google.com/p/nekonme/issues/detail?id=257

One other little thing. I noticed that some files use linux line endings and some windows. I've tried to keep these consistent so the diffs are viewable. May make sense to set a standard line ending for the project that people must use?