CircularProgressLayout

public class 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 and a listener via setOnTimerFinishedListener 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 types

CircularProgressLayout.OnTimerFinishedListener

Interface to implement for listening to event.

Public constructors

CircularProgressLayout(
    @NonNull Context context,
    @NonNull AttributeSet attrs
)
CircularProgressLayout(
    @NonNull Context context,
    @NonNull AttributeSet attrs,
    @NonNull int defStyleAttr
)
CircularProgressLayout(
    @NonNull Context context,
    @NonNull AttributeSet attrs,
    @NonNull int defStyleAttr,
    @NonNull int defStyleRes
)

Public methods

@ColorInt @NonNull int

Returns the background color of the CircularProgressDrawable.

@NonNull Array<@NonNull int>

Returns the color scheme colors of the progress drawable

@Nullable CircularProgressLayout.OnTimerFinishedListener

Returns the OnTimerFinishedListener that is registered to this layout.

@NonNull CircularProgressDrawable

Returns the CircularProgressDrawable used as background of this layout.

@NonNull float

Returns the starting rotation of the progress drawable.

@NonNull float

Returns the stroke width of the progress drawable in pixels.

@NonNull long

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

@NonNull boolean

Returns if progress is showing as an indeterminate spinner.

@NonNull boolean

Returns if the timer is running.

@Override @NonNull void

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

@NonNull void

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

@NonNull void
setIndeterminate(@NonNull boolean indeterminate)

Sets if progress should be shown as an indeterminate spinner.

@NonNull void

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

@NonNull void
setStartingRotation(@NonNull float rotation)

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

@NonNull void
setStrokeWidth(@NonNull float strokeWidth)

Sets the stroke width of the progress drawable in pixels.

@NonNull void
setTotalTime(@NonNull long totalTime)

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

@NonNull void

Starts the timer countdown.

@NonNull void

Stops the timer countdown.

Inherited methods

From class FrameLayout
From class View
@NonNull void
@NonNull void
@NonNull void
@NonNull ViewPropertyAnimator
@NonNull void
@NonNull void
@NonNull void
@NonNull void

This method is deprecated.

@NonNull void
@NonNull boolean
@NonNull boolean
@NonNull boolean
@NonNull boolean
@NonNull boolean
@NonNull boolean
canScrollVertically(@NonNull int direction)
final @NonNull void
@NonNull void
final @NonNull void
@NonNull boolean
@NonNull void
@NonNull void
static @NonNull int
combineMeasuredStates(@NonNull int curState, @NonNull int newState)
@NonNull void
@NonNull WindowInsets
computeSystemWindowInsets(
    @NonNull WindowInsets in,
    @NonNull Rect outLocalInsets
)
@NonNull AccessibilityNodeInfo
@NonNull void
@NonNull void

This method is deprecated.

@NonNull boolean
@NonNull boolean
dispatchNestedFling(
    @NonNull float velocityX,
    @NonNull float velocityY,
    @NonNull boolean consumed
)
@NonNull boolean
dispatchNestedPreFling(@NonNull float velocityX, @NonNull float velocityY)
@NonNull boolean
dispatchNestedPrePerformAccessibilityAction(
    @NonNull int action,
    @NonNull Bundle arguments
)
@NonNull boolean
dispatchNestedPreScroll(
    @NonNull int dx,
    @NonNull int dy,
    @NonNull Array<@NonNull int> consumed,
    @NonNull Array<@NonNull int> offsetInWindow
)
@NonNull boolean
dispatchNestedScroll(
    @NonNull int dxConsumed,
    @NonNull int dyConsumed,
    @NonNull int dxUnconsumed,
    @NonNull int dyUnconsumed,
    @NonNull Array<@NonNull int> offsetInWindow
)
@NonNull boolean
@NonNull void
draw(@NonNull Canvas canvas)
@NonNull void
drawableHotspotChanged(@NonNull float x, @NonNull float y)
final @NonNull T
<T extends View> findViewById(@NonNull int id)
final @NonNull T
<T extends View> findViewWithTag(@NonNull Object tag)
@NonNull void
forceHasOverlappingRendering(@NonNull boolean hasOverlappingRendering)
@NonNull void
@NonNull void
generateDisplayHash(
    @NonNull String hashAlgorithm,
    @NonNull Rect bounds,
    @NonNull Executor executor,
    @NonNull DisplayHashResultCallback callback
)
static @NonNull int
@NonNull View.AccessibilityDelegate
@NonNull int
@NonNull AccessibilityNodeProvider
@NonNull CharSequence
@NonNull int
@NonNull int
@NonNull float
@NonNull Animation