Files
openless/openless-all/app/android/kotlin/OpenLessOverlayBridge.kt
T
TRIP fbe40ab583 feat(android): 集成 #704 安卓自动更新 + 同步 PC updater 修复(#705/#708)到安卓 (#712)
合并 #704(安卓应用内自动更新 + JNI 修复)并把 PC updater 修复同步到安卓:①安卓公钥回退 6F4B5994→1DEAA803(同步#705)②installError 安装失败兜底+去 throw(同步#708)③还原被自动合并误删的桌面 logClientError。桌面机制零变更。CI 全绿 + @claude 审核通过。取代 #704 及 #694 安卓部分。
2026-06-19 13:55:53 +08:00

38 lines
951 B
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
interface OverlayStateListener {
fun onCapsuleStateChanged(state: String, message: String?)
}
@Keep
@JvmStatic
fun onCapsuleStateChanged(state: String, message: String?) {
mainHandler.post {
listener?.onCapsuleStateChanged(state, message)
}
}
@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()
}
}
}