From 67dc1b7674b12473ad215d9681579d447a4db041 Mon Sep 17 00:00:00 2001 From: kirillzyusko Date: Fri, 3 Jan 2025 10:34:13 +0100 Subject: [PATCH] chore: remove unused class --- .../ui/FrameScheduler.kt | 43 ------------------- 1 file changed, 43 deletions(-) delete mode 100644 android/src/main/java/com/reactnativekeyboardcontroller/ui/FrameScheduler.kt diff --git a/android/src/main/java/com/reactnativekeyboardcontroller/ui/FrameScheduler.kt b/android/src/main/java/com/reactnativekeyboardcontroller/ui/FrameScheduler.kt deleted file mode 100644 index 0b30a5e722..0000000000 --- a/android/src/main/java/com/reactnativekeyboardcontroller/ui/FrameScheduler.kt +++ /dev/null @@ -1,43 +0,0 @@ -package com.reactnativekeyboardcontroller.ui - -import android.view.Choreographer - -/** - * A class that schedules a callback to be executed on each frame using the Android Choreographer framework. - * - * @property callback The function to be executed on each frame. - */ -class FrameScheduler( - private val callback: () -> Unit, -) { - /** - * A FrameCallback instance responsible for running the provided callback - * on each frame and rescheduling itself for the next frame. - */ - private val frameCallback = - object : Choreographer.FrameCallback { - override fun doFrame(frameTimeNanoSeconds: Long) { - // Execute the callback - callback() - - // Re-post the callback to the next frame - Choreographer.getInstance().postFrameCallback(this) - } - } - - /** - * Starts the frame callback, which will continuously call the provided function - * on every frame until `stop()` is called. - */ - fun start() { - Choreographer.getInstance().postFrameCallback(frameCallback) - } - - /** - * Stops the frame callback from being invoked further. The function will no longer - * be called on each frame until `start()` is invoked again. - */ - fun stop() { - Choreographer.getInstance().removeFrameCallback(frameCallback) - } -}