Skip to content

Commit 212c42e

Browse files
stelianzawadz88
authored andcommitted
Use callback to handle complete events
1 parent b7a4b9a commit 212c42e

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

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

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -145,13 +145,8 @@ public class OnCompleteClickedCallback extends AbstractOnButtonClickedCallback {
145145

146146
@UiThread
147147
public void complete() {
148-
final int totalStepCount = mStepAdapter.getCount();
149-
150-
if (mCurrentStepPosition < totalStepCount - 1) {
151-
return;
152-
}
153-
154-
onComplete();
148+
invalidateCurrentPosition();
149+
mListener.onCompleted(mCompleteNavigationButton);
155150
}
156151

157152
}
@@ -421,6 +416,7 @@ public void setShowErrorStateOnBack(boolean showErrorStateOnBack) {
421416
public void setShowErrorStateOnBackEnabled(boolean showErrorStateOnBackEnabled) {
422417
this.mShowErrorStateOnBackEnabled = showErrorStateOnBackEnabled;
423418
}
419+
424420
/**
425421
* Set whether the errors should be displayed when they occur or not. Default is <code>false</code>.
426422
*
@@ -746,8 +742,13 @@ private void onComplete() {
746742
invalidateCurrentPosition();
747743
return;
748744
}
749-
invalidateCurrentPosition();
750-
mListener.onCompleted(mCompleteNavigationButton);
745+
746+
OnCompleteClickedCallback onCompleteClickedCallback = new OnCompleteClickedCallback();
747+
if (step instanceof BlockingStep) {
748+
((BlockingStep) step).onCompleteClicked(onCompleteClickedCallback);
749+
} else {
750+
onCompleteClickedCallback.complete();
751+
}
751752
}
752753

753754
private void onUpdate(int newStepPosition, boolean userTriggeredChange) {

0 commit comments

Comments
 (0)