diff --git a/vertical-stepper-form/src/main/java/ernestoyaquello/com/verticalstepperform/Builder.java b/vertical-stepper-form/src/main/java/ernestoyaquello/com/verticalstepperform/Builder.java
index 086a871..8b63700 100644
--- a/vertical-stepper-form/src/main/java/ernestoyaquello/com/verticalstepperform/Builder.java
+++ b/vertical-stepper-form/src/main/java/ernestoyaquello/com/verticalstepperform/Builder.java
@@ -449,6 +449,20 @@ public Builder displayCancelButtonInLastStep(boolean displayCancelButtonInLastSt
return this;
}
+ /**
+ * 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.
+ *
+ * @param displayNextButtonInLastStep True to display a confirmation button in the last step;
+ * false to not.
+ * @return The builder instance.
+ */
+ public Builder displayNextButtonInLastStep(boolean displayNextButtonInLastStep) {
+ formView.style.displayNextButtonInLastStep = displayNextButtonInLastStep;
+
+ return this;
+ }
+
/**
* Specifies whether or not a confirmation step should be added as an extra step at the end of
* the form.
diff --git a/vertical-stepper-form/src/main/java/ernestoyaquello/com/verticalstepperform/StepHelper.java b/vertical-stepper-form/src/main/java/ernestoyaquello/com/verticalstepperform/StepHelper.java
index 4354106..00c7500 100644
--- a/vertical-stepper-form/src/main/java/ernestoyaquello/com/verticalstepperform/StepHelper.java
+++ b/vertical-stepper-form/src/main/java/ernestoyaquello/com/verticalstepperform/StepHelper.java
@@ -193,6 +193,10 @@ private void setupStepViews(final VerticalStepperFormView form, View stepLayout)
cancelButtonView.setVisibility(View.VISIBLE);
}
+ if (!formStyle.displayNextButtonInLastStep && isLast) {
+ nextButtonView.setVisibility(View.GONE);
+ }
+
if (!formStyle.displayStepButtons && !isConfirmationStep()) {
nextButtonView.setVisibility(View.GONE);
}
@@ -226,6 +230,15 @@ void updateStepViewsAfterPositionChange(VerticalStepperFormView form) {
cancelButtonView.setVisibility(View.GONE);
}
+ if (formStyle.displayNextButtonInLastStep && isLast) {
+ String nextButtonText = formStyle.lastStepNextButtonText == null
+ ? "" : formStyle.lastStepNextButtonText;
+ nextButtonView.setText(nextButtonText);
+ nextButtonView.setVisibility(View.VISIBLE);
+ } else {
+ nextButtonView.setVisibility(View.GONE);
+ }
+
lineView1.setVisibility(isLast ? View.GONE : View.VISIBLE);
lineView2.setVisibility(isLast ? View.GONE : View.VISIBLE);
diff --git a/vertical-stepper-form/src/main/java/ernestoyaquello/com/verticalstepperform/VerticalStepperFormView.java b/vertical-stepper-form/src/main/java/ernestoyaquello/com/verticalstepperform/VerticalStepperFormView.java
index 8fb193c..1c63864 100644
--- a/vertical-stepper-form/src/main/java/ernestoyaquello/com/verticalstepperform/VerticalStepperFormView.java
+++ b/vertical-stepper-form/src/main/java/ernestoyaquello/com/verticalstepperform/VerticalStepperFormView.java
@@ -632,6 +632,7 @@ private void onConstructed(Context context, AttributeSet attrs, int defStyleAttr
style.displayBottomNavigation = true;
style.displayStepButtons = true;
style.displayCancelButtonInLastStep = false;
+ style.displayNextButtonInLastStep = true;
style.displayStepDataInSubtitleOfClosedSteps = true;
style.displayDifferentBackgroundColorOnDisabledElements = false;
style.includeConfirmationStep = true;
@@ -754,6 +755,9 @@ private void onConstructed(Context context, AttributeSet attrs, int defStyleAttr
style.displayCancelButtonInLastStep = vars.getBoolean(
R.styleable.VerticalStepperFormView_form_display_cancel_button_in_last_step,
style.displayCancelButtonInLastStep);
+ style.displayNextButtonInLastStep = vars.getBoolean(
+ R.styleable.VerticalStepperFormView_form_display_next_button_in_last_step,
+ style.displayNextButtonInLastStep);
style.displayStepDataInSubtitleOfClosedSteps = vars.getBoolean(
R.styleable.VerticalStepperFormView_form_display_step_data_in_subtitle_of_closed_steps,
style.displayStepDataInSubtitleOfClosedSteps);
@@ -1198,6 +1202,7 @@ class FormStyle {
boolean displayBottomNavigation;
boolean displayStepButtons;
boolean displayCancelButtonInLastStep;
+ boolean displayNextButtonInLastStep;
boolean displayStepDataInSubtitleOfClosedSteps;
boolean displayDifferentBackgroundColorOnDisabledElements;
boolean includeConfirmationStep;
diff --git a/vertical-stepper-form/src/main/res/values/attrs.xml b/vertical-stepper-form/src/main/res/values/attrs.xml
index f1738e6..248420f 100644
--- a/vertical-stepper-form/src/main/res/values/attrs.xml
+++ b/vertical-stepper-form/src/main/res/values/attrs.xml
@@ -34,6 +34,7 @@
+