Fixed Loading Screen while Compiling Shaders

This commit is contained in:
BeZide93
2025-09-25 17:10:03 -05:00
committed by KeatonTheBot
parent 92c3b72b17
commit 7cc28d0242
3 changed files with 15 additions and 16 deletions
@@ -111,11 +111,11 @@ object KenjinxNative : KenjinxNativeJna by jnaInstance {
MainActivity.mainViewModel?.gameHost?.currentWindowHandle ?: -1 MainActivity.mainViewModel?.gameHost?.currentWindowHandle ?: -1
@JvmStatic @JvmStatic
fun updateProgress(infoPtr: Long, progress: Float) = fun updateProgress(infoPtr: Long, progress: Float) {
MainActivity.mainViewModel?.gameHost?.setProgress( // Get string from native pointer and push into progress overlay
NativeHelpers.instance.getStringJava(infoPtr), val text = NativeHelpers.instance.getStringJava(infoPtr)
progress MainActivity.mainViewModel?.gameHost?.setProgress(text, progress)
) }
/** /**
* Variant A (Pointer → Strings via NativeHelpers). * Variant A (Pointer → Strings via NativeHelpers).
@@ -59,6 +59,13 @@ class MainActivity : BaseActivity() {
} }
mainViewModel?.gameHost?.hideProgressIndicator() mainViewModel?.gameHost?.hideProgressIndicator()
} }
// <<< NEW: is called from the Native/Lib page to set the loading progress
@JvmStatic
fun updateProgress(info: String, percent: Float) {
// Route directly via the GameHost it takes care of the progress states
mainViewModel?.gameHost?.setProgress(info, percent)
}
} }
init { init {
@@ -51,7 +51,6 @@ class UiHandler {
var message: String = "" var message: String = ""
init { init {
// 2.0.3 compatible: no parameters
KenjinxNative.uiHandlerSetup() KenjinxNative.uiHandlerSetup()
} }
@@ -65,8 +64,7 @@ class UiHandler {
newMode: KeyboardMode, newMode: KeyboardMode,
newSubtitle: String, newSubtitle: String,
newInitialText: String newInitialText: String
) ) {
{
title = newTitle title = newTitle
message = newMessage message = newMessage
watermark = newWatermark watermark = newWatermark
@@ -87,13 +85,11 @@ class UiHandler {
val inputListener = remember { inputText } val inputListener = remember { inputText }
val validation = remember { mutableStateOf("") } val validation = remember { mutableStateOf("") }
// Focus & keyboard control so the popup can be typed immediately like in 2.0.3
val focusRequester = remember { FocusRequester() } val focusRequester = remember { FocusRequester() }
val keyboard = LocalSoftwareKeyboardController.current val keyboard = LocalSoftwareKeyboardController.current
LaunchedEffect(showMessageListener.value, type) { LaunchedEffect(showMessageListener.value, type) {
if (showMessageListener.value && type == 2) { if (showMessageListener.value && type == 2) {
// small delay until the dialog is mounted
delay(100) delay(100)
focusRequester.requestFocus() focusRequester.requestFocus()
keyboard?.show() keyboard?.show()
@@ -120,13 +116,9 @@ class UiHandler {
fun submit() { fun submit() {
if (type == 2) { if (type == 2) {
if (inputListener.value.length < minLength || inputListener.value.length > maxLength) if (inputListener.value.length < minLength || inputListener.value.length > maxLength) return
return
} }
KenjinxNative.uiHandlerSetResponse( KenjinxNative.uiHandlerSetResponse(true, if (type == 2) inputListener.value else "")
true,
if (type == 2) inputListener.value else ""
)
showMessageListener.value = false showMessageListener.value = false
} }