mirror of
https://github.com/kvorschk/Magisk.git
synced 2026-12-04 19:10:47 -05:00
Fix dialogs being overlapped by floating navigation bar
Move MiuixPopupHost to a top-level Box in MainActivity so dialogs
render above all content including the floating nav bar. Disable
individual popup hosts in all 9 screen Scaffolds (popupHost = {})
to prevent duplicate rendering at a lower z-level.
Made-with: Cursor
This commit is contained in:
@@ -56,6 +56,10 @@ import com.topjohnwu.magisk.ui.theme.Theme
|
||||
import com.topjohnwu.magisk.view.MagiskDialog
|
||||
import com.topjohnwu.magisk.view.MagiskDialogHost
|
||||
import com.topjohnwu.magisk.view.Shortcuts
|
||||
import top.yukonga.miuix.kmp.utils.MiuixPopupUtils.Companion.MiuixPopupHost
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.ui.Modifier
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlinx.coroutines.launch
|
||||
import androidx.compose.runtime.Composable
|
||||
@@ -102,59 +106,62 @@ class MainActivity : UIActivity(), SplashScreenHost {
|
||||
|
||||
setContent {
|
||||
MagiskTheme {
|
||||
MagiskDialogHost()
|
||||
val navigator = rememberNavigator(Route.Main)
|
||||
CompositionLocalProvider(LocalNavigator provides navigator) {
|
||||
HandleFlashIntent(navigator)
|
||||
Box(modifier = Modifier.fillMaxSize()) {
|
||||
val navigator = rememberNavigator(Route.Main)
|
||||
CompositionLocalProvider(LocalNavigator provides navigator) {
|
||||
HandleFlashIntent(navigator)
|
||||
|
||||
NavDisplay(
|
||||
backStack = navigator.backStack,
|
||||
onBack = { navigator.pop() },
|
||||
entryDecorators = listOf(
|
||||
rememberSaveableStateHolderNavEntryDecorator(),
|
||||
rememberViewModelStoreNavEntryDecorator()
|
||||
),
|
||||
entryProvider = entryProvider {
|
||||
entry<Route.Main> {
|
||||
MainScreen(initialTab = initialTab)
|
||||
}
|
||||
entry<Route.Install> { _ ->
|
||||
val vm: InstallViewModel = androidx.lifecycle.viewmodel.compose.viewModel(factory = VMFactory)
|
||||
ObserveViewEvents(vm)
|
||||
CollectNavEvents(vm, navigator)
|
||||
InstallScreen(vm, onBack = { navigator.pop() })
|
||||
}
|
||||
entry<Route.DenyList> { _ ->
|
||||
val vm: DenyListViewModel = androidx.lifecycle.viewmodel.compose.viewModel(factory = VMFactory)
|
||||
ObserveViewEvents(vm)
|
||||
DenyListScreen(vm, onBack = { navigator.pop() })
|
||||
}
|
||||
entry<Route.Flash> { key ->
|
||||
val vm: FlashViewModel = androidx.lifecycle.viewmodel.compose.viewModel(factory = VMFactory)
|
||||
LaunchedEffect(key) {
|
||||
if (vm.flashAction.isEmpty()) {
|
||||
vm.flashAction = key.action
|
||||
vm.flashUri = key.additionalData?.let { Uri.parse(it) }
|
||||
vm.startFlashing()
|
||||
}
|
||||
NavDisplay(
|
||||
backStack = navigator.backStack,
|
||||
onBack = { navigator.pop() },
|
||||
entryDecorators = listOf(
|
||||
rememberSaveableStateHolderNavEntryDecorator(),
|
||||
rememberViewModelStoreNavEntryDecorator()
|
||||
),
|
||||
entryProvider = entryProvider {
|
||||
entry<Route.Main> {
|
||||
MainScreen(initialTab = initialTab)
|
||||
}
|
||||
ObserveViewEvents(vm)
|
||||
FlashScreen(vm, onBack = { navigator.pop() })
|
||||
}
|
||||
entry<Route.Action> { key ->
|
||||
val vm: ActionViewModel = androidx.lifecycle.viewmodel.compose.viewModel(factory = VMFactory)
|
||||
LaunchedEffect(key) {
|
||||
if (vm.actionId.isEmpty()) {
|
||||
vm.actionId = key.id
|
||||
vm.actionName = key.name
|
||||
vm.startRunAction()
|
||||
entry<Route.Install> { _ ->
|
||||
val vm: InstallViewModel = androidx.lifecycle.viewmodel.compose.viewModel(factory = VMFactory)
|
||||
ObserveViewEvents(vm)
|
||||
CollectNavEvents(vm, navigator)
|
||||
InstallScreen(vm, onBack = { navigator.pop() })
|
||||
}
|
||||
entry<Route.DenyList> { _ ->
|
||||
val vm: DenyListViewModel = androidx.lifecycle.viewmodel.compose.viewModel(factory = VMFactory)
|
||||
ObserveViewEvents(vm)
|
||||
DenyListScreen(vm, onBack = { navigator.pop() })
|
||||
}
|
||||
entry<Route.Flash> { key ->
|
||||
val vm: FlashViewModel = androidx.lifecycle.viewmodel.compose.viewModel(factory = VMFactory)
|
||||
LaunchedEffect(key) {
|
||||
if (vm.flashAction.isEmpty()) {
|
||||
vm.flashAction = key.action
|
||||
vm.flashUri = key.additionalData?.let { Uri.parse(it) }
|
||||
vm.startFlashing()
|
||||
}
|
||||
}
|
||||
ObserveViewEvents(vm)
|
||||
FlashScreen(vm, onBack = { navigator.pop() })
|
||||
}
|
||||
entry<Route.Action> { key ->
|
||||
val vm: ActionViewModel = androidx.lifecycle.viewmodel.compose.viewModel(factory = VMFactory)
|
||||
LaunchedEffect(key) {
|
||||
if (vm.actionId.isEmpty()) {
|
||||
vm.actionId = key.id
|
||||
vm.actionName = key.name
|
||||
vm.startRunAction()
|
||||
}
|
||||
}
|
||||
ObserveViewEvents(vm)
|
||||
ActionScreen(vm, actionName = key.name, onBack = { navigator.pop() })
|
||||
}
|
||||
ObserveViewEvents(vm)
|
||||
ActionScreen(vm, actionName = key.name, onBack = { navigator.pop() })
|
||||
}
|
||||
}
|
||||
)
|
||||
)
|
||||
}
|
||||
MagiskDialogHost()
|
||||
MiuixPopupHost()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,7 +69,8 @@ fun DenyListScreen(viewModel: DenyListViewModel, onBack: () -> Unit) {
|
||||
},
|
||||
scrollBehavior = scrollBehavior
|
||||
)
|
||||
}
|
||||
},
|
||||
popupHost = { }
|
||||
) { padding ->
|
||||
Column(modifier = Modifier.fillMaxSize().padding(padding)) {
|
||||
SearchInput(
|
||||
|
||||
@@ -70,7 +70,8 @@ fun FlashScreen(viewModel: FlashViewModel, onBack: () -> Unit) {
|
||||
},
|
||||
scrollBehavior = scrollBehavior
|
||||
)
|
||||
}
|
||||
},
|
||||
popupHost = { }
|
||||
) { padding ->
|
||||
Box(modifier = Modifier.fillMaxSize().padding(padding)) {
|
||||
LazyColumn(
|
||||
|
||||
@@ -53,7 +53,8 @@ fun HomeScreen(viewModel: HomeViewModel) {
|
||||
title = stringResource(CoreR.string.section_home),
|
||||
scrollBehavior = scrollBehavior
|
||||
)
|
||||
}
|
||||
},
|
||||
popupHost = { }
|
||||
) { padding ->
|
||||
Column(
|
||||
modifier = Modifier
|
||||
|
||||
@@ -57,7 +57,8 @@ fun InstallScreen(viewModel: InstallViewModel, onBack: () -> Unit) {
|
||||
},
|
||||
scrollBehavior = scrollBehavior
|
||||
)
|
||||
}
|
||||
},
|
||||
popupHost = { }
|
||||
) { padding ->
|
||||
Column(
|
||||
modifier = Modifier
|
||||
|
||||
@@ -68,7 +68,8 @@ fun LogScreen(viewModel: LogViewModel) {
|
||||
title = stringResource(CoreR.string.logs),
|
||||
scrollBehavior = scrollBehavior
|
||||
)
|
||||
}
|
||||
},
|
||||
popupHost = { }
|
||||
) { padding ->
|
||||
Column(modifier = Modifier
|
||||
.fillMaxSize()
|
||||
|
||||
@@ -63,7 +63,8 @@ fun ActionScreen(viewModel: ActionViewModel, actionName: String, onBack: () -> U
|
||||
},
|
||||
scrollBehavior = scrollBehavior
|
||||
)
|
||||
}
|
||||
},
|
||||
popupHost = { }
|
||||
) { padding ->
|
||||
Box(modifier = Modifier.fillMaxSize().padding(padding)) {
|
||||
LazyColumn(
|
||||
|
||||
@@ -44,7 +44,8 @@ fun ModuleScreen(viewModel: ModuleViewModel) {
|
||||
title = stringResource(CoreR.string.modules),
|
||||
scrollBehavior = scrollBehavior
|
||||
)
|
||||
}
|
||||
},
|
||||
popupHost = { }
|
||||
) { padding ->
|
||||
if (uiState.loading) {
|
||||
Box(
|
||||
|
||||
@@ -56,7 +56,8 @@ fun SettingsScreen(viewModel: SettingsViewModel) {
|
||||
title = stringResource(CoreR.string.settings),
|
||||
scrollBehavior = scrollBehavior
|
||||
)
|
||||
}
|
||||
},
|
||||
popupHost = { }
|
||||
) { padding ->
|
||||
Column(
|
||||
modifier = Modifier
|
||||
|
||||
@@ -52,7 +52,8 @@ fun SuperuserScreen(viewModel: SuperuserViewModel) {
|
||||
title = stringResource(CoreR.string.superuser),
|
||||
scrollBehavior = scrollBehavior
|
||||
)
|
||||
}
|
||||
},
|
||||
popupHost = { }
|
||||
) { padding ->
|
||||
if (uiState.loading) {
|
||||
Box(
|
||||
|
||||
Reference in New Issue
Block a user