Skip to main content

CamoProgress

Concept​

1. Why​

Progress indicators show that work is happening: determinate when the fraction is known (an upload at 40%), indeterminate when it isn't (loading). There are two shapes, a bar and a circle. Every system has both, so Camouflage gives both, with tone support (a red failing upload).

2. Shape​

Material mapping preview: M3 progress indicators (2024 update).

  • Bar: 4 dp track, with an active primary part and a gap before the secondaryContainer track, plus a stop dot at the end.
  • Circle: 48 diameter, stroke 4.

(The M3 Expressive "wavy" style is a skin option, MaterialSkin(expressiveProgress = true), Later.)

3. API​

Contract​

fun CamoProgressBar(
progress: Float? = null, // null = indeterminate; 0f..1f = determinate
tone: Tone = Default,
label: String? = null, // accessible name ("Uploading photo")
)
fun CamoProgressCircle(
progress: Float? = null,
tone: Tone = Default,
size: ProgressSize = Medium, // Small 24 | Medium 48 | Large 64
label: String? = null,
)

State → renderer: ProgressState(progress?, tone). Slots: none.

Tokens used​

  • the tone's strong color (active part), secondaryContainer / the tone's container (track)
  • motion.durationLong + easingStandard for indeterminate cycles, and durationMedium for determinate changes

Component theme​

theme.components.progress: ProgressTheme?. Every field is nullable in the theme. The skin's defaults(theme) fills whatever isn't set (Material defaults shown). See Theme §3.10.

FieldTypeMaterial defaultWhat it's for
barHeightDp4bar thickness
circleStrokeDp4circle stroke
circleSizeSmall / Medium / LargeDp24 / 48 / 64circle sizes
trackGapDp4the gap between active and track (M3 2024 look)
showStopIndicatorBooleantrueend dot on determinate bars
colorsProgressColors(active, track)the tone's strong, secondaryContainercolors for tone = Default

Accessibility​

  • A progress bar role with name = label, and value = percentage (determinate) or "in progress" (indeterminate).
  • Determinate value changes are not announced continuously. Apps announce milestones ("Upload complete").
  • Reduced motion: indeterminate indicators switch to a slow opacity pulse instead of sweeping movement.

4. Build steps​

  1. CamoProgressBar, CamoProgressCircle, and their renderers (indeterminate animations driven by motion tokens).
  2. Tests:
    • determinate draws the fraction;
    • null animates;
    • reduced motion uses the pulse;
    • the semantics value;
    • tone colors.

Done when

  • Upload (determinate bar), page loading (indeterminate circle), and a failed upload (tone = Error) render on every platform, with and without reduced motion.

5. Edge cases​

CaseDecided behavior
progress outside 0..1Clamped.
Switching from indeterminate to determinateAnimates from the current sweep position to the value.
RTLBars fill from the right.
A loading buttonCamoButton(loading = true): the button draws a small CamoProgressCircle itself and keeps its width (see CamoButton §5).
Changed in the M7 build (2026-10-28)
  • ProgressTheme gains barHeight, trackGap and showStopIndicator; the bar has its own renderer (progressBar), whose defaults return the same style as the circle's.
  • ProgressStyle.colorsFor(tone, theme): the style's colors for the default tone, the tone's strong color over the same track otherwise.
  • A bar fills the width it's given; only an indeterminate one animates forever.
  • Minimal: 2 px ink on a hairline track, no gap or stop dot. Fluent: its 2 px ProgressBar.

Implementation​

1. Why​

Bars and circles, determinate or indeterminate, drawn on a Canvas (Material's indicators aren't a v1 dependency). The Kotlin points: an infinite transition for indeterminate motion, the reduced-motion pulse, and progressSemantics.

2. Shape​

3. API​

@Composable public fun CamoProgressBar(modifier: Modifier = Modifier, progress: Float? = null, tone: Tone = Tone.Default, label: String? = null)
@Composable public fun CamoProgressCircle(modifier: Modifier = Modifier, progress: Float? = null, tone: Tone = Tone.Default,
size: ProgressSize = ProgressSize.Medium, label: String? = null)
  • Semantics: Modifier.progressSemantics(value = progress.coerceIn(0f, 1f)) for determinate, progressSemantics() for indeterminate, plus contentDescription = label.
  • Determinate changes animate with animateFloatAsState(progress, tween(theme.motion.durationMedium)).
  • Indeterminate: rememberInfiniteTransition() drives the sweep (circle: rotation + arc length; bar: a moving segment) with theme.motion.durationLong-based cycles. When the provider's motion is reduced, the renderer switches to a slow alpha pulse (animateFloat(0.4f → 1f)) instead of movement.
  • Drawing uses drawArc / drawLine with StrokeCap.Round per the style; the bar respects RTL by flipping with scale(-1f, 1f) when LocalLayoutDirection is RTL.

4. Build steps​

  1. ProgressTheme / Style, both composables, the DebugSkin renderers.
  2. commonTest: determinate draws the fraction (screenshot); null animates; reduced motion pulses; semantics range info; clamping.

Done when

  • Upload, page loading and a failed upload (Error tone) render on all targets, with and without reduced motion.

5. Edge cases​

CaseDecided behavior
Many indeterminate indicators on screenEach has its own transition; acceptable (they're rarely many). Skeletons, which are, share one clock.
Loading buttonsCamoButton(loading = true) uses CamoProgressCircle(size = Small) internally.
Changed in the M7 build (2026-10-28)
  • CamoProgressBar(modifier, progress, tone, label) with progressSemantics, like the circle; the skin field is progressBar: ProgressBarRenderer.