Fix an issue where animations on the phone preview stopped prematurely

This commit is contained in:
James Babcock committed 2026-10-03 15:54:57 -07:00
1 parent eb7f385644
commit 4234d3e9e9
14 files changed
+160 -6

No files matched your search

@@ -242,6 +242,14 @@ class FaceclawBleCommunicator(context: Context, rightAddress: String?, leftAddre
java.nio.ByteBuffer.wrap(composite.gray), composite.width, composite.height, brightenGamma, green)
}
/**
* Posted to the main looper after each step of an animation the preview is replaying (menu
* highlight slides, scrolls), so the mirror can pull the new frame; frame metrics only cover
* frames sent to the glasses, which carry the whole animation in one display list.
*/
fun setPreviewAnimationListener(listener: Runnable?) =
core.setPreviewAnimationListener(listener?.let { { mainHandler.post(it); Unit } })
/** Save the current composite as a 4-bit grayscale PNG; returns the path or "". */
@Throws(java.io.IOException::class)
fun saveCompositePngScreenshot(): String {
@@ -51,11 +51,13 @@ class FaceclawPreviewCompositor(context: Context) {
if (activeInstance === this) {
activeInstance = null
}
frameListener = null
setFrameListener(null)
}
/** Also notified after each step of an animation the preview is replaying (see SurfaceCompositor). */
fun setFrameListener(listener: Runnable?) {
this.frameListener = listener
compositor.setPreviewAnimationListener(listener?.let { { mainHandler.post(it); Unit } })
}
/** Set the compositor's output frame size. Call before configuring surfaces. */