Skip to content

Commit b7a4b9a

Browse files
stelianzawadz88
authored andcommitted
Add method in BlockingStep to handle blocking onComplete() calls
1 parent a8e98c8 commit b7a4b9a

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

material-stepper/src/main/java/com/stepstone/stepper/BlockingStep.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,17 @@ public interface BlockingStep extends Step {
3838
@UiThread
3939
void onNextClicked(StepperLayout.OnNextClickedCallback callback);
4040

41+
/**
42+
* Notifies this step that the complete button/tab was clicked, the step was verified
43+
* and the user can complete the flow. This is so that the current step might perform
44+
* some last minute operations e.g. a network call before completing the flow.
45+
* {@link StepperLayout.OnCompleteClickedCallback#complete()} must be called once these operations finish.
46+
*
47+
* @param callback callback to call once the user wishes to complete the flow
48+
*/
49+
@UiThread
50+
void onCompleteClicked(StepperLayout.OnCompleteClickedCallback callback);
51+
4152
/**
4253
* Notifies this step that the previous button/tab was clicked. This is so that the current step might perform
4354
* some last minute operations e.g. a network call before switching to previous step.

sample/src/main/java/com/stepstone/stepper/sample/step/fragment/DelayedTransitionStepFragmentSample.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,19 @@ public void run() {
8787
}, 2000L);
8888
}
8989

90+
/**
91+
* Notifies this step that the complete button/tab was clicked, the step was verified
92+
* and the user can complete the flow. This is so that the current step might perform
93+
* some last minute operations e.g. a network call before completing the flow.
94+
* {@link StepperLayout.OnCompleteClickedCallback} must be called once these operations finish.
95+
*
96+
* @param callback callback to call once the user wishes to complete the flow
97+
*/
98+
@Override
99+
public void onCompleteClicked(StepperLayout.OnCompleteClickedCallback callback) {
100+
// not needed here
101+
}
102+
90103
private boolean shouldOperationSucceed() {
91104
return operationSwitch.isChecked();
92105
}

0 commit comments

Comments
 (0)