CircularProgressLayout
open class CircularProgressLayout : FrameLayout
kotlin.Any | ||||
↳ | 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.
Summary
Nested classes | |
---|---|
abstract |
Public constructors | |
---|---|
<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 |
open IntArray! |
Returns the color scheme colors of the progress drawable |
open CircularProgressLayout.OnTimerFinishedListener? |
Returns the |
open CircularProgressDrawable |
Returns the |
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 |
open Unit |
setColorSchemeColors(vararg colors: Int) Sets the color scheme colors of the progress drawable, which is equivalent to calling |
open Unit |
setIndeterminate(indeterminate: Boolean) Sets if progress should be shown as an indeterminate spinner. |
open Unit |
setOnTimerFinishedListener(@Nullable listener: CircularProgressLayout.OnTimerFinishedListener?) Sets the |
open Unit |
setStartingRotation(rotation: Float) 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 |
Public constructors
<init>
CircularProgressLayout(context: Context!)
<init>
CircularProgressLayout(
context: Context!,
attrs: AttributeSet!)
<init>
CircularProgressLayout(
context: Context!,
attrs: AttributeSet!,
defStyleAttr: Int)
<init>
CircularProgressLayout(
context: Context!,
attrs: AttributeSet!,
defStyleAttr: Int,
defStyleRes: Int)
Public methods
getBackgroundColor
@ColorInt open fun getBackgroundColor(): Int
Returns the background color of the CircularProgressDrawable
.
Return | |
---|---|
Int |
an ARGB color |
getColorSchemeColors
open fun getColorSchemeColors(): IntArray!
Returns the color scheme colors of the progress drawable
Return | |
---|---|
IntArray! |
list of ARGB colors |
getOnTimerFinishedListener
@Nullable open fun getOnTimerFinishedListener(): CircularProgressLayout.OnTimerFinishedListener?
Returns the OnTimerFinishedListener
that is registered to this layout.
Return | |
---|---|
CircularProgressLayout.OnTimerFinishedListener? |
registered OnTimerFinishedListener |
getProgressDrawable
@NonNull open fun getProgressDrawable(): CircularProgressDrawable
Returns the CircularProgressDrawable
used as background of this layout.
Return | |
---|---|
CircularProgressDrawable |
CircularProgressDrawable |
getStartingRotation
open fun getStartingRotation(): Float
Returns the starting rotation of the progress drawable.
Return | |
---|---|
Float |
starting rotation from [0..1] |
getStrokeWidth
open fun getStrokeWidth(): Float
Returns the stroke width of the progress drawable in pixels.
Return | |
---|---|
Float |
stroke width in pixels |
getTotalTime
open fun getTotalTime(): Long
Returns the total time in milliseconds for the timer to countdown to.
Return | |
---|---|
Long |
total time in milliseconds |
isIndeterminate
open fun isIndeterminate(): Boolean
Returns if progress is showing as an indeterminate spinner.
Return | |
---|---|
Boolean |
true if indeterminate spinner is shown, false otherwise. |
isTimerRunning
open fun isTimerRunning(): Boolean
Returns if the timer is running.
Return | |
---|---|
Boolean |
true if the timer is running, false otherwise |
setBackgroundColor
open fun setBackgroundColor(@ColorInt color: Int): Unit
Sets the background color of the CircularProgressDrawable
, which is drawn as a circle inside the progress drawable. Colors are in ARGB format defined in Color
.
Parameters | |
---|---|
color |
Int: an ARGB color |