Files
TRIPandHKLHaoBin 6f9af89583 release: OpenLess 2.0.0-Beta.4+build.20260930 (#1126)
Integrate ASR/Omni fixes, API Route, Android IME and confirmation-based vocabulary learning. Complete settings transitions and macOS single-item credential storage. Synchronize all application versions to 2.0.0-Beta.4+build.20260930.

Integrated PRs: #1116, #1120, #1121, #1123, #1124, #1067 and #1128. Linux #1117 remains independent and is excluded from automatic release.

Validated: full cross-platform CI, 18 UI motion cases, 112 frontend test files, 1245 Core tests (1 ignored) and 572 macOS native tests.

Co-authored-by: HKLHaoBin <we3q@qq.com>
2026-09-30 20:32:53 +08:00

49 lines
1.4 KiB
Kotlin

package com.openless.app
import android.os.Handler
import android.os.Looper
import androidx.annotation.Keep
/** Rust calls back into this object to refresh overlay UI state. */
@Keep
object OpenLessOverlayBridge {
private val mainHandler = Handler(Looper.getMainLooper())
@Volatile var listener: OverlayStateListener? = null
@Volatile var imeListener: OverlayStateListener? = null
@Volatile var imeSessionListener: ((String) -> Unit)? = null
interface OverlayStateListener {
fun onCapsuleStateChanged(state: String, message: String?, level: Float)
}
@Keep
@JvmStatic
fun onCapsuleStateChanged(state: String, message: String?, level: Float) {
mainHandler.post {
listener?.onCapsuleStateChanged(state, message, level)
imeListener?.onCapsuleStateChanged(state, message, level)
}
}
@Keep
@JvmStatic
fun onImeSessionEvent(json: String) {
mainHandler.post { imeSessionListener?.invoke(json) }
}
@Keep
@JvmStatic
fun showToast(message: String) {
mainHandler.post {
val service = OpenLessOverlayService.instance ?: return@post
android.widget.Toast.makeText(
service.applicationContext,
message,
android.widget.Toast.LENGTH_SHORT,
)
.show()
}
}
}