Give the phone a selection instead of a card under the list

A long press on a host raised a connect card over the bottom of the list: a
password box, CONNECT, EDIT, MOVE and DELETE. It was the right idea in the wrong
place. It covered rows, it had room for five things and never a sixth, and every
one of them was about exactly one machine — so filing eleven imported hosts under
a group was eleven trips through a form, and there was nowhere to put a sixth
action if anybody wanted one.

A long press now chooses the host it landed on, and the actions move into a bar
across the top of the screen, in the vault header's place rather than beside it.
That is where Android has put them since contextual action bars existed, and it
is the one strip a list can never grow into — but the real reason for it is that
while it is up the screen is unambiguously about the ticked hosts and nothing
else, which is what lets the count in the middle of it mean something. Left to
right: the cross that leaves the mode, the count, the pencil, and a ⋯ holding
Connect, Connect via SFTP, Move to vault, Copy to vault, Change group, Duplicate
and Remove.

A tap still connects and still raises nothing. Once anything is ticked it ticks
and unticks instead, which is what every Android list does and is not merely a
convention worth following: a tap that connected while five machines sat ticked
would open a terminal on top of a selection somebody was halfway through
building. Unticking the last host leaves the mode, so there are two ways out of
it and the cross is only one of them.

Both gestures now read the row from the element under the finger rather than from
the list's selection, and that is a correctness change rather than tidying. A tap
on a group heading moves the selection and the view model bounces it straight back
to whichever host was chosen before — which answered "a host, or nothing" for free
while a tap only ever connected. It stops answering it the moment a tap can tick
one: the heading would tick a machine the user was not pointing at, into a set
they are about to delete.

Three of the seven entries are about one machine and are drawn only for one. A
terminal, a file-transfer session and a form each have no reading over six, so
they are collapsed rather than refused. The other four read better for a count
than without one — it is the reason the set exists — and each of them says
afterwards how many hosts it wrote and how many it left alone. Skipping beats
refusing the whole run: a selection of eleven with one read-only row would
otherwise do nothing at all and then report about the wrong ten.

Copy to vault and Duplicate are new, and the difference between them is what each
can safely carry. A copy crosses a key boundary, so it drops the group and the
tags exactly as a move does — both are items of the vault being left, and a host
arriving with either would point at something the destination does not contain,
resolvable on the machine that sent it and dangling for everybody else. A
duplicate stays in the same keychain, so everything it points at is still there
and it keeps both. Change group is the write dragging a card onto a group already
makes on the desktop, run over a selection; it refuses one spanning two keychains
rather than half-filing it, which is the refusal a drop across that boundary
already makes one host at a time.

Connect via SFTP is the one action that leaves the vault. Which machine is a
decrypted item and so is this object's business; the screen it leads to and the
transfers view model behind it are the shell's — so it is an event, on the same
division SessionOpened already draws for a shell. The host is re-found in that
screen's own copy of the list, because the picker binds to rows in that copy and
handing it the vault's object would select nothing.

What is left of the card is the password box, and only because it had nowhere
else to go: a host that authenticates with a typed password cannot be reached by
a tap alone. That tap now raises a sheet rather than the bar, and the difference
is that a sheet is up only while a question is on screen — the bar was raised by
a long press and stayed, so it was a password box sitting over the list whether or
not anything was being asked. Dismissing it empties the box, which is not tidiness
either: a secret left behind would satisfy the emptiness check that decides
whether to raise the sheet at all, so the next tap would dial with somebody else's
password.

The pencil moving into that bar takes the host editor with it. It was a card in
the list's own row, under the search box and the sync line — twenty controls
sharing a screen with two rows of chrome about the list it had replaced. It is a
page now, and PhoneShell stands all four of its rows down for it, which is what
"opens with all the options" means at 360dp. That needed a second subscription in
that control: two of its flags are questions about the vault rather than about the
shell, and the shell does not forward the vault's notifications.

