Package-level declarations

Types

Link copied to clipboard

A ProgressBarDefinition that caches the widgets for each cell so that they only update as fast as their fps.

Link copied to clipboard
Link copied to clipboard
data class ProgressBarCell<T>(val columnWidth: ColumnWidth = ColumnWidth.Auto, val fps: Int = TEXT_FPS, val align: TextAlign = TextAlign.RIGHT, val verticalAlign: VerticalAlign = VerticalAlign.BOTTOM, val content: ProgressState<T>.() -> Widget)
Link copied to clipboard

The cells and configuration for a progress bar layout.

Link copied to clipboard
data class ProgressBarMakerRow<T>(val definition: ProgressBarDefinition<T>, val state: ProgressState<T>)
Link copied to clipboard

Instances of this interface creates widgets for progress bars.

Link copied to clipboard
class ProgressLayoutBuilder<T>(val textFps: Int = TEXT_FPS, val animationFps: Int = ANIMATION_FPS, val align: TextAlign = TextAlign.RIGHT, val verticalAlign: VerticalAlign = VerticalAlign.BOTTOM) : ProgressLayoutScope<T>

A builder for creating a progress bar layout.

Link copied to clipboard
Link copied to clipboard
data class ProgressState<T>(val context: T, val total: Long?, val completed: Long, val animationTime: ComparableTimeMark, val status: ProgressState.Status, val speed: Double? = null, val taskId: TaskId = TaskId())
Link copied to clipboard
class TaskId

A unique identifier for a task in a progress bar.

Properties

Link copied to clipboard

The time that this task finished, or null if it isn't finished.

Link copied to clipboard

true if the task's status is NotStarted.

Link copied to clipboard

true if the task does not have a total specified.

Link copied to clipboard

