Android 12 Developer Preview is here! Try it out, and give us your feedback!


open class CircularProgressLayout : FrameLayout
   ↳ android.view.View
   ↳ android.view.ViewGroup
   ↳ android.widget.FrameLayout
   ↳ androidx.wear.widget.CircularProgressLayout

CircularProgressLayout adds a circular countdown timer behind the view it contains, typically used to automatically confirm an operation after a short delay has elapsed.

The developer can specify a countdown interval via setTotalTime(long) and a listener via setOnTimerFinishedListener(OnTimerFinishedListener) to be called when the time has elapsed after startTimer() has been called. Tap action can be received via and can be used to cancel the timer via method.

Alternatively, this layout can be used to show indeterminate progress by calling method.


Nested classes

Interface to implement for listening to event.

Public constructors
<init>(context: Context!)

<init>(context: Context!, attrs: AttributeSet!)

<init>(context: Context!, attrs: AttributeSet!, defStyleAttr: Int)

<init>(context: Context!, attrs: AttributeSet!, defStyleAttr: Int, defStyleRes: Int)

Public methods
open Int

Returns the background color of the CircularProgressDrawable.

open IntArray!

Returns the color scheme colors of the progress drawable

open CircularProgressLayout.OnTimerFinishedListener?

Returns the OnTimerFinishedListener that is registered to this layout.

open CircularProgressDrawable

Returns the CircularProgressDrawable used as background of this layout.

open Float

Returns the starting rotation of the progress drawable.

open Float

Returns the stroke width of the progress drawable in pixels.

open Long

Returns the total time in milliseconds for the timer to countdown to.

open Boolean

Returns if progress is showing as an indeterminate spinner.

open Boolean

Returns if the timer is running.

open Unit
setBackgroundColor(@ColorInt color: Int)

Sets the background color of the CircularProgressDrawable, which is drawn as a circle inside the progress drawable.

open Unit
setColorSchemeColors(vararg colors: Int)

Sets the color scheme colors of the progress drawable, which is equivalent to calling method on background drawable of this layout.

open Unit
setIndeterminate(indeterminate: Boolean)

Sets if progress should be shown as an indeterminate spinner.

open Unit

Sets the OnTimerFinishedListener to be notified when timer countdown is finished.

open Unit

Sets the starting rotation for the progress drawable to start from.

open Unit
setStrokeWidth(strokeWidth: Float)

Sets the stroke width of the progress drawable in pixels.

open Unit
setTotalTime(totalTime: Long)

Sets the total time in milliseconds for the timer to countdown to.

open Unit

Starts the timer countdown.

open Unit

Stops the timer countdown.

Protected methods
open Unit

open Unit
onLayout(changed: Boolean, left: Int, top: Int, right: Int, bottom: Int)

Public constructors


CircularProgressLayout(context: Context!)