The ticks are held as entity ids rather than as rows, and written back onto the
rows after every reload. Every row object in the list is replaced on every filter
keystroke and every synchronisation pass, so a set of rows would empty itself once
a minute under somebody choosing what to do with eleven machines. Ids that no
longer resolve are dropped, so a colleague's deletion arriving mid-selection
leaves a count that matches what is on screen.

One caller had to change with it. ConnectToRecent opened the pane about a host,
which was the desktop's drawer and the phone's card; the phone's answer is now a
tick, and nothing on that list means "selected" any more — so arriving with the
host merely selected would be arriving at a screen with nothing to press. Both are
raised together, and the one the head in front of the user does not draw is inert.
This commit is contained in:
jaap-jan committed 2026-08-06 09:15:37 +02:00
1 parent 174ef7c420
commit c882fa0cd3
11 files changed
+2669 -722

No files matched your search

@@ -0,0 +1,63 @@
<UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:vm="using:DodoSSH.Client.Shell.ViewModels"
x:Class="DodoSSH.Client.Android.Views.HostActionBar"
x:DataType="vm:VaultViewModel">
<!--
◆ THE CONTEXTUAL ACTION BAR, WHICH IS WHAT THE CONNECT CARD BECAME.
A long press on a host used to raise a card over the bottom of the list: a password box, CONNECT, EDIT,
MOVE and DELETE. It was a menu drawn as a form, in the one part of the screen a list grows into — so it
covered rows, it had room for five things and never a sixth, and everything on it was about exactly one
machine. What replaced it is a selection and this bar.
It takes the vault header's place rather than sitting under it, which is the arrangement Android has used
for this since contextual action bars existed and is the reason it can be unambiguous: while it is up, the
screen is about the ticked hosts and about nothing else. See PhoneShell.ShowsHostSelectionBar, which is
where the swap happens and why it is computed rather than bound.
Left to right: the cross that leaves selection mode, the count, then the two controls. The pencil is out
in front of the menu because editing is the thing people reach for most and is worth not opening a menu
for; the other six are behind the ⋯, which is a sheet rather than a flyout — see
VaultViewModel.IsHostActionSheetOpen.
── one host or several ──────────────────────────────────────────────────────────────────────────────────
The pencil is drawn only while exactly one host is ticked, and it is collapsed rather than greyed. Three
of the seven actions are like that — edit, connect, and browse — and the reason is the same for all
three: a form, a terminal and a file session are each about one machine, and there is no sensible reading
of "edit these six". The three that stay are the ones a count makes better rather than worse.
-->
<Border Background="{StaticResource Chrome}" BorderBrush="{StaticResource Border}"
BorderThickness="0,0,0,1" Padding="6,0" Height="56">
<Grid ColumnDefinitions="Auto,*,Auto,Auto">
<!--
The cross, and it is the first thing on the bar for the reason back arrows are: the way out of a
mode belongs at the edge the thumb reaches without crossing anything it might press by mistake.
-->
<Button Grid.Column="0" Classes="icon" Content="✕"
Command="{Binding ClearHostChoiceCommand}"
ToolTip.Tip="Stop choosing hosts" />
<!--
The count, and only the count. The bar it sits in is already saying what the number is about, and
"6 hosts selected" beside a pencil and a menu is the width those two icons need at 360dp.
-->
<TextBlock Grid.Column="1" Classes="heading" FontSize="17" Margin="8,0"
VerticalAlignment="Center" Text="{Binding ChosenHostsLabel}" />
<Button Grid.Column="2" Classes="icon" Content="✎" FontSize="15"
IsVisible="{Binding HasOneChosenHost}"
Command="{Binding EditChosenHostCommand}"
ToolTip.Tip="Edit this host" />
<Button Grid.Column="3" Classes="icon" Content="⋯" FontSize="18"
Command="{Binding OpenHostActionSheetCommand}"
ToolTip.Tip="More things to do with these hosts" />
</Grid>
</Border>
</UserControl>