Skip to content

stewe93/rainbowcake-templates

 
 

Repository files navigation

Architecture templates

This repository contains templates to generate boilerplate code for an Android application.

Screen template

Creates a new screen: Fragment, ViewModel, View state, and Presenter.

Installation

Git cloned installation

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
Old, deprecated, manual installation method

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.

Usage

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 a newInstance method)

Click Finish to create the screen, and add the created files to Git:

ListAdapter template

Generates a ListAdapter implementation plus a DiffUtil.Callback stub. Installation and usage same as above, found in the RainbowCakeListAdapterTemplate folder of this repository.

About

Android Studio templates for working with RainbowCake.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • FreeMarker 100.0%