Upgrade to Pro — share decks privately, control downloads, hide ads and more …

AndroidStudioのテンプレートを覗いてみよう

 AndroidStudioのテンプレートを覗いてみよう

Keisuke kiuchi

April 13, 2018
Tweet

More Decks by Keisuke kiuchi

Other Decks in Programming

Transcript

  1. $MFBO"SDIJUFDUVSF
 5FNQMBUFGPS,PUMJO w %BHHFS w 3Y+BWB w 3FBMN w $POTUSBJOU-BZPVU

    w 3FUSPpU w 4XBHHFS w BOESPJELUY w %BUB#JOEJOH w 7JFX.PEFM IUUQTHJUIVCDPNLJVDIJLFJTVLF"OESPJE4UVEJP$MFBO"SDIJUFDUVSFUFNQMBUF GPS,PUMJO
  2. ϑΝΠϧߏ੒ͲΜͳײ͡ʁ BaseActivity + globals.xml.ftl + recipe_fragmentxml.ftl + recipe.xml.ftl + template_basic_activity_fragment.png

    + template_basic_activity.png + template.xml + root + res | + layout | + activity_fragment_container.xml.ftl | + fragment_simple.xml.ftl + src + app_package + SimpleActivity.java.ftl + SimpleActivity.kt.ftl + SimpleActivityFragment.java.ftl + SimpleActivityFragment.kt.ftl
  3. SFDJQFYNMGUM <!- - ྫ̍ʢBaseActivityͷςϯϓϨʔτ͔Βൈਮʣ - ->
 <#if generateKotlin> <instantiate 


    from="root/src/app_package/SimpleActivity.kt.ftl" to="${escapeXmlAttribute(srcOut)}/${activityClass}.kt" 
 /> <open file="${escapeXmlAttribute(srcOut)}/${activityClass}.kt" /> <#else> <instantiate 
 from="root/src/app_package/SimpleActivity.java.ftl" to="${escapeXmlAttribute(srcOut)}/${activityClass}.java"
 /> <open file="${escapeXmlAttribute(srcOut)}/${activityClass}.java" /> </#if> 
 <!- - ྫ̎ - ->
 <mkdir at="${escapeXmlAttribute(projectOut)}/src/main/kotlin"/> 
 
 <!- - ྫ̏ - -> <merge from="root/build.gradle.ftl" to="${escapeXmlAttribute(projectOut)}/build.gradle" /> <dependency mavenUrl="com.google.dagger:dagger:2.+" />
  4. 4JNQMF"DUJWJUZLUGUM package ${escapeKotlinIdentifiers(packageName)} import android.os.Bundle <#if hasAppBar> import android.support.design.widget.Snackbar import

    android.support.v7.app.AppCompatActivity <#else> import ${superClassFqcn} </#if> import kotlinx.android.synthetic.main.${layoutName}.* class ${activityClass} : ${superClass}() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.${layoutName}) <#if hasAppBar> setSupportActionBar(toolbar) fab.setOnClickListener { view -> Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG).setAction("Action", null).show() } </#if>