Say it in icons, and put the whole backend behind four tabs
Six things Bryan asked for, which turned out to be one change: the app had no icon set, so every one of them was blocked on having somewhere for icons to come from. That somewhere is dev-updater's arrangement, ported: a Nerd Fonts subset committed as an asset, drawn as text. `Gear.kt`'s hand-drawn canvas gear argued against icon fonts because a system font may not have the glyph and whoever gets the empty box is never the person who wrote it. The objection is right about *relying* on a system font and the answer is to ship the glyph, so the file is gone and its reasoning is restated in `NerdIcons.kt` rather than deleted -- otherwise the next reader re-derives it. `md-cog` and `md-refresh` are dev-updater's own codepoints, because a cog means the same thing in both apps. The root screen's four words under the title are now four tabs, and the two that act on the whole screen -- settings and refresh -- moved up onto the title row as glyphs. That row's old comment recorded that a fifth word would have had nowhere to go; tabs also say something the words did not, which is that sessions, import, models and setups are four views of one backend rather than four errands. Refresh feeds whichever tab is showing. Import, models and setups lose their headings and their Back buttons, since the tab row is now both. Usage is a dialog. It is checked *against* what you were reading -- "can I start this" is asked with the transcript still on screen -- and it had no navigation of its own, so the only thing its Back could mean was "put this away". The button that opens it is a chart glyph coloured by the worst of the machine's windows, so the row says whether the limits are worth opening before anybody opens them. One `quotaColor` now colours every bar that measures a quota: blue, yellow at 75%, red at 95%. The session bar escalates where it used to sit blue at every level, and the dialog's thresholds moved out of it. A download keeps plain blue at every value -- it has no limit to approach, and colouring it like one would say the opposite of what is happening. States that are not measurements take the ordinary control colour, since blue is the low end of this scale and would read as "checked, and fine" about a machine nobody could reach. Send and stop are the filled paper plane and the filled square. Send keeps the word "Queue" while a turn is in flight, because that is what pressing it then does, and an icon that does two things while looking identical would promise something immediate and do something that waits. Looked at on the emulator: all six glyphs render, the tabs and the system back gesture between them, the dialog over a live session, and the bar bands at 82% and 97% forced through a scratch build, since this account is at 72/31/5 and would only ever have shown blue.
This commit is contained in:
1 parent
ba71c798f5
commit
ff39ef5cf9
17 files changed
+627
-310
No files matched your search
Executable
+61
@@ -0,0 +1,61 @@
|
||||
#!/usr/bin/env bash
|
||||
# Rebuilds androidApp/src/main/res/font/nerd_icons.ttf.
|
||||
#
|
||||
# The app draws a handful of icons -- a cog, a refresh arrow, send, stop --
|
||||
# as text in a Nerd Fonts glyph rather than as vector assets or as ordinary
|
||||
# Unicode. Unicode has no character for most of these, and the ones it does
|
||||
# have are not reliably in an Android system font, so they land as tofu
|
||||
# boxes on somebody's phone. Shipping the subset removes the hope: the
|
||||
# glyph is in the APK.
|
||||
#
|
||||
# The whole symbols font is 3 MB for the handful below, so what is
|
||||
# committed is a subset. Add a codepoint to GLYPHS below and to NerdIcons.kt
|
||||
# (the two lists have to agree -- a codepoint in the Kotlin but not here is
|
||||
# a glyph that silently doesn't exist), then run this and commit the result.
|
||||
#
|
||||
# Needs python3 and network access; fontTools is fetched into a temporary
|
||||
# venv, so nothing has to be installed on the machine.
|
||||
#
|
||||
# Copied from dev-updater's script of the same name rather than shared
|
||||
# through wg-app-link, for the reason Theme.kt gives about the palette: the
|
||||
# link is the tunnel, the pinned CA and enrollment, and an icon set is a
|
||||
# preference rather than part of that contract.
|
||||
set -euo pipefail
|
||||
|
||||
# Codepoint, then the Nerd Fonts glyph name it came from. Material Design
|
||||
# Icons bar one, so they read as one family -- and the first two are
|
||||
# deliberately the same two dev-updater uses, since a cog and a refresh
|
||||
# arrow mean the same thing in both apps. The exception is noted on its
|
||||
# own line, as dev-updater's script does with its two.
|
||||
GLYPHS=(
|
||||
U+F0493 # md-cog
|
||||
U+F0450 # md-refresh
|
||||
U+F048A # md-send
|
||||
U+F04DB # md-stop
|
||||
U+F004D # md-arrow_left
|
||||
U+F201 # fa-line_chart -- Font Awesome's, asked for by name
|
||||
)
|
||||
|
||||
url=https://github.com/ryanoasis/nerd-fonts/releases/latest/download/NerdFontsSymbolsOnly.zip
|
||||
out="$(cd "$(dirname "$0")" && pwd)/androidApp/src/main/res/font/nerd_icons.ttf"
|
||||
work="$(mktemp -d)"
|
||||
trap 'rm -rf "$work"' EXIT
|
||||
|
||||
echo "Fetching $url"
|
||||
curl -fsSL -o "$work/nf.zip" "$url"
|
||||
python3 -c 'import sys,zipfile; zipfile.ZipFile(sys.argv[1]).extractall(sys.argv[2])' "$work/nf.zip" "$work"
|
||||
|
||||
python3 -m venv "$work/venv"
|
||||
"$work/venv/bin/pip" -q install fonttools
|
||||
|
||||
unicodes="$(IFS=,; echo "${GLYPHS[*]}")"
|
||||
mkdir -p "$(dirname "$out")"
|
||||
# The proportional face rather than the Mono one: these are drawn inline
|
||||
# beside text, where a fixed advance would pad each icon out to a cell.
|
||||
"$work/venv/bin/pyftsubset" "$work/SymbolsNerdFont-Regular.ttf" \
|
||||
--unicodes="$unicodes" \
|
||||
--layout-features= \
|
||||
--drop-tables+=DSIG \
|
||||
--output-file="$out"
|
||||
|
||||
echo "Wrote $out ($(stat -c %s "$out") bytes) with ${#GLYPHS[@]} glyphs"
|
||||
Reference in new issue
Block a user