manager: Update secondary interface status and optimize WebView interface
This commit is contained in:
@@ -61,6 +61,12 @@ fun WebUIXTheme(
|
||||
ThemeConfig.backgroundImageLoaded = false
|
||||
}
|
||||
}
|
||||
|
||||
// 更新二级界面状态
|
||||
LaunchedEffect(isSecondaryScreen) {
|
||||
WebViewInterface.updateSecondaryScreenState(isSecondaryScreen)
|
||||
}
|
||||
|
||||
val colorScheme = when {
|
||||
dynamicColor && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> {
|
||||
if (darkTheme) {
|
||||
@@ -235,14 +241,6 @@ fun WebUIXTheme(
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前界面是否为二级界面
|
||||
*/
|
||||
@Composable
|
||||
fun isSecondaryScreen(): Boolean {
|
||||
return LocalIsSecondaryScreen.current
|
||||
}
|
||||
|
||||
/**
|
||||
* 配置WebUI的系统栏样式
|
||||
*/
|
||||
|
||||
@@ -7,6 +7,9 @@ import android.text.TextUtils
|
||||
import android.view.Window
|
||||
import android.webkit.JavascriptInterface
|
||||
import android.widget.Toast
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.core.view.WindowInsetsCompat
|
||||
import androidx.core.view.WindowInsetsControllerCompat
|
||||
import com.dergoogler.mmrl.webui.interfaces.WXOptions
|
||||
@@ -24,7 +27,6 @@ import com.sukisu.ultra.ui.util.controlKpmModule
|
||||
import com.sukisu.ultra.ui.util.listKpmModules
|
||||
import java.io.File
|
||||
import java.util.concurrent.CompletableFuture
|
||||
import androidx.compose.runtime.Composable
|
||||
|
||||
class WebViewInterface(
|
||||
wxOptions: WXOptions,
|
||||
@@ -32,15 +34,20 @@ class WebViewInterface(
|
||||
override var name: String = "ksu"
|
||||
|
||||
companion object {
|
||||
private var isSecondaryScreenState by mutableStateOf(false)
|
||||
|
||||
fun factory() = JavaScriptInterface(WebViewInterface::class.java)
|
||||
|
||||
fun updateSecondaryScreenState(isSecondary: Boolean) {
|
||||
isSecondaryScreenState = isSecondary
|
||||
}
|
||||
}
|
||||
|
||||
private val modDir get() = "/data/adb/modules/${modId.id}"
|
||||
|
||||
@Composable
|
||||
@JavascriptInterface
|
||||
fun isSecondaryPage(): Boolean {
|
||||
return isSecondaryScreen()
|
||||
return isSecondaryScreenState
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
|
||||
Reference in New Issue
Block a user