This repository contains templates to generate boilerplate code for an Android application.
Creates a new screen: Fragment, ViewModel, View state, and Presenter.
Clone the repository into your <user>/.android/templates/other
directory, like such (mind the .
after the second command):
cd ~/.android/templates/other
git clone [template repository path].git .
The cd
command on Windows might look like this instead, on a classic command prompt:
cd %HOMEPATH%/.android/templates/other
Whenever there's an update, you can then simply pull the templates via git:
git pull
Download the contents of this repository, and copy the RainbowCakeScreenTemplate
and RainbowCakeListAdapterTemplate
folders to the following path:
<YOUR_INSTALL_PATH>\Android Studio\plugins\android\lib\templates\other
For example, on Windows, this might be here by default:
C:\Program Files\Android\Android Studio\plugins\android\lib\templates\other
This does have the issue of having to be removed during Android Studio updates, which can be solved by the other installation mode mentioned above.
Right click either on the ui
package or any nested package inside the ui
package. Choose New -> Other -> RainbowCake screen
.
In the wizard that appears, enter:
- the name of the screen you wish to create in UpperCamelCase (but without any suffixes, no "
Fragment
", etc.) - the desired ViewState type for this screen (more info here)
- whether you'll want to pass arguments to the screen (a
Long
ID argument will be generated by default, as well as supporting code, such as anewInstance
method)
Click Finish
to create the screen, and add the created files to Git:
Generates a ListAdapter implementation plus a DiffUtil.Callback
stub. Installation and usage same as above, found in the RainbowCakeListAdapterTemplate
folder of this repository.