Skip to content
This repository was archived by the owner on Apr 19, 2023. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions stepview/src/main/java/com/shuhart/stepview/StepView.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,15 @@ public interface OnStepClickListener {
void onStepClick(int step);
}

public interface OnStepChangeListener {
/**
* Index of the first step is 0.
*
* @param newStep index of the new step
*/
void onStepChangeTo(int newStep);
}

public static final int ANIMATION_LINE = 0;
public static final int ANIMATION_CIRCLE = 1;
public static final int ANIMATION_ALL = 2;
Expand All @@ -63,6 +72,7 @@ public interface OnStepClickListener {
}

private OnStepClickListener onStepClickListener;
private OnStepChangeListener onStepChangeListener;
private static final int ANIMATE_STEP_TRANSITION = 0;
private static final int IDLE = 1;

Expand Down Expand Up @@ -287,9 +297,17 @@ public void go(int step, boolean animate) {
currentStep = step;
invalidate();
}
if (onStepChangeListener != null) {
onStepChangeListener.onStepChangeTo(step);
}
}
}

public void changeText(int step, CharSequence newText) {
this.steps.set(step, newText.toString());
requestLayout();
}

public void done(boolean isDone) {
done = isDone;
invalidate();
Expand Down