this presentaton about Android Studio Templates.
Example project forThe idea is to demonstrate the abilities of custom component templates in Android Studio.
In this project, there are some base classes for the presentation layer. The implementation does not really matter here, the only important thing is how the custom template for Android Studio can serve some needs of the average project where we have base classes and third-party solutions.
How to use
To make the custom template available in Android Studio you have to:
-
put template files to ANDROID_STUDIO_DIR\plugins\android\lib\templates
-
restart Android Studio
Template structure
- template.xml - metadata of the template
- recipe.xml.ftl - instructions for the FreeMarker
- globals.xml.ftl - global variables
- cool_cat.jpg - thumbnail with the cool cat to show as a preview in Android Studio
- root/res/layout/blank_fragment.xml.ftl - template for the fragment layout
- root/src/app_package/BlankFragment.kt.ftl - template for the fragment class
- root/src/app_package/BlankViewModel.kt.ftl - template for the view model class
- root/src/app_package/BlankViewModelProvider.kt.ftl - template for the view model provider class