Class Builder


  • public class Builder
    extends java.lang.Object
    The builder to set up and initialize the form.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Builder allowNonLinearNavigation​(boolean allowNonLinearNavigation)
      Specifies whether or not the user will be able to jump to any step without having completed the previous ones.
      Builder allowStepOpeningOnHeaderClick​(boolean allowStepOpeningOnHeaderClick)
      Specifies whether or not the user will be able to open a step by clicking on its header.
      Builder alphaOfDisabledElements​(float alpha)
      Sets the alpha of the disabled elements.
      Builder backgroundColorOfDisabledElements​(int backgroundColorOfDisabledElements)
      Sets the background color of the disabled elements (buttons and left circles).
      Builder basicColorScheme​(int primaryColor, int primaryColorDark, int textColorOfElementsDisplayedOverThePrimaryColor)
      Sets the basic color scheme for buttons and left circles.
      Builder closeLastStepOnCompletion​(boolean closeLastStepOnCompletion)
      Specifies whether or not the last step will be closed when the form is completed.
      Builder confirmationStepSubtitle​(java.lang.String confirmationStepSubtitle)
      Sets the subtitle to be displayed on the confirmation step.
      Builder confirmationStepTitle​(java.lang.String confirmationStepTitle)
      Sets the title to be displayed on the confirmation step.
      Builder displayBottomNavigation​(boolean displayBottomNavigationBar)
      Specifies whether or not the bottom navigation bar will be displayed.
      Builder displayCancelButtonInLastStep​(boolean displayCancelButtonInLastStep)
      Specifies whether or not a cancellation button should be displayed in the last step.
      Builder displayDifferentBackgroundColorOnDisabledElements​(boolean displayDifferentBackgroundColorOnDisabledElements)
      Specifies whether or not a different background color should be displayed on disabled elements.
      Builder displayNextButtonInLastStep​(boolean displayNextButtonInLastStep)
      Specifies whether or not a confirmation button should be displayed in the last step.
      Builder displayStepButtons​(boolean displayStepButtons)
      Specifies whether or not a "Continue" button should be automatically displayed within each step.
      Builder displayStepDataInSubtitleOfClosedSteps​(boolean displayStepDataInSubtitleOfClosedSteps)
      Specifies whether or not the step's data will be displayed as a human-readable string in the step subtitle of the closed, completed steps.
      Builder errorMessageTextColor​(int errorMessageTextColor)
      Sets the color of the error message and the error icon.
      Builder includeConfirmationStep​(boolean includeConfirmationStep)
      Specifies whether or not a confirmation step should be added as an extra step at the end of the form.
      void init()
      Sets up the form and initializes it.
      Builder lastStepCancelButtonColors​(int lastStepCancelButtonBackgroundColor, int lastStepCancelButtonPressedBackgroundColor, int lastStepCancelButtonTextColor, int lastStepCancelButtonPressedTextColor)
      Sets the colors of the "Cancel" button of the last step.
      Builder lastStepCancelButtonText​(java.lang.String lastStepCancelButtonText)
      Sets the text to be displayed in the "Cancel" button of the last step.
      Builder lastStepNextButtonText​(java.lang.String lastStepNextButtonText)
      Sets the text to be displayed in the "Confirm" button of the last step.
      Builder leftCircleSizeInPx​(int leftCircleSizeInPx)
      Sets the size of the left circles in which the step numbers are displayed.
      Builder leftCircleTextSizeInPx​(int leftCircleTextSizeInPx)
      Sets the text size of the step numbers that are displayed inside the left circles.
      Builder leftVerticalLineThicknessSizeInPx​(int leftVerticalLineThicknessSizeInPx)
      Sets the width of the vertical lines that are displayed between step numbers.
      Builder marginFromStepNumbersToContentInPx​(int marginFromStepNumbersToContentInPx)
      Sets the horizontal margin between the step numbers and the step content.
      Builder nextButtonColors​(int nextButtonBackgroundColor, int nextButtonPressedBackgroundColor, int nextButtonTextColor, int nextButtonPressedTextColor)
      Sets the colors of the "Continue" buttons.
      Builder stepErrorMessageFontFamily​(android.graphics.Typeface stepErrorMessageFontFamily)
      Sets the font that will be used for the step error messages.
      Builder stepErrorMessageTextSizeInPx​(int stepErrorMessageTextSizeInPx)
      Sets the text size of the error messages.
      Builder stepNextButtonText​(java.lang.String stepNextButtonText)
      Sets the text to be displayed in the "Continue" button of all the steps but the last one.
      Builder stepNumberColors​(int stepNumberBackgroundColor, int stepNumberTextColor)
      Sets the colors of the left circles in which the step numbers are displayed.
      Builder stepNumberCompletedBackgroundColor​(int stepNumberCompletedBackgroundColor)
      Sets the color of the left circles in which the step numbers are displayed, but only for the steps that are completed.
      Builder stepNumberErrorBackgroundColor​(int stepNumberErrorBackgroundColor)
      Sets the color of the left circles in which the step numbers are displayed, but only for the steps that are in an error state.
      Builder stepNumberFontFamily​(android.graphics.Typeface stepNumberFontFamily)
      Sets the font that will be used for the step numbers.
      Builder stepSubtitleFontFamily​(android.graphics.Typeface stepSubtitleFontFamily)
      Sets the font that will be used for the step subtitles.
      Builder stepSubtitleTextColor​(int stepSubtitleTextColor)
      Sets the text color of the step subtitle.
      Builder stepSubtitleTextSizeInPx​(int stepSubtitleTextSizeInPx)
      Sets the text size of the step subtitles.
      Builder stepTitleFontFamily​(android.graphics.Typeface stepTitleFontFamily)
      Sets the font that will be used for the step titles.
      Builder stepTitleTextSizeInPx​(int stepTitleTextSizeInPx)
      Sets the text size of the step titles.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • stepNextButtonText

        public Builder stepNextButtonText​(java.lang.String stepNextButtonText)
        Sets the text to be displayed in the "Continue" button of all the steps but the last one. To set up the text of the last step's button, use lastStepNextButtonText().
        Parameters:
        stepNextButtonText - The text to display in the "Continue" button of all the steps but the last one.
        Returns:
        The builder instance.
      • lastStepNextButtonText

        public Builder lastStepNextButtonText​(java.lang.String lastStepNextButtonText)
        Sets the text to be displayed in the "Confirm" button of the last step.
        Parameters:
        lastStepNextButtonText - The text to display in the "Confirm" button of the last step.
        Returns:
        The builder instance.
      • lastStepCancelButtonText

        public Builder lastStepCancelButtonText​(java.lang.String lastStepCancelButtonText)
        Sets the text to be displayed in the "Cancel" button of the last step. To display this button in the last step, use displayCancelButtonInLastStep().
        Parameters:
        lastStepCancelButtonText - The text to display in the "Cancel" button of the last step.
        Returns:
        The builder instance.
      • confirmationStepTitle

        public Builder confirmationStepTitle​(java.lang.String confirmationStepTitle)
        Sets the title to be displayed on the confirmation step.
        Parameters:
        confirmationStepTitle - The title of the confirmation step.
        Returns:
        The builder instance.
      • confirmationStepSubtitle

        public Builder confirmationStepSubtitle​(java.lang.String confirmationStepSubtitle)
        Sets the subtitle to be displayed on the confirmation step. Set it to be null or empty to not show a subtitle in the confirmation step.
        Parameters:
        confirmationStepSubtitle - The subtitle of the confirmation step.
        Returns:
        The builder instance.
      • basicColorScheme

        public Builder basicColorScheme​(int primaryColor,
                                        int primaryColorDark,
                                        int textColorOfElementsDisplayedOverThePrimaryColor)
        Sets the basic color scheme for buttons and left circles. For further customization, use stepNumberColors() and nextButtonColors().
        Parameters:
        primaryColor - Background color of the "Continue" buttons and background color of the left circles in which the step numbers are displayed.
        primaryColorDark - Background color of the "Continue" buttons when pressed.
        textColorOfElementsDisplayedOverThePrimaryColor - Text color of the text views displayed on top of the primary color.
        Returns:
        The builder instance.
      • stepNumberColors

        public Builder stepNumberColors​(int stepNumberBackgroundColor,
                                        int stepNumberTextColor)
        Sets the colors of the left circles in which the step numbers are displayed.
        Parameters:
        stepNumberBackgroundColor - Background color of the left circles.
        stepNumberTextColor - Text color for the step numbers displayed in the left circles.
        Returns:
        The builder instance.
      • stepNumberCompletedBackgroundColor

        public Builder stepNumberCompletedBackgroundColor​(int stepNumberCompletedBackgroundColor)
        Sets the color of the left circles in which the step numbers are displayed, but only for the steps that are completed.
        Parameters:
        stepNumberCompletedBackgroundColor - Background color of the left circles in completed steps.
        Returns:
        The builder instance.
      • stepNumberErrorBackgroundColor

        public Builder stepNumberErrorBackgroundColor​(int stepNumberErrorBackgroundColor)
        Sets the color of the left circles in which the step numbers are displayed, but only for the steps that are in an error state.
        Parameters:
        stepNumberErrorBackgroundColor - Background color of the left circles in steps that are in an error state.
        Returns:
        The builder instance.
      • nextButtonColors

        public Builder nextButtonColors​(int nextButtonBackgroundColor,
                                        int nextButtonPressedBackgroundColor,
                                        int nextButtonTextColor,
                                        int nextButtonPressedTextColor)
        Sets the colors of the "Continue" buttons.
        Parameters:
        nextButtonBackgroundColor - Background color of the "Continue" buttons.
        nextButtonPressedBackgroundColor - Background color of the "Continue" buttons when pressed.
        nextButtonTextColor - Text color of the "Continue" buttons.
        nextButtonPressedTextColor - Text color of the "Continue" buttons when pressed.
        Returns:
        The builder instance.
      • lastStepCancelButtonColors

        public Builder lastStepCancelButtonColors​(int lastStepCancelButtonBackgroundColor,
                                                  int lastStepCancelButtonPressedBackgroundColor,
                                                  int lastStepCancelButtonTextColor,
                                                  int lastStepCancelButtonPressedTextColor)
        Sets the colors of the "Cancel" button of the last step. To display the cancel button in the last step, use displayCancelButtonInLastStep().
        Parameters:
        lastStepCancelButtonBackgroundColor - Background color of the "Cancel" button.
        lastStepCancelButtonPressedBackgroundColor - Background color of the "Cancel" button when pressed.
        lastStepCancelButtonTextColor - Text color of the "Cancel" button.
        lastStepCancelButtonPressedTextColor - Text color of the "Cancel" button when pressed.
        Returns:
        The builder instance.
      • stepSubtitleTextColor

        public Builder stepSubtitleTextColor​(int stepSubtitleTextColor)
        Sets the text color of the step subtitle.
        Parameters:
        stepSubtitleTextColor - The color of the step subtitle.
        Returns:
        This builder instance.
      • errorMessageTextColor

        public Builder errorMessageTextColor​(int errorMessageTextColor)
        Sets the color of the error message and the error icon.
        Parameters:
        errorMessageTextColor - The color of both the error message and the error icon.
        Returns:
        The builder instance.
      • leftCircleSizeInPx

        public Builder leftCircleSizeInPx​(int leftCircleSizeInPx)
        Sets the size of the left circles in which the step numbers are displayed.
        Parameters:
        leftCircleSizeInPx - The size of the left circles in which the step numbers are displayed.
        Returns:
        The builder instance.
      • leftCircleTextSizeInPx

        public Builder leftCircleTextSizeInPx​(int leftCircleTextSizeInPx)
        Sets the text size of the step numbers that are displayed inside the left circles.
        Parameters:
        leftCircleTextSizeInPx - The text size of the step numbers that are displayed inside the left circles.
        Returns:
        The builder instance.
      • stepTitleTextSizeInPx

        public Builder stepTitleTextSizeInPx​(int stepTitleTextSizeInPx)
        Sets the text size of the step titles.
        Parameters:
        stepTitleTextSizeInPx - The text size of the step titles.
        Returns:
        The builder instance.
      • stepSubtitleTextSizeInPx

        public Builder stepSubtitleTextSizeInPx​(int stepSubtitleTextSizeInPx)
        Sets the text size of the step subtitles.
        Parameters:
        stepSubtitleTextSizeInPx - The text size of the step subtitles.
        Returns:
        The builder instance.
      • stepErrorMessageTextSizeInPx

        public Builder stepErrorMessageTextSizeInPx​(int stepErrorMessageTextSizeInPx)
        Sets the text size of the error messages.
        Parameters:
        stepErrorMessageTextSizeInPx - The text size of the error messages.
        Returns:
        The builder instance.
      • leftVerticalLineThicknessSizeInPx

        public Builder leftVerticalLineThicknessSizeInPx​(int leftVerticalLineThicknessSizeInPx)
        Sets the width of the vertical lines that are displayed between step numbers.
        Parameters:
        leftVerticalLineThicknessSizeInPx - The width of the vertical lines that are displayed between step numbers.
        Returns:
        The builder instance.
      • marginFromStepNumbersToContentInPx

        public Builder marginFromStepNumbersToContentInPx​(int marginFromStepNumbersToContentInPx)
        Sets the horizontal margin between the step numbers and the step content.
        Parameters:
        marginFromStepNumbersToContentInPx - The horizontal margin between the step numbers and the step content.
        Returns:
        The builder instance.
      • displayBottomNavigation

        public Builder displayBottomNavigation​(boolean displayBottomNavigationBar)
        Specifies whether or not the bottom navigation bar will be displayed.
        Parameters:
        displayBottomNavigationBar - True to display it; false otherwise.
        Returns:
        The builder instance.
      • alphaOfDisabledElements

        public Builder alphaOfDisabledElements​(float alpha)
        Sets the alpha of the disabled elements.
        Parameters:
        alpha - Alpha level of disabled elements.
        Returns:
        The builder instance.
      • stepNumberFontFamily

        public Builder stepNumberFontFamily​(android.graphics.Typeface stepNumberFontFamily)
        Sets the font that will be used for the step numbers.
        Parameters:
        stepNumberFontFamily - The font for the step numbers.
        Returns:
        The builder instance.
      • stepTitleFontFamily

        public Builder stepTitleFontFamily​(android.graphics.Typeface stepTitleFontFamily)
        Sets the font that will be used for the step titles.
        Parameters:
        stepTitleFontFamily - The font for the step titles.
        Returns:
        The builder instance.
      • stepSubtitleFontFamily

        public Builder stepSubtitleFontFamily​(android.graphics.Typeface stepSubtitleFontFamily)
        Sets the font that will be used for the step subtitles.
        Parameters:
        stepSubtitleFontFamily - The font for the step subtitles.
        Returns:
        The builder instance.
      • stepErrorMessageFontFamily

        public Builder stepErrorMessageFontFamily​(android.graphics.Typeface stepErrorMessageFontFamily)
        Sets the font that will be used for the step error messages.
        Parameters:
        stepErrorMessageFontFamily - The font for the step error messages.
        Returns:
        The builder instance.
      • backgroundColorOfDisabledElements

        public Builder backgroundColorOfDisabledElements​(int backgroundColorOfDisabledElements)
        Sets the background color of the disabled elements (buttons and left circles). It will only work if used along with displayDifferentBackgroundColorOnDisabledElements().
        Parameters:
        backgroundColorOfDisabledElements - The background color of the disabled elements.
        Returns:
        The builder instance.
      • displayDifferentBackgroundColorOnDisabledElements

        public Builder displayDifferentBackgroundColorOnDisabledElements​(boolean displayDifferentBackgroundColorOnDisabledElements)
        Specifies whether or not a different background color should be displayed on disabled elements. Use backgroundColorOfDisabledElements() to specify what background color should be used.
        Parameters:
        displayDifferentBackgroundColorOnDisabledElements - True to show a different background color on disabled elements.
        Returns:
        The builder instance.
      • displayStepButtons

        public Builder displayStepButtons​(boolean displayStepButtons)
        Specifies whether or not a "Continue" button should be automatically displayed within each step. If set to false, these "Continue" buttons will be missing and manual calls to goToStep(stepPosition + 1, true) will be required in order to move to the next step.
        Parameters:
        displayStepButtons - True to display a button on each step; false to not.
        Returns:
        The builder instance.
      • displayCancelButtonInLastStep

        public Builder displayCancelButtonInLastStep​(boolean displayCancelButtonInLastStep)
        Specifies whether or not a cancellation button should be displayed in the last step. If displayed, this button will invoke the callback onCancelledForm() when clicked.
        Parameters:
        displayCancelButtonInLastStep - True to display a cancellation button in the last step; false to not.
        Returns:
        The builder instance.
      • displayNextButtonInLastStep

        public Builder displayNextButtonInLastStep​(boolean displayNextButtonInLastStep)
        Specifies whether or not a confirmation button should be displayed in the last step. If displayed, this button will invoke the callback onCompletedForm() when clicked.
        Parameters:
        displayNextButtonInLastStep - True to display a confirmation button in the last step; false to not.
        Returns:
        The builder instance.
      • includeConfirmationStep

        public Builder includeConfirmationStep​(boolean includeConfirmationStep)
        Specifies whether or not a confirmation step should be added as an extra step at the end of the form.
        Parameters:
        includeConfirmationStep - True to add a confirmation step as the final step of the form; false to not.
        Returns:
        The builder instance.
      • displayStepDataInSubtitleOfClosedSteps

        public Builder displayStepDataInSubtitleOfClosedSteps​(boolean displayStepDataInSubtitleOfClosedSteps)
        Specifies whether or not the step's data will be displayed as a human-readable string in the step subtitle of the closed, completed steps.
        Parameters:
        displayStepDataInSubtitleOfClosedSteps - True to show the step's data as a string in the subtitle view of closed, completed steps; false to not.
        Returns:
        The builder instance.
      • allowNonLinearNavigation

        public Builder allowNonLinearNavigation​(boolean allowNonLinearNavigation)
        Specifies whether or not the user will be able to jump to any step without having completed the previous ones.
        Parameters:
        allowNonLinearNavigation - True to allow non-linear navigation between steps; false to not.
        Returns:
        The builder instance.
      • allowStepOpeningOnHeaderClick

        public Builder allowStepOpeningOnHeaderClick​(boolean allowStepOpeningOnHeaderClick)
        Specifies whether or not the user will be able to open a step by clicking on its header.
        Parameters:
        allowStepOpeningOnHeaderClick - True to allow opening steps by clicking on their header; false to not.
        Returns:
        The builder instance.
      • closeLastStepOnCompletion

        public Builder closeLastStepOnCompletion​(boolean closeLastStepOnCompletion)
        Specifies whether or not the last step will be closed when the form is completed.
        Parameters:
        closeLastStepOnCompletion - True to make the last step close automatically on completion; false to not.
        Returns:
        The builder instance.
      • init

        public void init()
        Sets up the form and initializes it.