Progress line: the clock stays whole when the text is long
CI / check (push) Canceled after 0s

Run 32's 360 dp shot at 1.5x type ellipsised "Waiting for Qwen 27B: it
serves one r…" and lost the elapsed time with it. ProgressStatus draws
the text (two lines, then an ellipsis) and " · 1m 05s" after it, never
cut; the status text as before when there is no progress.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
HomerandClaude Opus 5.5 committed 2026-11-10 09:13:02 +00:00
1 parent 23e3c5431a
commit 3dbfcd5aca
3 files changed
+40 -10

No files matched your search

@@ -88,6 +88,7 @@ import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import eu.llembas.android.R
import eu.llembas.android.ui.ModelAvatar
import eu.llembas.android.ui.ProgressStatus
import eu.llembas.android.ui.chat.Steps
import eu.llembas.android.ui.progressLineOf
import eu.llembas.android.ui.theme.LocalPalette
@@ -471,11 +472,11 @@ private fun Turn(turn: AssistTurn, last: Boolean, state: AssistUiState, actions:
}
if (turn.steps.isNotEmpty()) Steps(turn.steps)
val reply = turn.reply
val statusLine = progressLineOf(reply?.progress) ?: reply?.status.orEmpty()
val drawsProgress = reply != null && (progressLineOf(reply.progress) != null || reply.status.isNotBlank())
when {
reply != null && reply.cards.isNotEmpty() -> TextButton(onClick = onOpenApp) { Text(stringResource(R.string.assist_answer_in_app)) }
turn.writing && statusLine.isNotBlank() -> Text(statusLine, style = MaterialTheme.typography.labelSmall, color = palette.inkFaint)
turn.writing && drawsProgress -> ProgressStatus(reply?.progress, reply?.status.orEmpty(), MaterialTheme.typography.labelSmall, palette.inkFaint)
last && !turn.writing && turn.steps.isNotEmpty() -> Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {
if (state.canSpeak) {
@@ -1,18 +1,26 @@
package eu.llembas.android.ui
import android.content.res.Resources
import androidx.compose.foundation.layout.Row
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableLongStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalConfiguration
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalInspectionMode
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.style.TextOverflow
import eu.llembas.android.R
import eu.llembas.android.api.Progress
import eu.llembas.android.api.ProgressWords
import eu.llembas.android.api.elapsed
import eu.llembas.android.api.progressLine
import eu.llembas.android.api.progressText
import kotlinx.coroutines.delay
@@ -87,3 +95,27 @@ fun progressLineOf(progress: Progress?, withElapsed: Boolean = true): String? {
val now = if (LocalInspectionMode.current) progress.since + STILL_ELAPSED else rememberTick()
return if (withElapsed) progressLine(progress, words, now, locale) else progressText(progress, words, now, locale)
}
/**
* What a reply is doing, one line: the progress text, then `· elapsed` (`progress.line`) kept
* whole at the end while the text gives way (two lines, then an ellipsis) -- on a phone a long
* reason must not push the clock off. [status], the free text, when there is no progress this
* app can draw. Nothing at all when neither says anything.
*/
@Composable
fun ProgressStatus(progress: Progress?, status: String, style: TextStyle, color: Color, modifier: Modifier = Modifier) {
val text = progressLineOf(progress, withElapsed = false)
if (text == null) {
if (status.isNotBlank()) Text(status, style = style, color = color, maxLines = 1, overflow = TextOverflow.Ellipsis, modifier = modifier)
return
}
val clock = progress?.takeUnless { it.phase in Progress.NO_ELAPSED }?.let { p ->
val now = if (LocalInspectionMode.current) p.since + STILL_ELAPSED else rememberTick()
elapsed(now - p.since)
}
Row(modifier, verticalAlignment = Alignment.Top) {
Text(text, style = style, color = color, maxLines = 2, overflow = TextOverflow.Ellipsis, modifier = Modifier.weight(1f, fill = false))
// The spec's separator, `progress.line`'s " · ", before the clock.
if (clock != null) Text(" · $clock", style = style, color = color, maxLines = 1, softWrap = false)
}
}
@@ -92,7 +92,7 @@ import eu.llembas.android.R
import eu.llembas.android.api.Message
import eu.llembas.android.api.ShowCard
import eu.llembas.android.ui.ModelAvatar
import eu.llembas.android.ui.progressLineOf
import eu.llembas.android.ui.ProgressStatus
import eu.llembas.android.ui.theme.LocalPalette
import eu.llembas.android.ui.viewer.FileViewer
import kotlinx.coroutines.launch
@@ -288,15 +288,12 @@ fun ChatContent(
}
}
// The 3.4.0 progress line, ticking; the free status text from an older server.
val progressLine = progressLineOf(live?.progress)
val statusLine = progressLine ?: live?.status.orEmpty()
if (live != null && statusLine.isNotBlank()) {
Text(
statusLine,
if (live != null) {
ProgressStatus(
live.progress,
live.status,
style = MaterialTheme.typography.labelSmall,
color = palette.inkFaint,
maxLines = 1,
overflow = TextOverflow.Ellipsis,
modifier = Modifier.padding(horizontal = 8.dp, vertical = 2.dp),
)
}