Skip to Content
CrowCrow

Text Input & Crow Image

Direct InputConnection text editing with TextState, input/output transformations, and Coil-class hardware-bitmap image loading with crow-image.

Text Input (TextState & TextField)

Crow's text engine separates pure-JVM editing state (TextState in crow-runtime) from Android's direct InputConnection bridge (TextFieldNode in crow-ui).

@Ui
fun LoginForm() {
    val email = saved("")
    val password = signal("")

    Column(verticalArrangement = Arrangement.spacedBy(12.dp)) {
        TextField(
            value = email,
            placeholder = { Text("you@domain.com") },
            keyboardOptions = KeyboardOptions(imeAction = ImeAction.Next),
        )
        TextField(
            value = password,
            placeholder = { Text("Password") },
            outputTransformation = PasswordTransformation(),
            keyboardOptions = KeyboardOptions(imeAction = ImeAction.Done),
        )
    }
}

Capabilities

  • Immediate-lane responsiveness: Text content, selection range, and IME composition spans are tracked independently on Lane.Immediate so typing never stalls behind held network transitions.
  • Atomic edits & undo: TextState supports nested batched edits, maxLength, InputTransformation, merged typing undo history, and surrogate/grapheme-safe cursor motion.
  • Visual output transformations: PasswordTransformation and GroupingTransformation (e.g., credit cards, phone numbers) map visual-to-logical offsets accurately for selection and carets.
  • Zero-flicker focus handoff: Moving focus between two TextFields keeps the soft keyboard smoothly open and updates InputConnection in place.

Images (crow-image)

crow-image combines a platform-free ImageEngine (byte-budgeted LRU memory cache, weak cache, variant reuse, request coalescing, cancellation, and prioritized prefetch) with an Android ImageLoader supporting cover-size decoding, API 29+ hardware bitmaps, atomic SHA-256 disk caching, EXIF orientation, and animated GIF/WebP playback.

Image(
    source = item.coverUrl,
    contentDescription = item.title,
    modifier = Modifier
        .size(120.dp)
        .clip(RoundedCornerShape(16.dp)),
    contentScale = ContentScale.Crop,
)

Images Inside Loading Boundaries (imageResource)

Unlike external image libraries, Crow images can participate in the exact same Loading boundaries and held route transitions as your API data:

Loading(fallback = { CardSkeleton() }) {
    val cover = imageResource(item.heroUrl, widthPx = 800, heightPx = 450)
    HeroHeader(cover.value)
}
  • Memory cache hits settle synchronously on the first frame — zero placeholder flash.
  • Hardware decoding matches the node's measured bounds without upscaling.
  • Animated GIF & WebP pause automatically while scrolled off-screen or while their screen is dormant in the back stack.
  • Draw-phase arrival: When a network image finishes decoding, only that ImageNode invalidates its draw pass.

How is this guide?

On this page