Skip to main content
Version: 1.1.x

Overlay Touch Listener

Touches in ordinary Activity and Dialog windows are recorded automatically. If you use a custom View.OnTouchListener on a Popup or Application Overlay, register it through Coryn.setRootOnTouchListener(). This also applies to child Views.

Pass the affected View directly, and use Coryn APIs for every listener replacement or removal after initialisation. Register existing listeners through Coryn as well; calling Android's setOnTouchListener() directly can interrupt touch recording or your listener.

When is this needed?

This is commonly needed for a draggable picture-in-picture overlay or a popup whose root or children have custom touch listeners. Standard Activity/Fragment windows and Composables without such popup/overlay listeners need no additional integration.

Setting an Overlay Root Touch Listener​

Coryn.setRootOnTouchListener(
view = overlayRootView,
onTouchListener = { view, event ->
// Handle touch event, then return whether your listener consumed it.
false
}
)

For Kotlin callers, import the extension function and use it on the View:

import ai.coryn.replay.api.core.main.Coryn.corynSetRootOnTouchListener

overlayRootView.corynSetRootOnTouchListener { view, event ->
// Handle touch event, then return whether your listener consumed it.
false
}

Removing an Overlay Root Touch Listener​

When the root no longer needs your custom listener, remove it through Coryn so SDK touch recording remains connected:

Coryn.removeRootOnTouchListener(overlayRootView)

Or with the extension function:

import ai.coryn.replay.api.core.main.Coryn.corynRemoveRootOnTouchListener

overlayRootView.corynRemoveRootOnTouchListener()

Return true only if your listener consumes the event; otherwise return false so normal Android dispatch continues. Do not call view.onTouchEvent() yourself to forward it.