This repository contains templates to generate boilerplate code for an Android application.
Note: these templates are unfortunately not up-to-date for Android Studio 4.0 yet.
Creates a new screen: Fragment, ViewModel, View state, and Presenter.
Note: this method is unfortunately broken as of Android Studio 4. Please use the older install method described below, in the next section.
Clone the repository into your <user>/.android/templates/other directory (might not exist by default), 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_STUDIO_INSTALL_PATH>\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
Or roughly here, if you're using JetBrains Toolbox:
C:\Users\<USER_NAME>\AppData\Local\JetBrains\Toolbox\apps\AndroidStudio\ch-<CHANNEL_NUMBER>\<VERSION>\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 (hard requirement). 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
LongID argument will be generated by default, as well as supporting code, such as anewInstancemethod)
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.