`true if the task's status is Paused.

Link copied to clipboard

true if the task's status is Running.

Link copied to clipboard

The time that this task was paused, or null if it isn't paused.

Link copied to clipboard

The time that this task started, or null if it hasn't started.

Functions

Link copied to clipboard

Build a progress widget with the given rows.

fun <T> ProgressBarDefinition<T>.build(state: ProgressState<T>, maker: ProgressBarWidgetMaker = MultiProgressBarWidgetMaker): Widget

Create a widget for this ProgressBarDefinition with the given state.

fun ProgressBarDefinition<Unit>.build(total: Long?, completed: Long, displayedTime: ComparableTimeMark, status: ProgressState.Status = ProgressState.Status.NotStarted, speed: Double? = null, maker: ProgressBarWidgetMaker = MultiProgressBarWidgetMaker): Widget
fun <T> ProgressBarDefinition<T>.build(context: T, total: Long?, completed: Long, displayedTime: ComparableTimeMark, status: ProgressState.Status = ProgressState.Status.NotStarted, speed: Double? = null, maker: ProgressBarWidgetMaker = MultiProgressBarWidgetMaker): Widget

Create a widget for this ProgressBarDefinition with the given state.

Link copied to clipboard

Cache this progress bar definition so that each cell only updates as often as its fps.

Link copied to clipboard

Calculate the time elapsed for this task, or null if the task hasn't started.

Link copied to clipboard
fun ProgressState<*>.calculateTimeRemaining(elapsedWhenFinished: Boolean = true): Duration?

Calculate the estimated time remaining for this task, or null if the time cannot be estimated.

Link copied to clipboard
fun ProgressLayoutScope<*>.completed(suffix: String = "", includeTotal: Boolean = true, precision: Int = 1, style: TextStyle = DEFAULT_STYLE, verticalAlign: VerticalAlign = this.verticalAlign, fps: Int = textFps)

Add a cell that displays the current completed count to this layout.

Link copied to clipboard

Return the number of frames that have elapsed at the given fps since the start of the animationTime.

Link copied to clipboard
fun ProgressLayoutScope<*>.marquee(content: String, width: Int, fps: Int = 3, align: TextAlign = this.align, verticalAlign: VerticalAlign = this.verticalAlign, scrollWhenContentFits: Boolean = false)
fun <T> ProgressLayoutScope<T>.marquee(width: Int, fps: Int = 3, align: TextAlign = this.align, verticalAlign: VerticalAlign = this.verticalAlign, scrollWhenContentFits: Boolean = false, content: ProgressState<T>.() -> String)

Add a fixed width text cell that scrolls its contents horizontally so that long text can be displayed in a fixed width.

Link copied to clipboard
fun ProgressLayoutScope<*>.percentage(fps: Int = textFps, style: TextStyle = DEFAULT_STYLE, verticalAlign: VerticalAlign = this.verticalAlign)

Add a cell that displays the current percentage to this layout.

Link copied to clipboard
fun ProgressLayoutScope<*>.progressBar(width: Int? = null, pendingChar: String? = null, separatorChar: String? = null, completeChar: String? = null, pendingStyle: TextStyle? = null, separatorStyle: TextStyle? = null, completeStyle: TextStyle? = null, finishedStyle: TextStyle? = null, indeterminateStyle: TextStyle? = null, pulsePeriod: Duration = 2.seconds, verticalAlign: VerticalAlign = this.verticalAlign, fps: Int = animationFps)

Add a progress bar cell to this layout.

Link copied to clipboard
fun <T> progressBarContextLayout(spacing: Int = 2, alignColumns: Boolean = true, textFps: Int = TEXT_FPS, animationFps: Int = ANIMATION_FPS, align: TextAlign = TextAlign.RIGHT, verticalAlign: VerticalAlign = VerticalAlign.BOTTOM, init: ProgressLayoutScope<T>.() -> Unit): ProgressBarDefinition<T>

Create a progress bar layout with that has a context of type T.

Link copied to clipboard
fun <T> ProgressBarDefinition(cells: List<ProgressBarCell<T>>, spacing: Int, alignColumns: Boolean): ProgressBarDefinition<T>

Create a new progress bar layout definition.

Link copied to clipboard
fun progressBarLayout(spacing: Int = 2, alignColumns: Boolean = true, textFps: Int = TEXT_FPS, animationFps: Int = ANIMATION_FPS, align: TextAlign = TextAlign.RIGHT, verticalAlign: VerticalAlign = VerticalAlign.BOTTOM, init: ProgressLayoutScope<Unit>.() -> Unit): ProgressBarDefinition<Unit>

Create a progress bar layout that doesn't use a context.

Link copied to clipboard
fun ProgressState(total: Long?, completed: Long, animationTime: ComparableTimeMark, status: ProgressState.Status, speed: Double? = null): ProgressState<Unit>

Create a ProgressState with no context.

Link copied to clipboard
fun ProgressLayoutScope<*>.speed(suffix: String = "/s", style: TextStyle = DEFAULT_STYLE, verticalAlign: VerticalAlign = this.verticalAlign, fps: Int = textFps)

Add a cell that displays the current speed to this layout.

Link copied to clipboard
fun ProgressLayoutScope<*>.spinner(spinner: Spinner, verticalAlign: VerticalAlign = this.verticalAlign, fps: Int = 8)

Add a Spinner to this layout.

Link copied to clipboard
fun ProgressLayoutScope<*>.text(content: String, align: TextAlign = this.align, verticalAlign: VerticalAlign = this.verticalAlign)

Add a fixed text cell to this layout.

fun <T> ProgressLayoutScope<T>.text(align: TextAlign = this.align, verticalAlign: VerticalAlign = this.verticalAlign, fps: Int = textFps, content: ProgressState<T>.() -> String)

Add a dynamic text cell to this layout.

Link copied to clipboard
fun ProgressLayoutScope<*>.timeElapsed(compact: Boolean = false, style: TextStyle = DEFAULT_STYLE, verticalAlign: VerticalAlign = this.verticalAlign, fps: Int = textFps)

Add a cell that displays the elapsed time to this layout.

Link copied to clipboard
fun ProgressLayoutScope<*>.timeRemaining(prefix: String = "eta ", compact: Boolean = false, elapsedWhenFinished: Boolean = false, elapsedPrefix: String = " in ", style: TextStyle = DEFAULT_STYLE, verticalAlign: VerticalAlign = this.verticalAlign, fps: Int = textFps)

Add a cell that displays the time remaining to this layout.