Skip to content

Instantly share code, notes, and snippets.

View ckdevrel's full-sized avatar

Chandrasekar Kuppusamy ckdevrel

View GitHub Profile
<#if isFragment>
<instantiate from="src/app_package/RecyclerFragment.java.ftl"
to="${escapeXmlAttribute(srcOut)}/${className}.java" />
<instantiate from="res/layout/fragment_recycler_view.xml.ftl"
to="${escapeXmlAttribute(resOut)}/layout/${fragmentName}.xml" />
<#else>
<instantiate from="src/app_package/RecyclerActivity.java.ftl"
to="${escapeXmlAttribute(srcOut)}/${activityClass}.java" />
<parameter
id="className"
name="Fragment Class Name"
type="string"
constraints="class|unique|nonempty"
visibility="isFragment" //This view will be shown only if fragment checkbox is true
default="RecyclerViewFragment"
help="The name of the fragment class to create"/>
<parameter
id="activityClass"
name="Activity Name"
type="string" constraints="class|unique|nonempty"
visibility="!isFragment" //This view will be shown only if fragment checkbox is false
suggest="${layoutToActivity(layoutActivityName)}"
default="RecyclerViewActivity"
help="The name of the activity class to create"/>
<parameter
id=”isFragment”
name=”Need Fragment code instead of Activitiy?”
type=”boolean”
default=”false”
help=”If true, the fragment code will be created instead of Activity”/>
<parameter
id=”isFragment”
name=”Need Fragment code instead of Activitiy?”
type=”boolean”
default=”false”
help=”If true, the fragment code will be created instead of Activity”/>
<global id="srcOut" value="${srcDir}/${slashedPackageName(packageName)}" />
<global id="srcOutPackage" value="${srcDir}" />
<global id="resOut" value="${resDir}" />
<open file="${escapeXmlAttribute(srcOut)}/${activityClass}.java" />
<copy from="res/menu"
to="${escapeXmlAttribute(resOut)}/menu" />
<copy from="res/drawable"
to="${escapeXmlAttribute(resOut)}/drawable" />
<instantiate from="src/app_package/MainActivity.java.ftl"
to="${escapeXmlAttribute(srcOut)}/${activityClass}.java" />