slice

abstract fun slice(weight: Float, phase: String? = null): ProgressScope

Takes the next part of this window for one step and returns a scope for it.

Slices are taken left to right. Three slices of 0.2f, 0.3f and 0.5f cover this window in that order. A slice can have its own slices.

val parse = slice(0.4f, "parsing")   // 0% to 40% of this window
parse.report(0.5f) // bar: 20%, "parsing"
val load = slice(0.6f, "loading") // 40% to 100%. Bar: 40%, "loading"

Watch out. Take a named slice when its step starts, not all slices up front. A named slice reports its start at once, so the bar would jump to the last slice and then back.

Parameters

weight

the part of this window, from 0f to 1f. The weights of all slices of one scope should add up to 1 or less. A weight larger than the remaining part is cut to fit.

phase

the label of the step. A named slice reports 0f with this label at once. With null, the slice keeps the current label.