From 6a7d129d098353e5f995b23ad6fd30c052e311bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaroslav=20Bene=C5=A1?= Date: Tue, 10 Nov 2026 08:36:03 +0000 Subject: [PATCH] Sheet's busy bar still in previews; new-chat choice and greeting scroll - The assistant sheet's indeterminate progress bar is an endless animation, which kept the screenshot test for "writing" from ever settling (CI run 28 sat in the unit tests). In inspection mode it is a still bar, as Writing() already does for its dots. - Run 27's 360x640 at 1.5x type showed the Chat / Agent chat cards pushing the greeting off the page. The choice and the greeting now share one scroll; on a tall phone the greeting still sits in the middle of what is left. Co-Authored-By: Claude Opus 5.5 --- .../eu/llembas/android/assist/AssistSheet.kt | 4 +- .../eu/llembas/android/ui/chat/ChatScreen.kt | 67 +++++++++++-------- 2 files changed, 41 insertions(+), 30 deletions(-) diff --git a/app/src/main/java/eu/llembas/android/assist/AssistSheet.kt b/app/src/main/java/eu/llembas/android/assist/AssistSheet.kt index 4ba1cae..4db1d55 100644 --- a/app/src/main/java/eu/llembas/android/assist/AssistSheet.kt +++ b/app/src/main/java/eu/llembas/android/assist/AssistSheet.kt @@ -240,7 +240,9 @@ fun ColumnScope.AssistSheetContent( } } if (state.busy) { - LinearProgressIndicator(Modifier.fillMaxWidth().padding(horizontal = 16.dp).height(2.dp)) + val bar = Modifier.fillMaxWidth().padding(horizontal = 16.dp).height(2.dp) + // A preview (the screenshot tests) cannot wait out an endless animation: a still bar there. + if (LocalInspectionMode.current) LinearProgressIndicator(progress = { 0.4f }, modifier = bar) else LinearProgressIndicator(bar) } else { Spacer(Modifier.height(2.dp)) } diff --git a/app/src/main/java/eu/llembas/android/ui/chat/ChatScreen.kt b/app/src/main/java/eu/llembas/android/ui/chat/ChatScreen.kt index 8278a76..fd14a9b 100644 --- a/app/src/main/java/eu/llembas/android/ui/chat/ChatScreen.kt +++ b/app/src/main/java/eu/llembas/android/ui/chat/ChatScreen.kt @@ -10,6 +10,7 @@ import androidx.compose.foundation.gestures.scrollBy import androidx.compose.foundation.horizontalScroll import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.BoxWithConstraints import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.ExperimentalLayoutApi import androidx.compose.foundation.layout.IntrinsicSize @@ -431,39 +432,47 @@ private fun Greeting( modifier: Modifier = Modifier, ) { val palette = LocalPalette.current - Column(modifier.fillMaxSize()) { - if (onKind != null) KindChoice(agent, onKind, Modifier.padding(horizontal = 16.dp, vertical = 8.dp)) - if (agent && state.devices.isEmpty() && !state.loading) { + if (agent && state.devices.isEmpty() && !state.loading) { + Column(modifier.fillMaxSize()) { + if (onKind != null) KindChoice(agent, onKind, Modifier.padding(horizontal = 16.dp, vertical = 8.dp)) LinkComputer(state.instanceBase, onRecheck, Modifier.weight(1f)) - return@Column } - Column( - Modifier.weight(1f).fillMaxWidth().padding(horizontal = 32.dp), - verticalArrangement = Arrangement.Center, - horizontalAlignment = Alignment.CenterHorizontally, - ) { - if (agent) { - Box(Modifier.size(64.dp).background(palette.accentSoft, RoundedCornerShape(20.dp)), contentAlignment = Alignment.Center) { - Icon(Icons.Filled.Terminal, contentDescription = null, tint = palette.accent, modifier = Modifier.size(32.dp)) - } - Spacer(Modifier.height(20.dp)) - Text(stringResource(R.string.agent_greeting), style = MaterialTheme.typography.headlineSmall, textAlign = TextAlign.Center) - Spacer(Modifier.height(8.dp)) - val device = state.device - val where = when { - device == null -> stringResource(R.string.agent_no_device) + return + } + // One scroll for the choice and the greeting, so a small phone at large type still reaches + // both; on a tall one the greeting sits in the middle of what is left. + BoxWithConstraints(modifier.fillMaxSize()) { + val room = maxHeight + Column(Modifier.fillMaxSize().verticalScroll(rememberScrollState())) { + if (onKind != null) KindChoice(agent, onKind, Modifier.padding(horizontal = 16.dp, vertical = 8.dp)) + Column( + Modifier.fillMaxWidth().heightIn(min = room * 0.6f).padding(horizontal = 32.dp, vertical = 16.dp), + verticalArrangement = Arrangement.Center, + horizontalAlignment = Alignment.CenterHorizontally, + ) { + if (agent) { + Box(Modifier.size(64.dp).background(palette.accentSoft, RoundedCornerShape(20.dp)), contentAlignment = Alignment.Center) { + Icon(Icons.Filled.Terminal, contentDescription = null, tint = palette.accent, modifier = Modifier.size(32.dp)) + } + Spacer(Modifier.height(20.dp)) + Text(stringResource(R.string.agent_greeting), style = MaterialTheme.typography.headlineSmall, textAlign = TextAlign.Center) + Spacer(Modifier.height(8.dp)) + val device = state.device + val where = when { + device == null -> stringResource(R.string.agent_no_device) - else -> stringResource( - R.string.agent_runs_on, - device.name.ifBlank { device.host }, - state.draft.directory.ifBlank { stringResource(R.string.agent_directory_default) }, - ) + else -> stringResource( + R.string.agent_runs_on, + device.name.ifBlank { device.host }, + state.draft.directory.ifBlank { stringResource(R.string.agent_directory_default) }, + ) + } + TextButton(onClick = onTune) { Text(where, textAlign = TextAlign.Center, color = palette.inkMuted) } + } else { + ModelAvatar(state.modelInfo, state.modelId ?: "?", size = 64.dp) + Spacer(Modifier.height(20.dp)) + Text(stringResource(R.string.empty_chat), style = MaterialTheme.typography.headlineSmall, textAlign = TextAlign.Center) } - TextButton(onClick = onTune) { Text(where, textAlign = TextAlign.Center, color = palette.inkMuted) } - } else { - ModelAvatar(state.modelInfo, state.modelId ?: "?", size = 64.dp) - Spacer(Modifier.height(20.dp)) - Text(stringResource(R.string.empty_chat), style = MaterialTheme.typography.headlineSmall, textAlign = TextAlign.Center) } } }