diff options
Diffstat (limited to 'templates/other/Service')
-rw-r--r-- | templates/other/Service/globals.xml.ftl | 4 | ||||
-rw-r--r-- | templates/other/Service/recipe.xml.ftl | 7 | ||||
-rw-r--r-- | templates/other/Service/root/AndroidManifest.xml.ftl | 10 | ||||
-rw-r--r-- | templates/other/Service/root/src/app_package/Service.java.ftl | 16 | ||||
-rw-r--r-- | templates/other/Service/template.xml | 32 |
5 files changed, 69 insertions, 0 deletions
diff --git a/templates/other/Service/globals.xml.ftl b/templates/other/Service/globals.xml.ftl new file mode 100644 index 0000000..bfc27eb --- /dev/null +++ b/templates/other/Service/globals.xml.ftl @@ -0,0 +1,4 @@ +<?xml version="1.0"?> +<globals> + <global id="srcOut" value="src/${slashedPackageName(packageName)}" /> +</globals> diff --git a/templates/other/Service/recipe.xml.ftl b/templates/other/Service/recipe.xml.ftl new file mode 100644 index 0000000..6e4bd57 --- /dev/null +++ b/templates/other/Service/recipe.xml.ftl @@ -0,0 +1,7 @@ +<?xml version="1.0"?> +<recipe> + <merge from="AndroidManifest.xml.ftl" /> + <instantiate from="src/app_package/Service.java.ftl" + to="${srcOut}/${className}.java" /> + <open file="${srcOut}/${className}.java" /> +</recipe> diff --git a/templates/other/Service/root/AndroidManifest.xml.ftl b/templates/other/Service/root/AndroidManifest.xml.ftl new file mode 100644 index 0000000..14b0bce --- /dev/null +++ b/templates/other/Service/root/AndroidManifest.xml.ftl @@ -0,0 +1,10 @@ +<manifest xmlns:android="http://schemas.android.com/apk/res/android" > + + <application> + <service android:name=".${className}" + android:exported="${isExported?string}" + android:enabled="${isEnabled?string}" > + </service> + </application> + +</manifest> diff --git a/templates/other/Service/root/src/app_package/Service.java.ftl b/templates/other/Service/root/src/app_package/Service.java.ftl new file mode 100644 index 0000000..571d2b8 --- /dev/null +++ b/templates/other/Service/root/src/app_package/Service.java.ftl @@ -0,0 +1,16 @@ +package ${packageName}; + +import android.app.Service; +import android.content.Intent; +import android.os.IBinder; + +public class ${className} extends Service { + public ${className}() { + } + + @Override + public IBinder onBind(Intent intent) { + // TODO: Return the communication channel to the service. + throw new UnsupportedOperationException("Not yet implemented"); + } +} diff --git a/templates/other/Service/template.xml b/templates/other/Service/template.xml new file mode 100644 index 0000000..3ce6e6a --- /dev/null +++ b/templates/other/Service/template.xml @@ -0,0 +1,32 @@ +<?xml version="1.0"?> +<template + format="1" + revision="1" + name="New Service" + description="Creates a new service class"> + + <parameter + id="className" + name="Class Name" + type="string" + constraints="class|unique" + default="MyService" /> + + <parameter + id="isExported" + name="Exported" + type="boolean" + default="true" + help="Whether or not components of other applications can invoke the service or interact with it" /> + + <parameter + id="isEnabled" + name="Enabled" + type="boolean" + default="true" + help="Whether or not the service can be instantiated by the system" /> + + <globals file="globals.xml.ftl" /> + <execute file="recipe.xml.ftl" /> + +</template> |