Skip to content

rainbowcake/rainbowcake-templates

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 

Architecture templates

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.

Screen template

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

Installation

Git cloned installation

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

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.

Usage

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 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