mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-18 12:28:40 +00:00
Replace process gate dialogs with compact pages
This commit is contained in:
1 parent
62ce42947a
commit
e31885441d
2 files changed
+69
-33
No files matched your search
@@ -2,6 +2,7 @@ package com.droiddeck.launcher.ui
|
||||
|
||||
import androidx.activity.compose.BackHandler
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.BoxWithConstraints
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
@@ -10,6 +11,7 @@ import androidx.compose.foundation.layout.widthIn
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.text.font.FontFamily
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.droiddeck.launcher.core.PhantomProcessLimit
|
||||
@@ -30,46 +32,73 @@ fun PhantomProcessGatePage(
|
||||
host = rememberMenuHost(),
|
||||
title = "Steam cannot start yet",
|
||||
eyebrow = "Steam",
|
||||
lede = PhantomProcessLimit.title(status),
|
||||
lede = "${PhantomProcessLimit.title(status)} · checking again every two seconds",
|
||||
onBack = onDismiss,
|
||||
scrollContent = false,
|
||||
) {
|
||||
Column(
|
||||
modifier = Modifier.widthIn(max = 720.dp).fillMaxWidth(),
|
||||
verticalArrangement = Arrangement.spacedBy(14.dp),
|
||||
) {
|
||||
SettingsGroup("What to change") {
|
||||
Text(
|
||||
PhantomProcessLimit.gateInstructions(status),
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
modifier = Modifier.padding(14.dp),
|
||||
)
|
||||
}
|
||||
SettingsGroup("Computer ADB fallback") {
|
||||
Column(
|
||||
modifier = Modifier.fillMaxWidth().padding(14.dp),
|
||||
verticalArrangement = Arrangement.spacedBy(8.dp),
|
||||
) {
|
||||
Text(
|
||||
"If you cannot find the setting in Developer options, connect this device to a computer with ADB and run:",
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
)
|
||||
Text(PhantomProcessLimit.ADB_COMMAND, style = MaterialTheme.typography.bodySmall)
|
||||
SecondaryButton("Copy ADB command", onClick = onCopyCommand)
|
||||
BoxWithConstraints(Modifier.fillMaxWidth()) {
|
||||
val wide = maxWidth >= 620.dp
|
||||
Column(
|
||||
modifier = Modifier.widthIn(max = 900.dp).fillMaxWidth(),
|
||||
verticalArrangement = Arrangement.spacedBy(10.dp),
|
||||
) {
|
||||
if (wide) {
|
||||
Row(horizontalArrangement = Arrangement.spacedBy(14.dp), modifier = Modifier.fillMaxWidth()) {
|
||||
Column(Modifier.weight(1f)) { GateInstructions(status) }
|
||||
Column(Modifier.weight(1f)) { AdbFallback(onCopyCommand) }
|
||||
}
|
||||
Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||
PrimaryButton("Fix over Wi-Fi", onClick = onFixOverWifi)
|
||||
SecondaryButton("Developer options", onClick = onOpenDeveloperOptions)
|
||||
SecondaryButton("Check again", onClick = onRefresh)
|
||||
SecondaryButton("Not now", onClick = onDismiss)
|
||||
}
|
||||
} else {
|
||||
GateInstructions(status)
|
||||
AdbFallback(onCopyCommand)
|
||||
Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||
PrimaryButton("Fix over Wi-Fi", onClick = onFixOverWifi)
|
||||
SecondaryButton("Developer options", onClick = onOpenDeveloperOptions)
|
||||
}
|
||||
Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||
SecondaryButton("Check again", onClick = onRefresh)
|
||||
SecondaryButton("Not now", onClick = onDismiss)
|
||||
}
|
||||
}
|
||||
}
|
||||
Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||
PrimaryButton("Fix over Wi-Fi", onClick = onFixOverWifi)
|
||||
SecondaryButton("Developer options", onClick = onOpenDeveloperOptions)
|
||||
}
|
||||
Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||
SecondaryButton("Check again", onClick = onRefresh)
|
||||
SecondaryButton("Not now", onClick = onDismiss)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun GateInstructions(status: PhantomProcessStatus) {
|
||||
SettingsGroup("What to change") {
|
||||
Text(
|
||||
PhantomProcessLimit.gateInstructions(status),
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
modifier = Modifier.padding(14.dp),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun AdbFallback(onCopyCommand: () -> Unit) {
|
||||
SettingsGroup("Computer ADB fallback") {
|
||||
Column(
|
||||
modifier = Modifier.fillMaxWidth().padding(14.dp),
|
||||
verticalArrangement = Arrangement.spacedBy(8.dp),
|
||||
) {
|
||||
Text(
|
||||
"DroidDeck checks this setting again automatically every two seconds.",
|
||||
"If you cannot find the setting in Developer options, connect this device to a computer with ADB and run:",
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
style = MaterialTheme.typography.bodySmall,
|
||||
)
|
||||
Text(
|
||||
PhantomProcessLimit.ADB_COMMAND,
|
||||
style = MaterialTheme.typography.bodySmall.copy(fontFamily = FontFamily.Monospace),
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
)
|
||||
SecondaryButton("Copy ADB command", onClick = onCopyCommand)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -332,6 +332,7 @@ fun SettingsPage(
|
||||
action: (@Composable () -> Unit)? = null,
|
||||
/** Pass one held above the page to keep its scroll position across a page opened over it. */
|
||||
scroll: androidx.compose.foundation.ScrollState? = null,
|
||||
scrollContent: Boolean = true,
|
||||
content: @Composable ColumnScope.() -> Unit,
|
||||
) {
|
||||
val scrollState = scroll ?: rememberScrollState()
|
||||
@@ -365,7 +366,13 @@ fun SettingsPage(
|
||||
}
|
||||
if (lede != null) Rise(2) { Lede(lede) }
|
||||
Rise(3, Modifier.weight(1f).fillMaxWidth()) {
|
||||
Column(modifier = Modifier.fillMaxSize().graphicsLayer { alpha = dim }.verticalScroll(scrollState).padding(bottom = 24.dp)) { content() }
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.graphicsLayer { alpha = dim }
|
||||
.then(if (scrollContent) Modifier.verticalScroll(scrollState) else Modifier)
|
||||
.padding(bottom = 24.dp),
|
||||
) { content() }
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user