Skip to main content
Version: 1.1.x

UI Capture

Entry point
ai.coryn.replay.api.core.main.Coryn
Artifact
ai.coryn.replay.api:core

Initialise Coryn before using these operations. A recorder is required to capture UI. Use the Compose APIs for Composables and Views hosted in AndroidView.

View masking​

Signature
fun hideFromUiCapture(view: View, hide: Boolean = true, padding: CorynPadding? = null)

// Member extension of Coryn
fun View.corynHideFromUiCapture(hide: Boolean = true, padding: CorynPadding? = null)

Mark a View as hidden in visual captures and exclude eligible text from automatic Screen Text collection. Apply before showing sensitive content. hide = false disables that declaration. padding adds hiding space in dp; null adds no custom padding. These operations accept calls from any thread and dispatch through the main and affected View's UI threads.

Java static overloads can omit padding, or both optional arguments. Import the Kotlin extension from Coryn:

Kotlin usage
import ai.coryn.replay.api.core.main.Coryn.corynHideFromUiCapture
import ai.coryn.replay.shared.uicapture.CorynPadding

view.corynHideFromUiCapture(padding = CorynPadding.all(8f))

Use Modifier.corynHideFromUiCapture on AndroidView instead of passing its hosted View to this API. Masks do not redact custom States, Events, screen arguments, Toast text, or network diagnostics. See Privacy Masking.

onHiddenPositionWillChange​

Signature
fun onHiddenPositionWillChange()

Synchronously invalidate an in-progress capture immediately before exceptional geometry changes that bypass normal position tracking, including temporary positions in custom pre-draw/drawing code or attached Popup/Overlay root surface-inset changes. Call on the affected root's UI thread, before every change, including restoration. Do not post the notification separately from the mutation.

Normal scrolling, layout, RecyclerView movement, and Compose positioning are tracked automatically and do not need this notification. It is not a per-frame callback and does not replace masking declarations or padding for drawing outside layout bounds. See manual position changes.

acceptToast​

Signature
fun acceptToast(context: Context, text: CharSequence, duration: Int, show: Boolean = true): Toast
fun acceptToast(context: Context, @StringRes resId: Int, duration: Int, show: Boolean = true): Toast
fun acceptToast(context: Context, toast: Toast, text: CharSequence, show: Boolean = true): Toast

Call on the main thread. The first two overloads create a standard text Toast, using Toast.LENGTH_SHORT or Toast.LENGTH_LONG; the resource overload resolves the string through context. The third tracks an already configured Toast. All return the tracked Toast and show it by default. With show = false, call Toast.show() yourself afterwards. Java static overloads can omit show.

For an existing Toast, set its View, duration, and placement beforehand and pass the context used to create it. Replay draws only the supplied text in a simple SDK layout, not the custom View, OEM styling, placement, or animation. The returned instance can be cancelled; do not mutate or reuse it for another message.

Toast text does not inherit masking from Views or Composables. To hide sensitive content in an existing Toast's replay, supply safe replacement text with show = false, then show the original Toast yourself. Replacement text changes the recording, not the actual Android message. See Toasts.

SurfaceView ordering​

Signature
fun setZOrderOnTop(surface: SurfaceView, onTop: Boolean)
fun setZOrderMediaOverlay(surface: SurfaceView, isMediaOverlay: Boolean)

// Member extensions of Coryn
fun SurfaceView.corynSetZOrderOnTop(onTop: Boolean)
fun SurfaceView.corynSetZOrderMediaOverlay(isMediaOverlay: Boolean)

Call the Android setters and track order for UI captures on API 29–35. Use these wrappers for every ordering change on those versions; direct Android calls cannot be observed. API 36+ captures use the platform composition-order getter. Calls are accepted from any thread and dispatched to the surface's UI thread.

Set the order before the containing window attaches. Dynamic setZOrderOnTop changes are also supported on API 30+ when targeting API 30+. setZOrderMediaOverlay must be called before attachment. SurfaceView capture requires API 29+; protected content can remain unavailable. See SurfaceView Capture.

Root touch listeners​

Signature
fun setRootOnTouchListener(view: View, onTouchListener: View.OnTouchListener)
fun setRootOnTouchListener(view: View, onTouchListener: (View, MotionEvent) -> Boolean)
fun removeRootOnTouchListener(view: View)

// Member extensions of Coryn
fun View.corynSetRootOnTouchListener(onTouchListener: View.OnTouchListener)
fun View.corynSetRootOnTouchListener(onTouchListener: (View, MotionEvent) -> Boolean)
fun View.corynRemoveRootOnTouchListener()

Integrate an app's custom root View touch listener with Coryn's touch recording. Use for Activity, Fragment, Dialog, application overlay, or other root Views when you already need a custom listener there. Removal removes the previously integrated listener. Calls accept any thread and dispatch through the main and View's UI threads. See Touch Listener.

For padding factories and recording-time overscroll options, see Privacy Masking.