CountdownTimerView

class CountdownTimerView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null, @AttrRes defStyleAttr: Int = R.attr.countdownTimerViewStyle, @StyleRes defStyleRes: Int = R.style.MiSnapTheme_TextAppearance_CountdownTimerView) : MaterialTextView

A view to display a countdown to the user with a specific set of labels and an overall duration.

ACCESSIBILITY NOTES:

  • Avoid using this view in combination with a HintView for users who rely on accessibility features, such as screen readers, it may introduce excessive auditory clutter and reduce clarity.

  • This view is considered and set to be a ACCESSIBILITY_LIVE_REGION_POLITE by default.

  • This view announces the label displayed by default when screen readers are enabled.

  • When font scaling is enabled, this view will adjust the size of the text non-linearly up to the maximum safe size to prevent text from becoming excessively large and impacting readability or UI layout integrity.

Constructors

Link copied to clipboard
constructor(context: Context, attrs: AttributeSet? = null, @AttrRes defStyleAttr: Int = R.attr.countdownTimerViewStyle, @StyleRes defStyleRes: Int = R.style.MiSnapTheme_TextAppearance_CountdownTimerView)

Functions

Link copied to clipboard
open override fun getAnimation(): Animation?
Link copied to clipboard

Delay interval in milliseconds between each label shown during the countdown.

Link copied to clipboard

Gets the time in milliseconds to count down.

Link copied to clipboard

Gets the labels used to cycle through the countdown

Link copied to clipboard
fun reset()

Resets the countdown timer to its initial state.

Link copied to clipboard
open override fun setAnimation(animation: Animation?)

fun setAnimation(@AnimRes resId: Int)

Sets the animation for each label shown during the countdown.

Link copied to clipboard
fun setDuration(timeInMillis: Int)

Sets the time in milliseconds to count down. Calls to this method are ignored if the countdown timer is already running.

Link copied to clipboard
fun setLabels(@ArrayRes resId: Int)
fun setLabels(labels: List<String>)

Sets the labels to cycle through for the countdown. Calls to this method are ignored if the countdown timer is already running.

Link copied to clipboard
fun start()

Starts the countdown timer. Multiple calls to this method are ignored if the countdown timer is already running.