##What is this? A collection of useful live templates that you can use within your AndroidStudio or IntelliJ IDEA installation.
##How do I add? Yes. Simply clone the repository and copy its contents to your AndroidStudio's config/templates folder.
JetBrains has you covered in finding the location of this folder.
Once you found it, cd
into it, run git clone https://github.com/Jogan/android-studio-live-templates .
and restart AndroidStudio.
##Currently included live templates
*the doc is generated by ./listCurrentTemplates
*
IntentView
: "Creates an Intent with ACTION_VIEW"Sfmt
: "String format"Toast
: "Create a new Toast"ViewConstructors
: "Adds generic view constructors"const
: "Define android style int constant"fbc
: "findViewById with cast"foreach
: "Create a for each loop"gone
: "Set view visibility to GONE"key
: "Key for a bundle"newInstance
: "create a new Fragment instance with arguments"noInstance
: "private empty constructor to prohibit instance creation"public class recyclerAdapter
: "Create a skeleton recycerview adapter"rgC
: "get a color from resources"rgS
: "get a String from resources"rouiT
: "runOnUIThread"sbc
: "block comment for structuring code"starter
: "Creates a static start(...) helper method to start an Activity"visible
: "Set view visibility to VISIBLE"wrapIt
: "adds a gradle wrapper task"
ccode
: "code tag for javadoc"cfalse
: "puts false in a comment section"clink
: "link from within javadoc"ctrue
: "puts true in a comment section"fixme
: "adds //FIXME"noop
: "indicate that a method does not have any operations"stopship
: "adds //STOPSHIP"todo
: "adds //TODO"
CroutonFragment
: "Creates a new Crouton for display within a fragment"CroutonShow
: "Creates a new Crouton with Crouton.showText"Crouton
: "Creates a new Crouton"bindSubMain
: "Create a Prolific Rx subscription observing on the mainThread"createObservable
: "Create RxJava Observable"onEventMainThread
: "Adds onMainThreadEvent method for eventbus"onEvent
: "Adds onEvent method for eventbus"
logd
: "Log.d(TAG, String)"loge
: "Log.e(TAG, String)"logi
: "Log.i(TAG, String)"logm
: "Log method name and its arguments"logr
: "Log result of this method"logt
: "A static logtag with your current classname"timd
: "Timber.d(String)"time
: "Timber.e(exception, String)"wtf
: "Log.wtf(TAG, String)"
ParcelBoolean
: "writes a single boolean value to a parcel"ParcelableEnumTest
: "Creates basic parcelable enum test methods"ParcelableEnum
: "Create a parcelable block for your current enum"Parcelable
: "Create a parcelable block for your current class"UnparcelBoolean
: "reads a single boolean value from a parcel"UnparcelIntArray
: "Unparcels an int array"UnparcelStringArray
: "Unparcels a String array"
appNs
: "adds application namespace"lh
: "android:layout_height="""lhm
: "android:layout_height="match_parent""lhw
: "android:layout_height="wrap_content""lw
: "android:layout_width="""lwm
: "android:layout_width="match_parent""lww
: "android:layout_width="wrap_content""toolsNs
: "adds tools namespace to Android xml file"
##Contribution Check out keyboardsurfer's repo