Vertical Stepper Form Library
Vertical Stepper Form Library for Android. It follows Google Material Design guidelines.
This Android library implements a vertical stepper form following Google Material Design guidelines.
There may be slight differences between the official Material Design specifications and the implementation of this library.
Demo
Examples
What's new
Version 0.9.9
- Dimensions are specified in an XML file so they can be overriden
- Subtitles can be added in each step by calling
stepsSubtitles()
in the builder - Titles and subtitles can be modified after the form has been initialized thanks to
setStepTitle()
andsetStepSubtitle()
- Official Material Design appearance can be applied to disabled/not visited steps by calling
materialDesignInDisabledSteps(true)
in the builder - The hiding of the software keyboard that is carried out by default every time a step is open can be avoided by calling
hideKeyboard(false)
in the builder - Now it is possible to force the vertical line to be displayed between collapsed steps by calling
showVerticalLineWhenStepsAreCollapsed(true)
in the builder
Version 0.9.8
- Easier to set up (Builder Pattern has been implemented)
- Navigation bar on the bottom can be hidden in order to make the form follow Material Design guidelines more precisely
- Optional error messages for each step
- Smoother transitions
- Tick icon displayed on completed steps
- Javadoc documentation of the most important methods
Installation and usage
-
To include the library in your project, first add it via Gradle:
dependencies { compile 'com.ernestoyaquello.stepperform:vertical-stepper-form:0.9.9' }
-
Now, you have to add a
VerticalStepperFormLayout
view to your activity layout, which will contain the vertical stepper form. For design purposes, it is recommended that you don't put anything else than this view in your activity layout (see the code below).
- In
onCreate()
, you will need to find the view and initialize the form:
NOTE: In this step you may need need to import ernestoyaquello.com.verticalstepperform.*
.
- Finally, edit your activity class to make it implement
VerticalStepperForm
. Then, implement the methodscreateStepContentView()
,onStepOpening()
andsendData()
.
Implementing the methods
createStepContentView()
This method will be called automatically by the system to generate the view of the content of each step. You have to implement the generation of the corresponding step view and return it:
onStepOpening()
This method will be called every time a step is open, so it can be used for checking conditions. It is noteworthy that the button "Continue" is disabled by default in every step, so it will only show up after certain user actions (for example, after the introduction of a correct name or email):
NOTE: You can also use this method to trigger some actions whenever a certain step is open.
sendData()
In this method you have to implement the sending of the data.
Screen rotation
This library handles screen rotation by saving and restoring the state of the form. Therefore, if you want to use onSaveInstanceState()
and onRestoreInstanceState()
, don't forget to call super()
at the end: