Restore detail navigation behavior
This commit is contained in:
1 parent
3ebcf9761b
commit
6543f83b3a
8 files changed
+104
-50
No files matched your search
+9
@@ -0,0 +1,9 @@
|
|||||||
|
package cn.xiaobai.openclawapp.platform
|
||||||
|
|
||||||
|
import androidx.activity.compose.BackHandler
|
||||||
|
import androidx.compose.runtime.Composable
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
actual fun PlatformBackHandler(enabled: Boolean, onBack: () -> Unit) {
|
||||||
|
BackHandler(enabled = enabled, onBack = onBack)
|
||||||
|
}
|
||||||
@@ -170,6 +170,7 @@ private fun OpenClawRoot(appState: OpenClawAppState) {
|
|||||||
when {
|
when {
|
||||||
activeSession != null -> ChatScreen(
|
activeSession != null -> ChatScreen(
|
||||||
modifier = Modifier.fillMaxSize(),
|
modifier = Modifier.fillMaxSize(),
|
||||||
|
sessionTitle = activeSession.title,
|
||||||
messages = appState.repository.messagesFor(activeSession.id),
|
messages = appState.repository.messagesFor(activeSession.id),
|
||||||
isSending = appState.sendingSessionId == activeSession.id,
|
isSending = appState.sendingSessionId == activeSession.id,
|
||||||
isLoading = appState.isSyncing,
|
isLoading = appState.isSyncing,
|
||||||
|
|||||||
+69
-50
@@ -38,6 +38,7 @@ import cn.xiaobai.openclawapp.data.LocalMessagePhase
|
|||||||
import cn.xiaobai.openclawapp.data.MessageKind
|
import cn.xiaobai.openclawapp.data.MessageKind
|
||||||
import cn.xiaobai.openclawapp.data.MessageRole
|
import cn.xiaobai.openclawapp.data.MessageRole
|
||||||
import cn.xiaobai.openclawapp.data.localMessagePhase
|
import cn.xiaobai.openclawapp.data.localMessagePhase
|
||||||
|
import cn.xiaobai.openclawapp.platform.PlatformBackHandler
|
||||||
import cn.xiaobai.openclawapp.ui.EmptyStateCard
|
import cn.xiaobai.openclawapp.ui.EmptyStateCard
|
||||||
import cn.xiaobai.openclawapp.ui.StatusPill
|
import cn.xiaobai.openclawapp.ui.StatusPill
|
||||||
import cn.xiaobai.openclawapp.ui.StatusPillTone
|
import cn.xiaobai.openclawapp.ui.StatusPillTone
|
||||||
@@ -46,6 +47,7 @@ import kotlinx.coroutines.delay
|
|||||||
@Composable
|
@Composable
|
||||||
fun ChatScreen(
|
fun ChatScreen(
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
|
sessionTitle: String,
|
||||||
messages: List<ChatMessage>,
|
messages: List<ChatMessage>,
|
||||||
isSending: Boolean,
|
isSending: Boolean,
|
||||||
isLoading: Boolean,
|
isLoading: Boolean,
|
||||||
@@ -63,6 +65,8 @@ fun ChatScreen(
|
|||||||
onOpenAttachment: (String) -> Unit,
|
onOpenAttachment: (String) -> Unit,
|
||||||
onDownloadAttachment: (String) -> Unit,
|
onDownloadAttachment: (String) -> Unit,
|
||||||
) {
|
) {
|
||||||
|
PlatformBackHandler(onBack = onBack)
|
||||||
|
|
||||||
var input by remember { mutableStateOf("") }
|
var input by remember { mutableStateOf("") }
|
||||||
val listState = rememberLazyListState()
|
val listState = rememberLazyListState()
|
||||||
|
|
||||||
@@ -88,6 +92,7 @@ fun ChatScreen(
|
|||||||
verticalArrangement = Arrangement.spacedBy(12.dp),
|
verticalArrangement = Arrangement.spacedBy(12.dp),
|
||||||
) {
|
) {
|
||||||
ChatHeader(
|
ChatHeader(
|
||||||
|
sessionTitle = sessionTitle,
|
||||||
topStatus = topStatus,
|
topStatus = topStatus,
|
||||||
onBack = onBack,
|
onBack = onBack,
|
||||||
onRetry = onRetry,
|
onRetry = onRetry,
|
||||||
@@ -265,74 +270,88 @@ private fun buildChatTopStatus(
|
|||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun ChatHeader(
|
private fun ChatHeader(
|
||||||
|
sessionTitle: String,
|
||||||
topStatus: ChatTopStatus,
|
topStatus: ChatTopStatus,
|
||||||
onBack: () -> Unit,
|
onBack: () -> Unit,
|
||||||
onRetry: () -> Unit,
|
onRetry: () -> Unit,
|
||||||
onSendAttachmentStub: () -> Unit,
|
onSendAttachmentStub: () -> Unit,
|
||||||
) {
|
) {
|
||||||
Column(
|
Card(
|
||||||
modifier = Modifier.fillMaxWidth(),
|
modifier = Modifier.fillMaxWidth(),
|
||||||
verticalArrangement = Arrangement.spacedBy(8.dp),
|
colors = CardDefaults.cardColors(
|
||||||
|
containerColor = MaterialTheme.colorScheme.surfaceContainerLow,
|
||||||
|
),
|
||||||
) {
|
) {
|
||||||
Row(
|
Column(
|
||||||
modifier = Modifier.fillMaxWidth(),
|
modifier = Modifier
|
||||||
horizontalArrangement = Arrangement.spacedBy(8.dp),
|
.fillMaxWidth()
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
.padding(12.dp),
|
||||||
) {
|
verticalArrangement = Arrangement.spacedBy(10.dp),
|
||||||
TextButton(onClick = onBack) { Text("返回") }
|
|
||||||
TextButton(onClick = onRetry) {
|
|
||||||
Text(topStatus.actionLabel)
|
|
||||||
}
|
|
||||||
TextButton(onClick = onSendAttachmentStub) {
|
|
||||||
Text("附件")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Card(
|
|
||||||
modifier = Modifier.fillMaxWidth(),
|
|
||||||
colors = CardDefaults.cardColors(
|
|
||||||
containerColor = when (topStatus.tone) {
|
|
||||||
StatusPillTone.Error -> MaterialTheme.colorScheme.errorContainer
|
|
||||||
StatusPillTone.Warning -> MaterialTheme.colorScheme.tertiaryContainer.copy(alpha = 0.55f)
|
|
||||||
StatusPillTone.Success -> MaterialTheme.colorScheme.secondaryContainer.copy(alpha = 0.55f)
|
|
||||||
StatusPillTone.Info -> MaterialTheme.colorScheme.primaryContainer.copy(alpha = 0.5f)
|
|
||||||
StatusPillTone.Neutral -> MaterialTheme.colorScheme.surfaceContainerHigh
|
|
||||||
},
|
|
||||||
),
|
|
||||||
) {
|
) {
|
||||||
Row(
|
Row(
|
||||||
modifier = Modifier
|
modifier = Modifier.fillMaxWidth(),
|
||||||
.fillMaxWidth()
|
horizontalArrangement = Arrangement.spacedBy(12.dp),
|
||||||
.padding(horizontal = 12.dp, vertical = 10.dp),
|
|
||||||
horizontalArrangement = Arrangement.spacedBy(10.dp),
|
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
) {
|
) {
|
||||||
StatusPill(
|
TextButton(onClick = onBack) { Text("返回") }
|
||||||
text = when (topStatus.tone) {
|
|
||||||
StatusPillTone.Error -> "需处理"
|
|
||||||
StatusPillTone.Warning -> "处理中"
|
|
||||||
StatusPillTone.Success -> "在线"
|
|
||||||
StatusPillTone.Info -> "同步中"
|
|
||||||
StatusPillTone.Neutral -> "提示"
|
|
||||||
},
|
|
||||||
tone = topStatus.tone,
|
|
||||||
)
|
|
||||||
Text(
|
Text(
|
||||||
text = topStatus.text,
|
text = sessionTitle,
|
||||||
style = MaterialTheme.typography.bodySmall,
|
|
||||||
color = when (topStatus.tone) {
|
|
||||||
StatusPillTone.Error -> MaterialTheme.colorScheme.onErrorContainer
|
|
||||||
StatusPillTone.Warning -> MaterialTheme.colorScheme.onTertiaryContainer
|
|
||||||
StatusPillTone.Success -> MaterialTheme.colorScheme.onSecondaryContainer
|
|
||||||
StatusPillTone.Info -> MaterialTheme.colorScheme.onPrimaryContainer
|
|
||||||
StatusPillTone.Neutral -> MaterialTheme.colorScheme.onSurfaceVariant
|
|
||||||
},
|
|
||||||
modifier = Modifier.weight(1f),
|
modifier = Modifier.weight(1f),
|
||||||
|
style = MaterialTheme.typography.titleMedium,
|
||||||
|
maxLines = 1,
|
||||||
|
overflow = TextOverflow.Ellipsis,
|
||||||
)
|
)
|
||||||
|
TextButton(onClick = onSendAttachmentStub) {
|
||||||
|
Text("附件")
|
||||||
|
}
|
||||||
TextButton(onClick = onRetry) {
|
TextButton(onClick = onRetry) {
|
||||||
Text(topStatus.actionLabel)
|
Text(topStatus.actionLabel)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Card(
|
||||||
|
modifier = Modifier.fillMaxWidth(),
|
||||||
|
colors = CardDefaults.cardColors(
|
||||||
|
containerColor = when (topStatus.tone) {
|
||||||
|
StatusPillTone.Error -> MaterialTheme.colorScheme.errorContainer
|
||||||
|
StatusPillTone.Warning -> MaterialTheme.colorScheme.tertiaryContainer.copy(alpha = 0.55f)
|
||||||
|
StatusPillTone.Success -> MaterialTheme.colorScheme.secondaryContainer.copy(alpha = 0.55f)
|
||||||
|
StatusPillTone.Info -> MaterialTheme.colorScheme.primaryContainer.copy(alpha = 0.5f)
|
||||||
|
StatusPillTone.Neutral -> MaterialTheme.colorScheme.surfaceContainerHigh
|
||||||
|
},
|
||||||
|
),
|
||||||
|
) {
|
||||||
|
Row(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.padding(horizontal = 12.dp, vertical = 10.dp),
|
||||||
|
horizontalArrangement = Arrangement.spacedBy(10.dp),
|
||||||
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
|
) {
|
||||||
|
StatusPill(
|
||||||
|
text = when (topStatus.tone) {
|
||||||
|
StatusPillTone.Error -> "需处理"
|
||||||
|
StatusPillTone.Warning -> "处理中"
|
||||||
|
StatusPillTone.Success -> "在线"
|
||||||
|
StatusPillTone.Info -> "同步中"
|
||||||
|
StatusPillTone.Neutral -> "提示"
|
||||||
|
},
|
||||||
|
tone = topStatus.tone,
|
||||||
|
)
|
||||||
|
Text(
|
||||||
|
text = topStatus.text,
|
||||||
|
style = MaterialTheme.typography.bodySmall,
|
||||||
|
color = when (topStatus.tone) {
|
||||||
|
StatusPillTone.Error -> MaterialTheme.colorScheme.onErrorContainer
|
||||||
|
StatusPillTone.Warning -> MaterialTheme.colorScheme.onTertiaryContainer
|
||||||
|
StatusPillTone.Success -> MaterialTheme.colorScheme.onSecondaryContainer
|
||||||
|
StatusPillTone.Info -> MaterialTheme.colorScheme.onPrimaryContainer
|
||||||
|
StatusPillTone.Neutral -> MaterialTheme.colorScheme.onSurfaceVariant
|
||||||
|
},
|
||||||
|
modifier = Modifier.weight(1f),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
package cn.xiaobai.openclawapp.platform
|
||||||
|
|
||||||
|
import androidx.compose.runtime.Composable
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
expect fun PlatformBackHandler(enabled: Boolean = true, onBack: () -> Unit)
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
package cn.xiaobai.openclawapp.platform
|
||||||
|
|
||||||
|
import androidx.compose.runtime.Composable
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
actual fun PlatformBackHandler(enabled: Boolean, onBack: () -> Unit) = Unit
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
package cn.xiaobai.openclawapp.platform
|
||||||
|
|
||||||
|
import androidx.compose.runtime.Composable
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
actual fun PlatformBackHandler(enabled: Boolean, onBack: () -> Unit) = Unit
|
||||||
+6
@@ -0,0 +1,6 @@
|
|||||||
|
package cn.xiaobai.openclawapp.platform
|
||||||
|
|
||||||
|
import androidx.compose.runtime.Composable
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
actual fun PlatformBackHandler(enabled: Boolean, onBack: () -> Unit) = Unit
|
||||||
@@ -438,3 +438,4 @@ Android/iOS App
|
|||||||
- 2026-03-07:应用壳层继续减法:去掉全局顶部标题栏,避免在会话/状态/设置页上方长期占一条大高度却只重复页面标题;当前页面改为直接从内容区进入,聊天页只保留内部轻量返回/动作条。
|
- 2026-03-07:应用壳层继续减法:去掉全局顶部标题栏,避免在会话/状态/设置页上方长期占一条大高度却只重复页面标题;当前页面改为直接从内容区进入,聊天页只保留内部轻量返回/动作条。
|
||||||
- 2026-03-07:设置页重做为分组式连接中心:移除 HeroCard 式说明块,改成“连接与账号 / 默认 Agent / 外观 / 诊断信息”四组,减少说明书感,重点回到用户真正能查看和切换的配置项。
|
- 2026-03-07:设置页重做为分组式连接中心:移除 HeroCard 式说明块,改成“连接与账号 / 默认 Agent / 外观 / 诊断信息”四组,减少说明书感,重点回到用户真正能查看和切换的配置项。
|
||||||
- 2026-03-07:顺手把状态页头部也收轻:去掉大 HeroCard,改为直接标题 + 指标卡 + 详情卡,避免多个页面同时维持两套厚重的页头语言。
|
- 2026-03-07:顺手把状态页头部也收轻:去掉大 HeroCard,改为直接标题 + 指标卡 + 详情卡,避免多个页面同时维持两套厚重的页头语言。
|
||||||
|
- 2026-03-07:补了一轮真正的详情页导航语义:聊天详情页重新加回明确的顶部导航头(返回 / 标题 / 附件 / 刷新),不再只是内容区里塞一个“返回”按钮;同时抽了一个轻量 `PlatformBackHandler`,先在 Android 接上系统返回,让详情页能正常退回首页/列表。
|
||||||
Reference in new issue
Block a user