Skip to content
This repository was archived by the owner on Sep 13, 2024. It is now read-only.

Commit 87f725b

Browse files
committed
Make callbacks more exhaustive
1 parent d86b59f commit 87f725b

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

app/src/main/java/eu/acolombo/progressindicatorview/example/BaseFragment.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import android.animation.ValueAnimator
44
import android.annotation.SuppressLint
55
import android.os.Bundle
66
import android.os.Handler
7+
import android.util.Log
78
import android.view.View
89
import android.widget.SeekBar
910
import androidx.fragment.app.Fragment
@@ -21,6 +22,10 @@ abstract class BaseFragment : Fragment() {
2122
textProgress?.text = "${progressIndicatorView.progress}%"
2223
textMax?.text = "${progressIndicatorView.max}%"
2324
textMin?.text = "${progressIndicatorView.min}%"
25+
26+
progressIndicatorView.onMaxReached = { Log.d(javaClass.name, "MAX" ) }
27+
progressIndicatorView.onStepChanged = { step, forward -> Log.d(javaClass.name, "$step $forward" ) }
28+
progressIndicatorView.onMinReached = { Log.d(javaClass.name, "MIN" ) }
2429
}
2530

2631
fun setupProgress(progress: Int) {

progress-indicator-view/src/main/java/eu/acolombo/progressindicatorview/ProgressIndicatorView.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,11 @@ class ProgressIndicatorView @JvmOverloads constructor(
7171
}
7272
selection != stepProgress - 1 && skipSteps -> {
7373
selection = stepProgress - 1
74+
when (progress) {
75+
min -> onMinReached()
76+
max -> onMaxReached()
77+
else -> onStepChanged(selection + 1, step < selection +1)
78+
}
7479
}
7580
}
7681
}

0 commit comments

Comments
 (0)