android: stand the destination pill down in an open chat conversation

The floating destinations pill was drawn over the bottom of every screen,
including an open chat, where it sat on the composer and the newest message
and competed with the send/stop controls. It now stands down while the Chat
destination shows an open conversation and stays everywhere else, unchanged.

- One rule: `destinationPillVisible(currentRoute, conversationOpen)` is false
  only for `chat` with an open conversation. `conversationOpen` is the new
  `AppViewModel.conversationOpen`, a distinctUntilChanged boolean derived from
  the same ChatStore the chat surface renders, so a background chat never hides
  the pill elsewhere and a streamed delta never recomposes the app shell.
- The space, not just the pill: `destinationPillReserve(pillVisible)` returns
  the named DESTINATION_PILL_RESERVE while drawn and 0.dp while hidden, so the
  content Column clears a drawn pill and leaves no empty band when it is gone,
  and no frame reserves a gap behind a hidden pill or draws one over content it
  does not clear. Keyboard-open and the IME padding are unchanged.
- Escapability untouched: the top-bar "Back to chats" arrow, ChatScreen's
  PredictiveBackHandler and SlidingPaneStack.onPopTo remain the way out.
- No other pill behaviour changed: destinations, selection indicator,
  morph-into-search and every other screen are as before.

Checked for staleness: none of the packaged templates or the packaged authoring
skill references (internal/author/skill/references) mention the destination pill,
so no template or reference needed updating for this Android-only change.

