diff options
Diffstat (limited to 'templates/other')
15 files changed, 251 insertions, 0 deletions
diff --git a/templates/other/BroadcastReceiver/globals.xml.ftl b/templates/other/BroadcastReceiver/globals.xml.ftl new file mode 100644 index 0000000..bfc27eb --- /dev/null +++ b/templates/other/BroadcastReceiver/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/BroadcastReceiver/recipe.xml.ftl b/templates/other/BroadcastReceiver/recipe.xml.ftl new file mode 100644 index 0000000..a9d2623 --- /dev/null +++ b/templates/other/BroadcastReceiver/recipe.xml.ftl @@ -0,0 +1,7 @@ +<?xml version="1.0"?> +<recipe> + <merge from="AndroidManifest.xml.ftl" /> + <instantiate from="src/app_package/BroadcastReceiver.java.ftl" + to="${srcOut}/${className}.java" /> + <open file="${srcOut}/${className}.java" /> +</recipe> diff --git a/templates/other/BroadcastReceiver/root/AndroidManifest.xml.ftl b/templates/other/BroadcastReceiver/root/AndroidManifest.xml.ftl new file mode 100644 index 0000000..d107f00 --- /dev/null +++ b/templates/other/BroadcastReceiver/root/AndroidManifest.xml.ftl @@ -0,0 +1,10 @@ +<manifest xmlns:android="http://schemas.android.com/apk/res/android" > + + <receiver> + <service android:name=".${className}" + android:exported="${isExported?string}" + android:enabled="${isEnabled?string}" > + </service> + </receiver> + +</manifest> diff --git a/templates/other/BroadcastReceiver/root/src/app_package/BroadcastReceiver.java.ftl b/templates/other/BroadcastReceiver/root/src/app_package/BroadcastReceiver.java.ftl new file mode 100644 index 0000000..560c132 --- /dev/null +++ b/templates/other/BroadcastReceiver/root/src/app_package/BroadcastReceiver.java.ftl @@ -0,0 +1,17 @@ +package ${packageName}; + +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; + +public class ${className} extends BroadcastReceiver { + public ${className}() { + } + + @Override + public void onReceive(Context context, Intent intent) { + // TODO: This method is called when the BroadcastReceiver is receiving + // an Intent broadcast. + throw new UnsupportedOperationException("Not yet implemented"); + } +} diff --git a/templates/other/BroadcastReceiver/template.xml b/templates/other/BroadcastReceiver/template.xml new file mode 100644 index 0000000..09869ff --- /dev/null +++ b/templates/other/BroadcastReceiver/template.xml @@ -0,0 +1,32 @@ +<?xml version="1.0"?> +<template + format="1" + revision="1" + name="New Broadcast Receiver" + description="Creates a new broadcast receiver class"> + + <parameter + id="className" + name="Class Name" + type="string" + constraints="class|unique" + default="MyReceiver" /> + + <parameter + id="isExported" + name="Exported" + type="boolean" + default="true" + help="Whether or not the broadcast receiver can receive messages from sources outside its application" /> + + <parameter + id="isEnabled" + name="Enabled" + type="boolean" + default="true" + help="Whether or not the broadcast receiver can be instantiated by the system" /> + + <globals file="globals.xml.ftl" /> + <execute file="recipe.xml.ftl" /> + +</template> diff --git a/templates/other/ContentProvider/globals.xml.ftl b/templates/other/ContentProvider/globals.xml.ftl new file mode 100644 index 0000000..bfc27eb --- /dev/null +++ b/templates/other/ContentProvider/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/ContentProvider/recipe.xml.ftl b/templates/other/ContentProvider/recipe.xml.ftl new file mode 100644 index 0000000..6cdad82 --- /dev/null +++ b/templates/other/ContentProvider/recipe.xml.ftl @@ -0,0 +1,7 @@ +<?xml version="1.0"?> +<recipe> + <merge from="AndroidManifest.xml.ftl" /> + <instantiate from="src/app_package/ContentProvider.java.ftl" + to="${srcOut}/${className}.java" /> + <open file="${srcOut}/${className}.java" /> +</recipe> diff --git a/templates/other/ContentProvider/root/AndroidManifest.xml.ftl b/templates/other/ContentProvider/root/AndroidManifest.xml.ftl new file mode 100644 index 0000000..6fa4afc --- /dev/null +++ b/templates/other/ContentProvider/root/AndroidManifest.xml.ftl @@ -0,0 +1,11 @@ +<manifest xmlns:android="http://schemas.android.com/apk/res/android" > + + <application> + <provider android:name=".${className}" + android:authorities="${authorities}" + android:exported="${isExported?string}" + android:enabled="${isEnabled?string}" > + </provider> + </application> + +</manifest> diff --git a/templates/other/ContentProvider/root/src/app_package/ContentProvider.java.ftl b/templates/other/ContentProvider/root/src/app_package/ContentProvider.java.ftl new file mode 100644 index 0000000..e5b43b5 --- /dev/null +++ b/templates/other/ContentProvider/root/src/app_package/ContentProvider.java.ftl @@ -0,0 +1,50 @@ +package ${packageName}; + +import android.content.ContentProvider; +import android.content.ContentValues; +import android.database.Cursor; +import android.net.Uri; + +public class ${className} extends ContentProvider { + public ${className}() { + } + + @Override + public int delete(Uri uri, String selection, String[] selectionArgs) { + // Implement this to handle requests to delete one or more rows. + throw new UnsupportedOperationException("Not yet implemented"); + } + + @Override + public String getType(Uri uri) { + // TODO: Implement this to handle requests for the MIME type of the data + // at the given URI. + throw new UnsupportedOperationException("Not yet implemented"); + } + + @Override + public Uri insert(Uri uri, ContentValues values) { + // TODO: Implement this to handle requests to insert a new row. + throw new UnsupportedOperationException("Not yet implemented"); + } + + @Override + public boolean onCreate() { + // TODO: Implement this to initialize your content provider on startup. + return false; + } + + @Override + public Cursor query(Uri uri, String[] projection, String selection, + String[] selectionArgs, String sortOrder) { + // TODO: Implement this to handle query requests from clients. + throw new UnsupportedOperationException("Not yet implemented"); + } + + @Override + public int update(Uri uri, ContentValues values, String selection, + String[] selectionArgs) { + // TODO: Implement this to handle requests to update one or more rows. + throw new UnsupportedOperationException("Not yet implemented"); + } +} diff --git a/templates/other/ContentProvider/template.xml b/templates/other/ContentProvider/template.xml new file mode 100644 index 0000000..c6730d8 --- /dev/null +++ b/templates/other/ContentProvider/template.xml @@ -0,0 +1,40 @@ +<?xml version="1.0"?> +<template + format="1" + revision="1" + name="New Content Provider" + description="Creates a new content provider class"> + + <parameter + id="className" + name="Class Name" + type="string" + constraints="class|unique" + default="MyContentProvider" /> + + <parameter + id="authorities" + name="URI Authorities" + type="string" + constraints="nonempty" + default="" + help="A list of one or more URI authorities that identify data under the purview of the content provider. " /> + + <parameter + id="isExported" + name="Exported" + type="boolean" + default="true" + help="Whether or not the content provider can be used by components of other applications " /> + + <parameter + id="isEnabled" + name="Enabled" + type="boolean" + default="true" + help="Whether or not the content provider can be instantiated by the system " /> + + <globals file="globals.xml.ftl" /> + <execute file="recipe.xml.ftl" /> + +</template> 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> |