lopspower / CircularProgressBar

Create circular ProgressBar in Android ⭕
Apache License 2.0
1.73k stars 223 forks source link

On Progress complete #61

Open evicoach opened 3 years ago

evicoach commented 3 years ago

How can one listen for when the progress is completed?

dobariyavishalpatel commented 2 years ago

You need to add a count down timer when circle progress bar animation start like below code binding.progressBar.apply { progress = 0F val animationDuration = 60 1000 2 setProgressWithAnimation(100f, animationDuration) } object : CountDownTimer(60 1000 2, 1000) { override fun onTick(millisUntilFinished: Long) { val currentProgress = (String.format( "%02d:%02d", TimeUnit.MILLISECONDS.toMinutes(millisUntilFinished), TimeUnit.MILLISECONDS.toSeconds(millisUntilFinished) - TimeUnit.MINUTES.toSeconds( TimeUnit.MILLISECONDS.toMinutes( millisUntilFinished ) ) )) binding.tvProgress.text = currentProgress }

        override fun onFinish() {
            binding.tvResend.visible()
        }
    }.start()