- Kotlin 99.9%
- HTML 0.1%
|
|
||
|---|---|---|
| app | ||
| gradle | ||
| site | ||
| .gitignore | ||
| build.gradle.kts | ||
| gradle.properties | ||
| gradlew | ||
| gradlew.bat | ||
| README.md | ||
| settings.gradle.kts | ||
Horn
An Android fediverse client, built to feel like Ivory rather than like a Material app that happens to show toots.
Runs against the live Mastodon API on any instance. Developed against fosstodon.org on a folding Android phone.
Status
Working
Timeline and reading
- Compact header (44dp) with avatar, centred title, timeline switcher, search
- Dense status rows: boost attribution chip, content-warning collapse, polls, thread markers, accent-tinted links, link preview cards
- Tap-to-reveal action row — springs open under the tapped post; also settable to always-visible or hidden
- Full-width media honouring real aspect ratios, with sensitive-content gating, plus a full-screen viewer with pinch-zoom, paging and swipe-to-dismiss
- Infinite scroll (
max_id), pull-to-refresh, inline error banners, disk cache
Navigation and chrome
- Customisable 5-slot dock with chevron affordances, flick-to-cycle, long-press picker, unread dots
- Compose button with a long-press radial shortcut menu
- Multi-column tablet mode: touch a column to focus it and the dock retargets that one; a + between columns and at the ends adds one there, a menu in each header moves, changes or closes it, drag the dividers to resize. The tapped column widens like an accordion
- Per-pane back stack: mentions, hashtags, profiles and lists all drill in
- Notifications, statistics (paged bar charts + today's totals), profiles
Writing and account
- OAuth against any instance: dynamic registration, Custom Tab consent,
horn://oauthredirect, token exchange - Compose: Mastodon-accurate character counter, content warnings, polls, media upload with alt text, visibility, replies, and one saved draft
- Optimistic favourite/boost/bookmark/vote with rollback on failure
- Post menu: profile, bookmark, translate, mute conversation, share, copy link, open in browser, and edit/pin/delete on your own posts
- Follow and unfollow, follow requests answered inline from the notification, and browsable followers/following lists
- Mute, block and report, each with consequence-stating confirmations
- Lists: view, open, create, delete, and choose who is in one
- Search across people, tags and posts
- Custom emoji rendered inline, and animated GIFs/
gifvthat actually animate - Thread view: ancestors, the focused post enlarged, replies indented by depth; long-press a post to open it (rebindable to the post menu)
- Editing a published post, seeded from its source text
- Machine translation with a show-original toggle, where the instance offers it
- Background notifications: Android channels per kind, delivered over the fifteen-minute poll for every signed-in account, with an opt-in streaming socket for instant delivery and a free one while the app is open
- Multiple accounts: add, switch (Settings or a long press on the header avatar), sign out individually, with each account's cached posts, drafts and read positions kept apart
- Theming: 12 accents × light/dark/black, 3 densities, text-size offset, avatar shape, media size — all live-applying and persisted
Not built yet
- Editing a post that carries a poll (see Editing below)
- Paging 3 (in the catalog, unused — paging is hand-rolled on
max_id)
Telling accounts apart
The same person on Mastodon and Bluesky usually has the same display name, the
same handle and the same picture. With @thelinuxcast@fosstodon.org and
@thelinuxcast.bsky.social signed in together there was nothing on screen
distinguishing them — the header avatar was identical, and the compose chips
truncated to @thelinuxcast… twice.
A brand-coloured disc on the avatar carries the network: purple M, blue B. It appears only when more than one protocol is signed in; three Mastodon accounts get no badges, because then it would say nothing.
Lettermarks, not the networks' logos. Both marks were drawn and both failed at badge size. The butterfly read first as a heart — which on an avatar suggests a like, so it was not merely a worse butterfly but an actively misleading one — and then, redrawn as separated wings, as a pair of leaves. A letter survives any size and cannot be mistaken for something else. Colour does most of the work in any case; the letter settles it.
The compose selector is avatars with the same badge, and spells the selected handles out in full underneath. Icons alone scan quickly but are ambiguous for the one decision where being wrong is unrecoverable — once you press send, a misread badge has already published.
The merged timeline uses the same badge, smaller, on each row's avatar. It replaced a handle printed above every post, which cost a line and read as a heading over something it did not belong to. The badge costs no layout at all, so it can repeat on every row instead of only at the head of a run — each row answers for itself with nothing to scroll back to.
What a network mark cannot say is which account, and with two signed in on
the same network that is the actual question. So the handle survives for
exactly that case, shortened to the part that distinguishes it: with
@thelinuxcast and @mtwb both on fosstodon.org, the instance is two thirds
of a line restating what the badge already said.
Even then it only prints when that network's account changes. Comparing against the row directly above reprinted it every time the feed crossed from Bluesky back to Mastodon — constantly, in a time-ordered merge, and saying nothing new each time. Comparing against the previous row on the same network means it appears exactly when the answer changed.
What counts as the same post
Two passes, because the question has two answers — see TimelineMerge.
One post that reached several of your accounts is matched on its canonical URI. Not its id: a federated post fetched by two instances arrives with two different local ids, so de-duplicating on id collapses nothing at all.
A cross-post is not one post. The same words sent to Mastodon and to Bluesky are two separate records on two networks with nothing in common that either protocol knows about, so the first pass cannot touch them and the merged feed showed the same sentence twice in a row. The second pass matches on author and text together. Both halves are load-bearing: text alone folds two strangers who both said "gm" into one row and hides one of them, and the author alone folds somebody's whole morning into a single post. Boosts and text-free image posts are excluded outright, and an hour's gap splits a daily habit back into separate rows.
The universal account
"All accounts" is an account you switch to, not a mode a column holds.
It began as a TimelineKind — a value one pane carried — which put it at the
same level as Home and Local. Anything at that level is per-pane and transient
by construction, so it was lost on every pane switch, and only Home was ever
merged. Moving it up a level to "who am I being" rather than "what is this
column showing" puts it where the account switcher already lives, and it
inherits that machinery: persisted, surviving pane switches and process death,
with no special case anywhere.
Every pane reads through one ActiveTimelineRepository, so pointing that at
UnifiedRepository unifies all of them at once rather than one surface at a
time. Three shapes of call behave differently on purpose:
- Reads fan out and merge, deduping through
TimelineMerge. That matters most where it is least obvious — two accounts on one instance see an identical Local timeline, which would otherwise appear twice. - Acting on a post routes to the account that has it. The post on screen belongs to exactly one of them, and favouriting it as another is not a near-miss, it is a different act by a different person.
- Acting on a person has no such anchor. The protocol narrows the
candidates — a Bluesky DID cannot be followed from Mastodon — and anything
still ambiguous raises
ActorRequiredrather than guessing.
UNIFIED_KEY is a sentinel, not a synthetic Session. A Session is a host and
a token; the universal account has neither, and plenty of work still needs real
credentials — refreshing a token, polling a notification log. Those keep
resolving a real session. Only the choice of repository looks at the sentinel.
Lists group by owner rather than merging, because a list belongs to exactly
one account and there is no shared list. The header appears whenever a list
carries an owner — not when there are two or more groups — since three signed-in
accounts with only one holding lists is still a single group, and leaving it
unlabelled shows lists with nothing saying whose they are. Rows are keyed by
owner and id: Mastodon list ids are integers scoped to their instance, so two
accounts can each own a list 1, and a duplicate key in a LazyColumn is a
crash rather than a glitch.
Local and Federated stay, contributed by Mastodon accounts alone: they are instance timelines and AT Protocol has no equivalent, so Bluesky accounts simply do not feed them.
The header avatar is a pair of discs rather than a borrowed face. Showing one account's picture would claim the app is flying under that account — the exact confusion the network badges exist to prevent — and the slot cannot be left empty, because it is both the way into Settings and the way back out to a single account.
The notification list
Rows are groups, not notifications — see NotificationGroup. The list is
overwhelmingly likes and boosts, and one row each turned a popular post into a
screenful of the same sentence with the replies pushed off the bottom.
Only adjacent notifications group, which is the whole trick. The list is newest-first, so adjacency is a time window that costs nothing to compute and never surprises anybody: likes that arrived together become one row, and a like from today stays separate from one last week on the same post. Grouping by key across the whole list would fold a week of activity into one line dated today.
Mentions never group. They are the notifications with something to read, and each is a different message — "3 people mentioned you" hides the only content on the screen. Follow requests stay separate too, since each needs its own answer.
The headline is one wrapping sentence rather than a name column beside a verb
column. Two side-by-side texts each take half the width and each truncate, so
a narrow pane produced Mateo and 1 othe… favorited yo… — ellipsised twice
and readable as neither.
Bluesky notifications arrive without the post. listNotifications returns
a reasonSubject URI and nothing else, so every row read "X favorited" and
stopped. The subjects are now fetched in one batched getPosts alongside the
list. That call had never worked: XRPC encodes array parameters as a repeated
name — ?uris=a&uris=b — and comma-joining them is accepted by the server and
silently matches nothing.
Replying as the right account
A reply can only go to the account that can see the thread — in_reply_to_id
is a local id, and the same string means nothing, or something else, on
another server. Horn always enforced that. What it did not do was say so:
the selector is hidden for replies because there is nothing to choose, and
the avatar beside the editor was whichever account was on screen. Replying to
a Bluesky mention while Mastodon was active looked, entirely, like a Mastodon
reply.
So a locked sheet states its sender — avatar, network badge, full handle — even though it offers no choice. This is the one identity question in the app where being wrong is published before you find out.
The caret is placed after the seeded mention, too. A text field defaults to
offset zero, which put the first keystroke in front of the @.
Bluesky
A second TimelineRepository behind the same interface, so panes, the merged
timeline and the cross-post selector treat a Bluesky account like any other.
OAuth has no registration step. Horn's client id is the URL of a metadata
document it does not serve — login.hornforfedi.com — which the authorization
server fetches mid-login. That fetch, and the redirect-URI list it finds, is
what replaces the client secret a shipped app cannot keep. See site/README.md.
Tokens are bound to a key, not bearer strings. Every request carries a
freshly signed DPoP proof naming its own method, URL and token, so a captured
proof cannot be replayed elsewhere. Two pieces of that are hand-rolled and fail
silently when wrong — deriving the public key by curve point multiplication,
and converting the JDK's DER signature to raw R||S — so both are unit-tested
against independent paths. A mistake there surfaces only as somebody else's
server returning 401.
Identity takes four hops, and the last one is the trap. Handle → DID → DID
document → PDS, then PDS → authorization server. On bsky.social the data lives
on a shard like puffball.us-east.host.bsky.network while tokens come from
bsky.social; sending the token request to the PDS just 404s.
Facet ranges are byte offsets into UTF-8. Bluesky posts are plain text plus ranges carrying links, mentions and tags, and converting them to Mastodon HTML means the existing status row renders them with no changes. Treating those ranges as character indices works until a post contains an emoji, then every later link comes out truncated with neighbouring words swallowed. Tested with 🎉 in front of a link, because that is not an edge case on Bluesky.
Writing needs facets too. Mastodon servers linkify text themselves; AT Protocol expects the client to submit byte ranges for the links and hashtags it found. A post sent without them shows the URL as plain text in every client. Mentions are deliberately not auto-detected — a mention facet needs a DID, and guessing one tags a stranger.
What does not map, degrades rather than being invented. Visibility has no
equivalent, because reach is a threadgate applied afterwards rather than a
choice made while writing. Content warnings come from labels, which are a fixed
vocabulary rather than free text, so a typed warning is dropped on cross-post
rather than being silently turned into !warn. Polls, custom emoji, bookmarks
and follow requests do not exist; those methods return the honest empty answer,
because the UI already hides what is absent and a Bluesky account should not
crash a surface it shares with a Mastodon one.
Mastodon-only paths are gated on protocol. Read markers, the notification
poll and the streaming socket are all Mastodon endpoints, and all three used to
fire for whichever account was active. With a Bluesky account that crashed the
app on the first call after sign-in. SessionApiFactory now refuses outright
to build a Mastodon client for a non-Mastodon session, so the next such mistake
names the account and the protocol instead of surfacing as "unexpected host"
from inside OkHttp.
Session.host is bare for both protocols. It once held a full URL for
Bluesky and a hostname for Mastodon, which is exactly the sort of difference
that goes unnoticed until one caller concatenates it and another passes it to a
builder that rejects it. baseUrl exists for when an origin is wanted, and
readAccounts normalises rows written by the earlier build.
Undoing a like means deleting a record. A like is its own record in your repository, so unliking needs its URI rather than the post's — kept beside the cache, along with each post's CID, which is required to create one.
Bluesky sessions expire, and say so
Horn is a public OAuth client (token_endpoint_auth_method: none, see
site/README.md), and bsky.social keeps sessions for public clients short: the
refresh token stops working after days, not months, however often it is used.
Once the server answers a refresh with invalid_grant ("Invalid refresh
token"), nothing but a fresh sign-in helps. Found on 2026-11-10: the stored
session had last been renewed on 2026-10-15 and every Bluesky column was empty.
What the code does about it:
AuthRepository.renewis serialised by a mutex and re-reads the stored session before spending anything. Refresh tokens are single-use and a second use is treated as theft, so several requests renewing at once used to burn the token the first one had just rotated.- A terminal refusal (
isDeadSession: 400/401 withinvalid_grant,invalid_client,unauthorized_client) marks the account inAuthRepository.expiredAccountsand raisesSessionExpiredException. Anything else (offline, 5xx, a bad proof) is a transient failure and keeps the session. - Bluesky
fetchthrows instead of returningnull. Swallowing it was what made a dead session, a rejected request and a changed endpoint all look like an empty timeline. SessionExpiredBanner(core/ui/SessionExpiry.kt) sits under the header of timelines and of the notifications, lists and profile panes. SIGN IN opens login on the Bluesky tab with the handle filled in; the account switcher marks the row too. Signing in again replaces the session in place (same DID).
Making sessions last for months needs a confidential client: a server holding a
private key that signs client_assertions. Horn has no backend, so this is not
done.
One repository per account
The active account used to be an invisible argument to every call. A single
TimelineRepository singleton, and an OkHttp interceptor that read whichever
session happened to be current. That is correct while one account is on screen
and nothing runs in the background — and it is the thing that broke, twice,
when neither stayed true.
AccountRegistry now owns one repository per signed-in account, each built
around a captured Session with its own API client from SessionApiFactory.
A request cannot be misrouted by something switching accounts underneath it,
because there is nothing to switch.
Screens did not have to change. ActiveTimelineRepository implements the
same interface by delegating to whichever account is current, so everything
that meant "the active one" still says TimelineRepository and still means it.
Merged and fan-out surfaces take the registry instead.
Switching no longer empties anything. The old sequence stopped delivery, dropped the caches, changed the session, then re-primed — and the ordering of those four steps was the direct cause of two separate bugs (a blank app, and one account's timeline under another's name). With per-account repositories the incoming account simply has its own warm cache, so switching is instant and there is no window to get wrong.
Status.accountKey says who fetched it. Stamped by the mappers. id is
only meaningful on its own instance and isFavourited is a statement about one
viewer, so a post carried into a merged timeline has to say whose view it is.
StatusDispatcher routes interactions by it — acting as the wrong account does
not fail loudly, it favourites a different post that happens to share an id.
Unified timeline
Every account's home, interleaved, newest first. Each account is still fetched, cached and paged entirely on its own; only the output is merged. A single cursor across several servers has no correct implementation — instances disagree about ordering, ids are not comparable between them, and one slow server would stall the whole feed.
Identity for de-duplication is Status.uri, not id. A federated post
fetched by two of your accounts arrives twice with two different local ids, so
collapsing on id would collapse nothing. The kept copy is the one that has
already been interacted with where there is a choice, because the action row
renders from it and showing a post as un-favourited when you can see that you
favourited it is worse than showing either account's state arbitrarily.
Loading and paging fan out concurrently. Sequential would be one round trip of latency per account on first paint, and paging only the account that contributed the oldest visible post would splice a new page into the middle of the list instead of extending the end.
The list key is "$accountKey:$id". Ids are unique within an instance only, and
a duplicate key in a LazyColumn is a crash rather than a glitch.
The account label marks the start of a run, not every row. Repeating it costs a line per post, and with three accounts interleaved it became the loudest thing in a timeline it is only meant to annotate. A run reads as belonging to the label above it. The exception is a post more than one of your accounts can see, which is always marked — that is saying something about that row rather than about the group.
Posting to several accounts
A multi-select above the toolbar, not a picker. Saying the same thing in two
places at once is the whole point, and a radio button cannot express it. It
appears only with more than one account signed in and only where there is a
choice — replies and edits lock to one account, because in_reply_to_id and a
status id are local to one instance and mean nothing, or something else,
anywhere else.
Media is genuinely uploaded once per account. Attachment ids are issued by and valid on only the instance that stored the file, so cross-posting a photo to three accounts sends the bytes three times. There is no id to share. What composing already uploaded for the account on screen is reused, so the ordinary single-account send is unchanged.
The character counter shows the strictest limit across the selected accounts. Otherwise the first you hear that the text does not fit is a 422 from one server after the other has already published it.
Sending is sequential, and failures are collected rather than thrown. Three servers accepting identical text within milliseconds is how an account gets flagged as a bot. Collecting failures means a partial send can say exactly who missed out — throwing would lose that and invite a retry that double-posts to the accounts that already succeeded. On a partial send the draft is deliberately left intact and not reset.
Each account gets its own idempotency key derived from the shared one. Reusing one key across accounts is harmless while they are on different servers, and becomes a silent deduplication bug the moment two accounts share an instance — which is exactly the setup here.
Multiple accounts
Accounts are stored as a JSON list plus an active-key pointer. Session.key is
host:accountId — host and id, because account ids are only unique within an
instance, and acct changes when somebody renames themselves, which would orphan
their cached data.
The old single-session keys are still read. An existing install keeps its session across the upgrade rather than being silently signed out; the legacy keys are retired the first time anything rewrites the list. The read-side migration is pure, with no write-back, because several collectors share that flow and a write inside it would race on first launch.
Nothing is dropped when switching any more. Memory used to be shared across
accounts, which is why it had to be emptied in a particular order; see
"One repository per account" above for why that is gone. Disk is partitioned
per account (cache/timelines/<account key>/) and survives sign-out only for
accounts that remain.
switchTo still updates sessionSnapshot synchronously. Less load-bearing
than it was — requests now carry their account rather than looking it up — but
AuthRepository itself, the draft slot and the read-state markers still resolve
"the current account" through it, and leaving it to be refreshed asynchronously
meant work started right after a switch ran as the previous account.
Priming forces past the load guards. currentAccount() re-resolves itself
whenever it is observed as null, which fires the moment the caches are dropped —
before the session changes — and would otherwise mark the outgoing account as
loaded and turn the prime into a no-op. Two fixes for one symptom pulling against
each other; the guards are cleared explicitly so the ordering is decided rather
than raced.
Pane view models are keyed by account. Without that, a switch leaves every pane holding the previous account's view model: its timeline flow re-emits empty once the caches drop and nothing ever asks it to load again, so the column sits blank until a manual refresh. Pane stacks reset to the dock roots too — a thread or profile route resolved under the previous session means nothing under the new one.
Everything persisted is namespaced by account: drafts, notification high-water marks, read positions and the timeline cache. Signing one account out removes all of it, and leaves the others alone.
Known gap: background notifications follow the active account only. The streaming socket is per session, and running one per account would mean several foreground services or a multiplexer — worth doing, but it is its own piece of work rather than a detail of this one.
Dock tap on the selected tab
A tap on a dock icon does one of four things, decided by PaneLayout.dockTap:
nothing shows it, so the focused column is pointed at it; another column shows
it, so focus moves there and nothing else changes; the focused column shows it
but has drilled in, so it pops to its root (as it always did); or the focused
column shows it at its root, so its list scrolls to the top. The last is the
second tap, the way a tab bar works elsewhere. Long-press is still the slot
picker -- it was not given to scroll-to-top, to keep the only deliberate way
to reassign a slot.
The dock sends the surface name through ScrollToTopRequests (provided as
LocalScrollToTop); lists answer with ScrollToTopEffect. rememberRestoredListState
installs it for every restorable list and records the head as the saved
position, since the recorder ignores the head until the finger has touched the
list. Lists has it too. Statistics and Search don't have a feed to scroll.
ScrollSurfaces is the one definition of the names. With several columns on
one tab, the column nearest the focused one is chosen (columnShowing).
Pull to refresh
Every list that shows a feed or a set of accounts can be pulled: all timelines (home, local, federated, mentions, bookmarks, favourites, hashtags, lists), the notification list, profiles, threads, search results, the lists pane, list members, and followers/following. Settings, Statistics and the universal account's profile list are not feeds and are not pullable.
It is Ivory's behaviour, not Material's: the list itself is dragged down and a
bare accent-coloured spinner appears in the gap, held there until the refresh
ends. core/designsystem/component/PullRefresh.kt wraps Material's
PullToRefreshBox (which still owns the gesture and the thresholds) and
replaces its chrome. Two entry points:
HornPullToRefresh(isRefreshing, onRefresh)for a screen whose view model already has a refreshing flag (the timeline).HornRefreshable(onRefresh: suspend () -> Unit)for everything else. It keeps the spinner state in the composable, not the view model, so in a multi-column layout pulling one pane never spins another that shares its data.
Each screen passes a view model refresh() that reuses the load path it already
had: repository.refresh(kind) for timelines and profiles,
statusContext for threads, the same search call for results, lists() and
listAccounts/followers/following for the account lists. The notification
log is not a TimelineKind, so it got TimelineRepository.refreshNotifications(),
implemented for Mastodon, Bluesky, the merged account and the mock.
An empty state has to be scrollable to be pullable. The gesture arrives via
nested scroll and a plain Box dispatches none, so use PullableEmpty for any
empty or error state inside a refreshable area. It is also what lets a thread
that failed to open be retried by pulling it.
Refreshing replaces a feed's first page, so pages loaded by scrolling are dropped; this was already true of the timeline refresh. Scroll restoration is unaffected, since it keys on post ids and only acts on first composition.
The profile header's counts do not refresh: lookupAccount is memoised for the
process, so a pull re-reads the posts and the follow state only.
Auth notes
Login takes an instance domain, registers Horn with that server
(POST /api/v1/apps, cached per host so repeat logins don't litter the user's
authorised-apps list), opens the instance's own consent page in a Custom Tab,
and exchanges the returned code for a token. The password is only ever typed into
the instance's page — a Custom Tab rather than a WebView specifically so the real
URL and padlock stay visible.
The token is verified against verify_credentials before being persisted, so a
rejected token never becomes a stored session that wedges the app signed-in.
Known gap: the access token lives in DataStore inside app-private storage. That matches what most clients do and is fine against other apps, but it is not encrypted at rest. Worth hardening before any public release.
Cold start
Timelines persist to disk (data/repository/TimelineCache.kt) so reopening the
app after Android reclaims the process paints cached content in well under half a
second, then refreshes behind it. The cache stores wire DTOs, not domain objects:
they are already @Serializable, the mapping is already written, and keeping the
server's shape means a domain-model change doesn't silently invalidate the disk.
Deliberately not Room — no queries, no relations, no migrations worth owning for something whose entire contract is "give me back the page I last saw".
Loading is explicit, not inferred. ensureLoaded() returns whether a network
refresh has completed, and the empty state only renders once it has. Fetching used
to hang off the flow's onStart, which meant nothing emitted until the network
returned and the UI showed "Nothing here yet" for the whole fetch — a delay that
read as failure. Don't reintroduce a fetch inside timeline(); it is pure
observation now.
Caches are cleared on sign-out so no content outlives its account.
Navigation
Re-tapping the dock slot you are already on returns that pane to its root, the way every tab bar behaves — without it a column drilled three deep had no one-tap way back out.
Each pane owns a List<PaneRoute> stack. Per-pane rather than app-wide: with
several columns visible, a back gesture has to pop the column you were last in,
and a single global stack cannot express "Home here, a profile three deep over
there". BackHandler pops the deepest-drilled column.
Stacks are keyed by pane id and survive column-count changes, so folding and unfolding the device doesn't throw away where you were.
Every column follows its root, which comes from AppSettings.columns. An
earlier version rebuilt the first column only, from when the rest were fixed
defaults — which silently made retargeting a no-op, since the pane found a
cached stack and kept it. Nothing logged; the setting simply had no effect. A
drill-down still survives the rebuild check, because pushing a route leaves the
root at the bottom of the stack untouched.
Columns
Columns are peers. Each holds a destination, one of them has focus, and the dock points at whichever that is: touch a column to focus it, tap a dock button to retarget it. Opening, placing and closing columns happens on the columns, not in the dock:
- A + sits in the divider between every two columns and at both ends of the row, while another column would fit. Tap it, pick a destination, and the new column opens exactly there.
- Each header has a ... (beside search) that opens the column's menu: show something else, move left, move right, close. Close works on any column, and the last one cannot be closed.
- The dock's sideways flick is gone. It pulled a destination out beside the
focused column, so placing one anywhere else meant focusing a neighbour
first, nothing advertised it, and a drifting tap could close or replace a
column. The vertical flick that cycles a slot and the long press that opens the
slot picker stay; the flick now needs 32dp of travel, clearly vertical (2:1) at
the start and the end (
DockFlick), so a tap that drifts, or a thumb's diagonal arc, no longer re-assigns a slot.
The layout is ColumnLayout (navigation/ColumnModel.kt): an ordered list of
Column(id, destination) plus the column widths. Insert, remove, move and
retarget are pure functions on it, tested without a device, and each carries
the widths with its column.
A column is its id, not its index. The id keys its pane, its back stack, its
view models and its scroll position (pane id == column id), so opening one to
the left of another no longer hands the second one's place to the first, and
folding the phone and unfolding it still finds everyone where they were. Layouts
saved before ids existed migrate to pane-0, pane-1.. which is what those
panes were called, so their saved scroll positions still match. Focus is held
by id for the same reason. Back stacks and transient overrides for columns that
no longer exist are dropped once the stored layout is known.
AppSettings.columns (destinations only) is kept as a derived property for
callers that do not care which column is which; AppSettings.layout is the
truth. The stored form is column_layout (id:destination,...); the old
column_roots is read as a fallback and retired on the first edit. The reader
used to cut the list to three, a leftover from when the primary column was not
in it, so a fourth column written by Settings "Add column" vanished on the next
read.
Focus and emphasis are separate. Any touch on a column focuses it for the dock (initial pass, never consumed), but only a tap, or choosing it from the dock or a menu, makes the accordion widen it. A touch that turns into a scroll leaves the widths alone; reading in one column and scrolling another used to reflow the whole row under your finger every time. Emphasis starts on the first column when the layout is known (left empty it follows focus, and the first scroll elsewhere would widen it).
Opening, closing and moving are animated, by id (core/ui/ColumnMotion.kt).
Each column has a presence from 0 to 1: opening grows it out of nothing, and
closing shrinks it away before it is removed (the menu sets closingId, and the
removal follows once it has gone), so nothing changes width in one step. The
gutter beside a column and the "+" strips at the ends are scaled the same way.
Widths are animated per column id, so a column keeps the width it was moving from
when one opens beside it; by index, every insert handed each column its
neighbour's width and the new one popped in at a third of the row. The accordion
is computed in the frame of the change, not in an effect a frame later. A column
still opening or closing is laid out at a fixed minimum width and revealed,
rather than squeezed to a sliver whose text reflows on every frame. Each column's
composition is keyed by its id; without that the list state -- scroll position,
the open action row -- went with the position, not the column. Moving slides only
the column you moved, and the one it swapped with fades in at its new place:
sliding both made a narrow column pass completely behind a wide one.
A tapped notification shows Notifications in a column that already has it, or else in the first column as a transient override held in memory. It used to retarget column 0 in the saved layout, so one tap replaced it for good. An override ends when that column is retargeted, closed or the account changes.
The accordion. Focus animates the row so the focused column is EMPHASIS
times the width of each of its neighbours, floored so nothing is squeezed past
usable. A drag overrides that and is persisted; the accordion is not, because it
is a consequence of where you are rather than a layout you chose, and writing it
on every column tap would quietly eat the widths you set. The override lasts
until the next focus change, so a drag survives exactly as long as you stay in
the column you sized.
Focus is claimed on touch-down, on the initial pass, without consuming. So scrolling a column focuses it too — "tap or interaction" — and the gesture still reaches whatever was actually being aimed at.
Smoothness cannot be judged on debug. Compose's tooling instruments
every composable for the Layout Inspector, and there is no R8 and no baseline
profile, so the UI thread pays several times what a shipped build does — and it
is the frame spikes that it inflates most, which is exactly what reads as
jerk. Measured on the inner screen, three focus changes, dumpsys gfxinfo:
| focus change | debug | perf |
|---|---|---|
| janky frames | 11.8% | 5.9% |
| 95th percentile | 53ms | 17ms |
| 99th percentile | 65ms | 22ms |
Scrolling, as a control, went 8.9% janky to 3.2% with no change in behaviour at all. In both cases the median and 90th percentile were already fine (6ms, 12ms) and the GPU was a flat 4ms throughout: the resize never cost a sustained per-frame price, only a hitch at the start of each animation.
That is why the reflow stayed. Two attempts at laying the text out once and
sliding the columns over it — kept on dev-pushaside and dev — both traded
the hitch for something worse: measuring each column at its own target width
concentrated the reflow into one frame and read as a push rather than a slide,
and giving every column one fixed width meant the unfocused ones ran on
underneath their neighbours and were cut mid-word.
The perf build type exists for this: release optimisation, debug signing, and
debug's application id so it upgrades the app already on the device instead of
arriving as a signed-out second copy with an empty timeline to measure.
Two different minimums, and conflating them broke resizing.
minimumColumn (260dp) decides how many columns the window will open.
resizeFloor (200dp) is how narrow one may be dragged. Sharing a single number
made most drags do nothing: three columns on a 932dp screen leave 104dp of
slack in the whole row once the gutters are out, and the accordion then parks
both unfocused columns exactly on the floor — so the boundary between them had
nowhere to go at all, and the one beside the focused column moved in a single
direction. It read as the pane being stuck rather than the row being full, and
no amount of work on the touch target helped, because the target was never the
problem. At 200dp the accordion can also reach its intended ratio instead of
being clamped flat, which is what leaves every boundary play in both
directions.
The boundary takes up its own space rather than floating over the columns. A grip drawn over the panes has to be confined to the header band, because Compose gives a touch to the topmost node and a full-height strip would swallow every scroll that landed near a divider. Confined, it was 16dp wide and most of a column's height from where you are looking — and a miss lands on the pane behind, taking focus and starting the accordion, so the first attempt moved the wrong thing and the second one worked. A 24dp gutter in the row overlaps nothing, so nothing is swallowed and the whole height is a target.
The dock does not make columns. Long-press briefly carried "open in a new column" and was a bad trade -- it is the only deliberate way to reassign a dock slot -- and the sideways flick that replaced it was removed in turn (see above).
Media
Full-width by default, honouring each attachment's own aspect ratio (clamped to
0.8–2.0 so neither a tall screenshot nor a panorama takes over the column);
multiples go to a two-column grid. MediaPreviewSize.Small restores the original
dense treatment where one image rides beside the text.
Sensitive media is covered, not blurred. Modifier.blur silently does nothing
below API 31, and a cover that quietly fails open on older devices is worse than
no feature at all.
Following
The button has four states, not two. Following a locked account produces a request, which the owner may never answer — so "Requested" is distinct from "Following", and neither is assumed. The call is not optimistic, unlike the post interactions: the server is the only party that knows which of the two happened, so the button spins briefly and then shows what is actually true.
Nothing renders until the relationship has loaded. A button that defaulted to "Follow" would show that for someone you already follow, and the first tap would quietly unfollow them.
Followers and following page by the Link header, not by max_id. Mastodon
documents the id parameters on those two endpoints as internal: the cursor runs
over follow rows, which the client never sees, so passing the last account's id
returns a wrong window rather than an error. The repository returns an
AccountPage carrying an opaque next-URL, and the next request follows it
verbatim.
Follow requests are answered from the notification. authorize/reject take
the account id — the request has no identity of its own in the API. The
notification doesn't change when answered (it is a log entry, not a task), so the
decision is remembered for the session and the row shows the outcome instead of
continuing to offer Accept.
Unread dots
The dot in each dock slot is driven by comparing the newest item a destination
currently holds against the newest the user has seen. The seen position is kept
locally per destination and mirrored to Mastodon's markers API for the two
timelines it supports (home and notifications), so clearing your
notifications on the web puts Horn's dot out too, and vice versa. Merges take
whichever side is further ahead — the lower of the two would resurrect a dot for
something already read.
A destination with no recorded position is seeded, not dotted. A fresh install would otherwise light every slot to announce content that was simply already there.
Dots only know about timelines something has loaded. timeline() is pure
observation and never fetches, so a Federated slot nobody has opened has no head
to compare and stays dark. That is the honest answer rather than a wrong one;
closing it properly would mean polling every docked timeline in the background.
Notifications arriving on the socket are fed back into the repository. The streamer runs in the same process as the UI, so an incoming mention lands in the in-app list and lights the dot without a round trip. Without that the log only refreshed once per process and the dot would have been theoretical.
Only for the active account, though. Sockets are open for every signed-in account, and the in-app list and the dock's dot belong to whoever is on screen right now — pushing another account's mention into them would show it under the wrong name.
Notification.isUnread has no wire field — Mastodon doesn't send one. It is this
account's read marker applied to the log, which is also what finally makes the
accent wash on unread notification rows do something.
Moderation
Mute and block read their current state from GET /accounts/relationships when
the menu opens, and the entries don't render until it arrives. A menu that
guessed would routinely offer "Mute" for someone already muted — mute and block
live on the server and change from any client.
The confirmations state consequences, not generic warnings. Blocking severs follows in both directions and unblocking does not restore them; most people don't know that, and it is not something to discover afterwards. Unmuting and unblocking skip the dialog — they're reversible and immediately visible.
Muting or blocking purges that account from the cached timelines, matching on both author and booster so boosts of them go too, and clears the disk cache. The server stops serving them on the next fetch, but pages already loaded would otherwise keep showing someone you just silenced, which reads as the action having failed.
Reporting
A full screen, not a sheet — there are four decisions (category, rules, note, forwarding) and forwarding in particular deserves reading rather than skimming.
- Rules come from
/instance/rules, so the violation list is the server's actual published rules rather than invented categories. - Send is disabled until the report is valid. A violation with no rule selected is rejected 422 server-side, so it's blocked in the UI instead.
- Forwarding defaults off, and says plainly that the remote server's moderators will see it. A report that quietly travels further than the user expected is worse than one that needed another tap.
- Blocking alongside a report is optional and secondary — if the block call fails, the filed report must not look like it failed too.
The post id goes with the report, not just the account: moderators need the thing being complained about.
List membership
The people icon on a list row opens who is in it; the row itself still opens the timeline. Two targets in one row because they are different intents — reading a list and curating it — and putting the second behind a long press would make the only way to edit membership invisible.
Candidates come from your following, not from search. Mastodon only accepts accounts you already follow into a list, and rejects anything else with a 404, so a search-the-fediverse picker would mostly offer actions that fail.
The picker doubles as a readout. Each row shows Add or Remove according to current membership, so adding somebody twice isn't possible and there is no need to flip back to check. Membership is applied locally on success rather than re-fetched — the server has no ordering to preserve, and a round trip to show one new row makes every add feel slow.
Removing drops the list's cached timeline. Otherwise posts from someone you just removed stay on screen until something else refreshes, which reads as the removal not having worked.
DELETE /lists/{id}/accounts carries a body, which Retrofit only expresses
through the generic @HTTP(hasBody = true) form.
Lists and search
Search is debounced at 350ms, and deliberately so: resolve=true makes the
server go and fetch unknown remote accounts, which is what lets you paste a
handle or profile URL and actually find someone. Firing that per keystroke would
be rude to the instance and rate-limit the user. Tapping a filter chip skips the
debounce — that's a deliberate act, not typing.
Search results are never merged into the timeline cache. Search surfaces posts from anywhere, including accounts the user has never opened; letting those into the shared cache would put strangers' posts in Home.
Lists cover viewing, opening, creating and deleting. Choosing who belongs to a list is not implemented — it's a per-account flow that belongs on a profile, and a half-built version here would be worse than sending people to the web UI.
Threads
Reached by long-pressing a post, from the post menu's "Open thread", and from tapping a notification. Tapping a reply re-centres the thread on it.
Long press used to open the post menu. It now opens the thread, since that
is the more common intent and the menu still sits behind the row's …. The old
binding is kept as a setting rather than removed, because it is the right choice
for anyone running the action row in Hidden mode — there is no … on screen
then, so "open thread" would leave the menu unreachable.
The focused post is rendered deliberately unlike a timeline row — larger body text, counts spelled out ("3 boosts" rather than a number beside a glyph), and a full timestamp with posting client. In a column of near-identical rows something has to mark which post you came for.
Its action row is always shown, regardless of the tap-to-reveal preference: the detail view has no second post to tap, so a hidden row would leave the focused post with no way to reply to or favourite it.
Reply depth is reconstructed, not stored. The API returns descendants flat,
so depth comes from walking each post's in_reply_to_id back to something
already placed. A reply whose parent isn't in the set — because that post is
hidden from you — is pinned at depth 0 rather than dropped; losing replies
silently is worse than showing them unindented. Depth is capped at 4, past which
indentation costs more width than it conveys.
The thread holds ids, not posts. Ancestors, replies and the focused post are all resolved back through the repository's status cache, so a favourite applied here, an edit made from the post menu, or a translation all repaint without the view model being told. Search results work the same way. This replaced an earlier arrangement where the thread held snapshots and manually re-read a status after each interaction, which would have silently gone stale the moment anything else could change a post.
Editing
GET /api/v1/statuses/{id}/source then PUT /api/v1/statuses/{id}.
The editor seeds from the source, never from content. The rendered content
is HTML — mentions are anchors, paragraphs are <p> — so an editor seeded from
it would show markup, and saving would publish it. If the source fetch fails the
body stays empty, Save stays disabled and the sheet says why: an edit submitted
from an empty body would replace the post with nothing.
Visibility is shown but not editable. Mastodon refuses to change it after publishing — anyone who already received the post can't be made to un-receive it.
The sensitive flag is carried through untouched. Media can be marked sensitive with no warning text, so inferring the flag from the warning (which is what posting does) would uncover that media on the first edit.
Alt text on already-attached media travels as media_attributes. The media
endpoint only accepts description changes before a status is published; newly
added attachments still go through PUT /media/{id} as when posting.
Every save writes an edit record. edited_at is set and the server keeps a
revision history, so there is no such thing as a quiet correction — which is why
the sheet says so before you save, and why the test for this feature edits a post
and then puts it back rather than leaving a marker in place.
Posts with polls are not editable. Mastodon replaces a poll wholesale on save, and an edit that didn't resend it destroys the poll along with every vote cast in it. Resending is possible but fiddly to get right, and getting it wrong is unrecoverable, so the menu entry states the reason instead of offering a path that might eat the votes.
Translation
POST /api/v1/statuses/{id}/translate, gated on
configuration.translation.enabled from GET /api/v2/instance.
It is an optional instance add-on. Translation needs an admin-configured DeepL or LibreTranslate key and most servers have none, so the menu entry is only offered where the instance says it will work. A probe that fails counts as supported — hiding a working feature because one request fell over is worse than offering it and reporting a clear failure.
Translation state rides on Status. It is client-side and never persisted,
but living on the domain object means it travels the same cache every surface
already observes, instead of needing a parallel map threaded through each
screen.
The footer names the provider and the source language. A translation presented as if the author wrote it is a quiet way to put words in someone's mouth. Tapping the footer is always the way back to the original, and toggling back and forth costs no further requests — the fetched text is kept.
Notifications
Delivery is a poll. The socket is a bonus. This is the opposite of how it started, and the distinction matters because only one of them has a price.
A periodic WorkManager job, every fifteen minutes, every signed-in account,
asking for since_id=<last notified>. No service, no ongoing notification, no
permission beyond the one already granted to post. This is what "background
notifications" means by default, and it is what most apps that appear to have
push without a push provider are actually doing.
Why there is no real push. Mastodon speaks Web Push: it POSTs an encrypted
payload to an HTTPS endpoint you register with it. Nothing on Android can be
that endpoint. Clients that manage it anyway are not talking to the instance —
the official app and its forks register push.joinmastodon.org, a relay
Mastodon gGmbH operates that forwards over FCM, where the always-on socket
belongs to Play Services; Tusky uses UnifiedPush, where a distributor app the
user installs owns the endpoint. Both need a server someone else runs, and the
Mastodon relay only forwards to the FCM sender it was built for.
Instant delivery is a separate, opt-in tier. The streaming WebSocket
(/api/v1/streaming?stream=user:notification), one per account. Android only
lets an invisible process hold a connection open inside a foreground service,
and a foreground service must show a permanent notification — so that
notification is the price of immediacy, not of notifications, and it is
charged only to people who ask for it. It sits on an IMPORTANCE_MIN channel.
While Horn is on screen the socket runs for free. AppForegroundStreamer
observes ProcessLifecycleOwner and opens the same sockets with no service and
no notification, then drops them the moment Horn is backgrounded — a socket with
no service behind it is killable at any point, so leaving it up would trade
battery for a guarantee Android will not honour.
Every signed-in account, not just the active one. The account you are not
looking at is exactly the one whose mentions you would otherwise miss. That
rules out MastodonApi for this work, because InstanceInterceptor resolves one
global session; MastodonDirectApi takes the host and token explicitly and runs
on the unauthenticated client instead. Making the active session mutable from a
worker would have raced whatever the user was doing in the app.
Notifications group per account, and are labelled with the receiving handle only
when more than one account is signed in. Child notification ids are keyed on
"$accountKey:$notificationId" — server ids are unique within an instance, so
two accounts whose servers both numbered a notification 12345 would otherwise
overwrite each other. Tapping one carries the account key and switches first.
At most five per account reach the shade per pass. Android silently drops anything past 25 live notifications from one package. An uncapped catch-up across two accounts exceeds that, so the failure mode is not "noisy" — it is losing the notifications that matter under the ones that don't. The marker still advances to the newest fetched, so the backlog is not dripped out five at a time for the next hour; the rest are in the in-app list.
The group summary must not alert. It is posted on the mentions channel, and
with the default GROUP_ALERT_ALL Android treats it as the group's
representative and heads-up it rather than the child — which is why the banner
once read "Horn" and nothing else while the shade showed the real content.
GROUP_ALERT_CHILDREN on the summary is the fix. The summary also carries
InboxStyle lines read back from activeNotifications, because delivery is
split across a socket, a worker and sometimes a fresh process, and no one object
sees every notification it would need to keep a running list.
The ongoing notification needs removing explicitly. A process killed while
in the foreground state leaves it behind, and it carries NO_CLEAR, so the user
cannot swipe it away and the app cannot cancel it either — only the owning
service can release it. stopForeground(STOP_FOREGROUND_REMOVE) in onDestroy.
The high-water mark is per account, persisted, and only ever advances. The paths outlive each other and can finish out of order, so taking the lower id would re-announce everything in between. On first run it records where we are without notifying — enabling the feature should not dump forty alerts about things you already read.
A notification dated too far in the past is silently discarded. Measured on
a Galaxy Z Fold 7: notify() returns, areNotificationsEnabled() is true, and
no record is ever created. Anything up to 7 days old survived; 14 days and older
did not. This cost a long debugging session because every observable signal
inside the app said the post had worked — the symptom was an account that had
been quiet for a while delivering nothing at all from its catch-up poll, which
looked exactly like multi-account delivery being broken.
So when is the event's own time only while it is recent, and otherwise now.
That is also the better answer on its merits: a three-week-old follow dated
three weeks ago sorts beneath everything in the shade, and "now" is honestly
when you are being told. The cutoff is a day, well inside the measured margin.
An unrecognised notification type is dropped, not guessed at. Mastodon
keeps adding them — moderation warnings, severed relationships, admin sign-up
reports, annual recaps. They used to fall through to Update, which meant
announcing "edited a post" about something that was nothing of the kind, on an
IMPORTANCE_MIN channel where it could not be read anyway.
NotificationType.Unknown exists so the mapping stays total without lying; the
presenter skips it, the in-app row says "sent a notification", and the
high-water mark still advances past it.
One channel per notification kind. Mentions are IMPORTANCE_HIGH, boosts
and favorites are LOW, edits are MIN. That puts per-category control in the
system settings people already know rather than in a second set of switches
inside Horn that could disagree with them.
sessionSnapshot is not safe to read in background code. It is populated as
a side effect of someone collecting authState, which happens in the UI process
and nowhere else — a worker, a boot receiver or a service restarted by the
system all start cold and would have seen "signed out" on a signed-in device.
AuthRepository.awaitSession() reads it off disk when it hasn't been loaded; use
that anywhere outside composition.
Emoji and GIFs
Emoji substitution is length-preserving. Post content already carries link
annotations computed against plain-text offsets, so replacing :shortcode: with
something shorter would silently slide every mention and hashtag span out of
place. appendInlineContent is handed the original :shortcode: as its
alternate text, so the string length is identical going in and out. Appending the
annotated subsequence carries styles across, so nothing is re-applied
afterwards. Don't "optimise" that into a plain-string rebuild.
Emoji are sized in em, so they scale with the text-size preference rather than
being pinned to a dp value that looks wrong at the extremes. Only shortcodes
actually present in the text get a placeholder — instances publish hundreds.
Mastodon's gifv is not a GIF. The server transcodes uploaded GIFs to silent
MP4, so animating them is video playback, not image decoding — hence Media3
alongside coil-gif. gifv autoplays muted and looping inline with no controls;
real video shows its still preview in the timeline and plays in the viewer, since
autoplaying a column of videos is a different proposition. Players are released
on dispose and paused on background; in the viewer only the visible page plays.
coil-gif covers animated GIF and WebP, which is what makes animated custom
emoji move. Two decoders are registered because the platform ImageDecoder path
only exists from API 28 and minSdk is 26.
Link cards
Rendered horizontally (thumbnail, source, title) rather than as a full-width banner: a hero image costs more height than most posts in this timeline, and a link shouldn't dominate the column it sits in.
Three rules worth keeping:
- Suppressed when the post has its own media. Showing an attachment and a preview doubles the row height for no extra information.
- A card with only a URL is dropped. Servers return a half-populated card while the OpenGraph crawl is pending, or when the target has no tags at all; rendering that gives an empty grey box that looks broken.
- The source domain is always shown, falling back to the URL's host when the server gives no provider name. You should be able to see where a link goes before tapping it.
Cards and inline links open in a Custom Tab, so the real URL and padlock stay visible — which matters when the link came from a stranger's post.
Composing
The character counter is not String.length. Mastodon counts every URL as a
flat 23 characters regardless of length, and in a mention only @username
counts — the @domain is free. core/util/StatusLength.kt implements both. Get
this wrong and the counter says a post fits while the server rejects it. The URL
regex deliberately errs toward not matching, since that overestimates and warns
early rather than undercounting.
Leaving a draft asks first. Back and Close run through one path, because they are the same act and used to behave differently: Close discarded a half-written post silently, and back fell past the sheet to the system and closed the whole app. The prompt only appears when there is something to lose — "dirty" is measured against the seeded state, so backing straight out of a reply that pre-filled a mention, or an edit that pre-filled the post, closes on the first tap with no dialog.
The three actions are stacked rather than laid in a row, in order of consequence — keep, park, destroy. Three buttons across a phone either wrap badly or shrink until "Discard" and "Save draft" are a glance apart, which is the one mistake the dialog exists to prevent.
There is exactly one saved draft. A drafts list needs its own surface for browsing, naming and deleting, and without one saved drafts pile up invisibly until they are indistinguishable from a leak. One slot has an obvious lifecycle: it is the thing you last put down. It survives process death (DataStore), is cleared on publish and on sign-out, and a restored sheet says so with a "Start fresh" way back to blank.
A draft remembers what it was replying to and is only offered back on a reply to that same post, so it can't resurface attached to the wrong conversation. Only finished uploads are kept — their ids stay valid on the server for a while but not forever, so a long-parked draft can fail to post with its media, and the post error says so rather than this layer pretending otherwise. Editing a post is deliberately excluded: a parked edit would be applied to whatever the post looks like whenever it is next opened.
Posts carry an idempotency key. One key per attempt, regenerated only on success, so a retry after a timeout can't publish twice.
Media upload waits for processing. POST /api/v2/media returns 202 with a
null url while the server transcodes; posting a status with an unready id
fails, so the upload polls until the attachment resolves. Alt text is applied
through a separate PUT once the attachment exists.
Statistics are derived. Mastodon exposes no per-account activity endpoint
(/instance/activity is instance-wide), so inbound counts come from the
notification log and posts/replies from the account's own statuses. The window
only reaches as far back as the pages fetched, so a busy account under-reports
older days.
Build
./gradlew :app:assembleDebug
Requires the platforms;android-37.0 SDK package. Note the minor version — Android
now ships minor platform releases and platforms;android-37 does not exist. The
bundled cmdline-tools may be too old to see it; cmdline-tools;latest (23.0+)
can.
Toolchain notes
The version combination here is load-bearing and not obvious:
- AGP 9.4.1 — Hilt 2.60.1 refuses to apply on anything below AGP 9.0.
- Gradle 9.8.1 — AGP 9.4.1 calls Gradle APIs that 9.4.1 itself lacks.
- Kotlin 2.3.21, overridden on the buildscript classpath. AGP 9 has built-in
Kotlin and ships KGP 2.2.10; Compose BOM 2026.09 and Hilt are built against the
2.3 line.
org.jetbrains.kotlin.androidmust not be applied — AGP 9 rejects it. See the comment block in the rootbuild.gradle.kts. - compileSdk 37 — current AndroidX requires it.
Layout
core/designsystem/ theme tokens, hand-authored icon set, Avatar
core/util/ relative time, Mastodon HTML -> AnnotatedString
data/model/ Mastodon-shaped domain types
data/repository/ TimelineRepository interface
data/mock/ offline fixtures + in-memory implementation
prefs/ DataStore-backed settings
navigation/ dock catalogue, pane model and breakpoints
feature/ timeline, dock, compose, notifications, statistics,
profile, settings
Why these choices
Hand-drawn icons. Material Symbols are a different drawing language — heavier,
tuned for 20dp, and missing the distinctive glyphs entirely (boost rocket, arch
home, activity squiggle). Mixing sets reads as borrowed. Everything is drawn to one
spec in HornIcons.kt.
HornColors instead of Material's ColorScheme. The timeline needs tokens
Material has no name for: the inverted action bar, boost attribution, the
selected-row wash. A Material scheme is still derived for ripples.
Panes instead of a NavHost. With several columns live there is no single
"current destination" for a nav graph to track. Each pane owns its own
TimelineViewModel, keyed by pane id and destination.
Boosts keep their wrapper. Status.reblog mirrors the API rather than being
flattened, so the booster's identity and the boost's own id survive into the UI.
Enums persist by name. Ordinals would silently remap every stored preference the first time someone reorders an enum.
Density moves type, not just spacing. Roboto sets wider than SF Pro at the same
nominal size, so a compact mode that only tightened margins still ran about a
quarter fewer characters per line than the reference. Each TimelineDensity
carries a typeDelta folded into the scale; Compact is -1sp. If rows read too
tight, Comfortable is the old sizing.
The dock's chevrons are an affordance, not a button. They advertise the vertical flick. They were briefly tappable, which was a mistake: they sit left of the glyph, so a slot's optical centre lands on them and aiming at a slot opened the picker instead of navigating. Tap navigates, long-press opens the picker, a vertical flick cycles.
Developing offline
Flip the @Binds in di/AppModule.kt from MastodonTimelineRepository back to
MockTimelineRepository to work on UI with no network and no login. The fixtures
in data/mock/MockData.kt deliberately cover the awkward cases — boosts, content
warnings, open and closed polls, multi-attachment media, four-digit counts.
Gotchas worth remembering
okhttp-logging must be implementation, not debugImplementation.
NetworkModule lives in main and references the interceptor type, so a
debug-only dependency fails the release variant — and because the unresolved type
is in a Hilt module, the error surfaces as a wall of confusing KSP
"T could not be resolved" messages rather than a missing class. Build
:app:compileReleaseKotlin occasionally; debug-only builds hide this.