Tests: PipelinesNavTest gains thePillStandsDownOnlyWhileAConversationIsOpen and
theReserveTracksTheDrawnPillSoContentNeitherJumpsNorLeavesAGap.
This commit is contained in:
2026-10-17 16:25:22 +01:00
parent 890d267c71
commit 3e14baebd7
4 changed files with 168 additions and 16 deletions
+59
View File
@@ -6010,3 +6010,62 @@ and the phone's own notification — the brief keeps ordinary code review to the
build and the unit tests, and visual review owns the operator's Pixel 9 Pro XL.
The concrete payload delivered to the local ntfy service was reproduced by the
code review with a live curl subscriber; the device captures are visual review's.
## Destination pill stands down in an open conversation (17 Oct 2026)
The floating destinations pill was drawn over the bottom of every screen,
including an open chat, where it sat on the composer and the newest message and
competed with the send/stop controls. It now stands down while the Chat
destination is showing an open conversation and stays everywhere else,
unchanged. `android/` only; no new dependency, no run started from the app, no
server/installer/Docker file touched, and the operator's Pixel was never used.
- **One rule.** `destinationPillVisible(currentRoute, conversationOpen)` is false
only for `chat` with an open conversation — a session's transcript and composer
— and true for the chat list and every other destination. `conversationOpen` is
the new `AppViewModel.conversationOpen` (`chatStore.state.map { it.active != null }`,
`distinctUntilChanged`), read from the same store the chat surface renders, so a
background open chat never hides the pill elsewhere and a streamed chat delta
never recomposes the app shell.
- **The space, not just the pill.** `destinationPillReserve(pillVisible)` returns
the named `DESTINATION_PILL_RESERVE` while the pill is drawn and `0.dp` while it
is hidden: the content Column keeps clearing a drawn pill, and a hidden pill
leaves no empty band at the end of scrollable content, so the composer sits at
the true bottom. The pill and its reservation are driven by the one predicate,
so no frame has a drawn pill over content it does not clear or a reserved gap
behind a hidden pill; the viewport height is constant for as long as a
conversation is open, so the composer and the newest message do not move while
it is shown. Works with the keyboard open: the composer's own `imePadding` and
the pill's `paneSafeArea()` are unchanged, with no pill left to sit over them.
- **Still escapable.** Nothing about leaving a conversation changed: its top-bar
back arrow (`Back to chats`), the system Back button/gesture (`ChatScreen`'s
`PredictiveBackHandler`), and on a wide window the covered chat-list strip
(`SlidingPaneStack.onPopTo`) all return to the list. The pill was never the way
out; Back is.
- **Nothing else touched.** The pill's destinations, travelling indicator,
morph-into-search and behaviour on every other screen are untouched; the
attention indicator is unchanged.
Evidence (this pass, macOS, JDK 17 `/opt/homebrew/opt/openjdk@17`, cached Gradle
8.11.1, `ANDROID_HOME=$HOME/Library/Android/sdk`, `--offline --no-daemon`):
- `gradle :app:testDebugUnitTest --offline --no-daemon --console=plain` →
`BUILD SUCCESSFUL in 11s`; the JUnit XMLs total **58 suites / 533 tests / 0
failures / 0 errors / 0 skipped** (up from 531: `PipelinesNavTest` gains
`thePillStandsDownOnlyWhileAConversationIsOpen` and
`theReserveTracksTheDrawnPillSoContentNeitherJumpsNorLeavesAGap`).
- `gradle :app:assembleDebug --offline --no-daemon --console=plain` →
`BUILD SUCCESSFUL`; `app/build/outputs/apk/debug/app-debug.apk` is **18,535,932
bytes**, sha256 `fc872b5398c231f053cd6e5f6794b2b6c2a8f947314ba0de02851dab2a95c3e`.
- **APK publish.** Copied to
`~/.local/share/pipelines/data/artifacts/287/1/pipelines-debug-wip-890d267.apk`
(`890d267` = `git rev-parse --short HEAD`; the tree is uncommitted WIP on top of
it), sha256 matched. The LAN URL
`http://10.0.0.75:8080/artifacts/287/1/pipelines-debug-wip-890d267.apk` returned
`HTTP/1.1 200 OK`, `Content-Type: application/vnd.android.package-archive`,
`Content-Length: 18535932`.
Not verified in this pass: the conversation/list screenshots — the brief keeps
implementation and ordinary code review to the build and the unit tests, and
visual review owns the operator's Pixel 9 Pro XL (its captures are the ones the
brief names: a conversation with no pill, and the chat list with it).
@@ -153,6 +153,19 @@ class AppViewModel(
)
val chat: StateFlow<ChatState> = chatStore.state
/**
* Whether the Chat destination is showing an open conversation — a session's
* transcript and composer — rather than the session list or the create flow.
* The app hides the floating destination pill in exactly this state. A derived
* boolean, distinct until changed, so the whole chat state (streamed deltas,
* drafts, scroll) never recomposes the app shell; it is read from the same
* store the chat surface renders, so the pill and the pane can never disagree.
*/
val conversationOpen: StateFlow<Boolean> = chatStore.state
.map { it.active != null }
.distinctUntilChanged()
.stateIn(viewModelScope, SharingStarted.Eagerly, chatStore.value.active != null)
// The live run subscription: the workspace currently watched, the job that
// established it, and the coalescing jobs that re-sync on a push. One
// subscription per connection; a reconnect (which clears this watch, not the
@@ -175,6 +175,12 @@ fun PipelinesApp(
mutableStateOf(OmniSearchState())
}
val search by vm.search.collectAsStateWithLifecycle()
// Whether the Chat destination currently shows an open conversation. The
// floating pill stands down only there (see [destinationPillVisible]); it is
// read from the chat store, so it flips in the same recomposition that swaps
// the chat list for the conversation.
val conversationOpen by vm.conversationOpen.collectAsStateWithLifecycle()
val pillVisible = destinationPillVisible(currentRoute, conversationOpen)
/** Back/scrim/close and a selection all dismiss the morph and clear the panel. */
val dismissSearch: () -> Unit = {
@@ -264,11 +270,13 @@ fun PipelinesApp(
// Scaffold, and the floating pill explicitly clears the safe area (system
// bars, cutout, gesture area and IME) via windowInsetsPadding. The Column
// reserves DESTINATION_PILL_RESERVE at the bottom so no scrollable content is
// permanently hidden behind the pill.
// permanently hidden behind the pill; while the pill is hidden (an open
// conversation, see [destinationPillVisible]) that reservation is dropped too,
// so the composer sits at the true bottom instead of over an empty band.
val bannerVisible = connectionState !is ConnectionState.Connected
Scaffold(contentWindowInsets = WindowInsets(0, 0, 0, 0)) { padding ->
Box(Modifier.fillMaxSize().padding(padding)) {
Column(Modifier.fillMaxSize().padding(bottom = DESTINATION_PILL_RESERVE)) {
Column(Modifier.fillMaxSize().padding(bottom = destinationPillReserve(pillVisible))) {
ConnectionBanner(
state = connectionState,
configuredUrl = configuredUrl,
@@ -379,20 +387,25 @@ fun PipelinesApp(
onClick = { attentionOpen = true },
modifier = Modifier.padding(bottom = SPACING_S),
)
DestinationBar(
destinations = destinations,
currentRoute = currentRoute,
state = searchState,
onSelect = onNavigate,
onOpenSearch = { searchState = openOmniSearch(searchState) },
onDismissSearch = dismissSearch,
onQueryChange = {
searchState = setOmniSearchQuery(searchState, it)
vm.onSearchQueryChanged(it)
},
onFocusChange = { searchState = setOmniSearchFocus(searchState, it) },
onSubmitSearch = { vm.searchNow() },
)
// The pill stands down while a conversation is open; the search
// field it morphs into is unreachable there anyway (the field opens
// from the pill), so nothing is stranded by not drawing it.
if (pillVisible) {
DestinationBar(
destinations = destinations,
currentRoute = currentRoute,
state = searchState,
onSelect = onNavigate,
onOpenSearch = { searchState = openOmniSearch(searchState) },
onDismissSearch = dismissSearch,
onQueryChange = {
searchState = setOmniSearchQuery(searchState, it)
vm.onSearchQueryChanged(it)
},
onFocusChange = { searchState = setOmniSearchFocus(searchState, it) },
onSubmitSearch = { vm.searchNow() },
)
}
}
if (attentionOpen) {
AttentionSheet(
@@ -730,6 +743,34 @@ private fun TemplatesDestination(
internal fun destinationIndicatorOffsetDp(index: Int, itemSize: Dp, gap: Dp): Dp =
gap + (itemSize + gap) * index.coerceAtLeast(0)
/** The Chat destination's navigation route. */
private const val CHAT_ROUTE = "chat"
/**
* Whether the floating destination pill is drawn for [currentRoute]. The pill
* stands down only while the Chat destination is showing an open conversation —
* a session's transcript and composer — where it would sit over the composer and
* the newest message and compete with send/stop. The chat list and every other
* destination keep it exactly as before; the covered peek strip and Back still
* leave a conversation, so hiding the pill strands nothing. Pure, so the one
* rule is unit-testable without a device.
*/
internal fun destinationPillVisible(currentRoute: String?, conversationOpen: Boolean): Boolean =
!(currentRoute == CHAT_ROUTE && conversationOpen)
/**
* The bottom space the content reserves for the pill: the named
* [DESTINATION_PILL_RESERVE] while the pill is drawn, and none while it is
* hidden, so a hidden pill leaves no empty band at the end of scrollable content
* and the composer sits at the true bottom. Derived from [pillVisible] alone, so
* the reservation and the drawn pill can never disagree into a frame with a
* drawn pill over content it does not clear, or a reserved gap behind a hidden
* one — which is what keeps the content from jumping as the pill appears and
* disappears.
*/
internal fun destinationPillReserve(pillVisible: Boolean): Dp =
if (pillVisible) DESTINATION_PILL_RESERVE else 0.dp
/**
* The bottom container: the destination pill that morphs into the omni-search
* field. It is one [Surface] so the morph reads as the same container changing
@@ -1,6 +1,7 @@
package net.awan.pipelines.ui
import androidx.compose.ui.unit.Dp
import net.awan.pipelines.ui.theme.DESTINATION_PILL_RESERVE
import org.junit.Assert.assertEquals
import org.junit.Assert.assertFalse
import org.junit.Assert.assertTrue
@@ -52,6 +53,44 @@ class PipelinesNavTest {
)
}
@Test
fun thePillStandsDownOnlyWhileAConversationIsOpen() {
// An open conversation (the chat transcript and composer) hides the pill;
// the chat list keeps it, and so does every other destination.
assertFalse(destinationPillVisible("chat", conversationOpen = true))
assertTrue(destinationPillVisible("chat", conversationOpen = false))
for (route in listOf("pipelines", "templates", "runs", "settings", null)) {
assertTrue(destinationPillVisible(route, conversationOpen = false))
}
// A conversation only exists on the chat route; even if the flag were set
// elsewhere the pill stays, so a background chat never hides it.
assertTrue(destinationPillVisible("runs", conversationOpen = true))
}
@Test
fun theReserveTracksTheDrawnPillSoContentNeitherJumpsNorLeavesAGap() {
// Drawn: content reserves the named pill space and clears it. Hidden: no
// reservation, so there is no empty band where the pill used to be.
assertDp(DESTINATION_PILL_RESERVE.value, destinationPillReserve(pillVisible = true))
assertDp(0f, destinationPillReserve(pillVisible = false))
// One predicate drives both, so the space can never disagree with the
// pill: reserved exactly when drawn, gone exactly when hidden.
for (route in listOf("pipelines", "chat", "runs", "settings", null)) {
for (open in listOf(false, true)) {
val drawn = destinationPillVisible(route, open)
val reserve = destinationPillReserve(drawn)
assertTrue(
"reserve held behind a hidden pill on $route (open=$open)",
drawn || reserve.value == 0f,
)
assertTrue(
"content not cleared of a drawn pill on $route (open=$open)",
!drawn || reserve.value == DESTINATION_PILL_RESERVE.value,
)
}
}
}
private fun assertDp(expected: Float, actual: Dp) =
assertEquals(expected, actual.value, 0.01f)
}