Repository navigation
ADFA-5074 refactor(ui): the working animation, resolved instead of copied - #379
Merged
Merged
Conversation
…pied The Lottie block was pasted verbatim into three card layouts — ZIM, Maps and module install — each with the file name written in its XML, and was missing from Courses entirely. That is how a type ends up without one and how three copies drift apart. One shared layout now holds the block, and each card includes it where its own composition wants it: placement stays the card's business, the asset does not. The block declares no lottie_rawRes on purpose — a layout that can show an animation on its own is a layout that can contradict the rule — so nothing plays until a card asks ProgressVisuals for it. The rule itself is in the domain: ProgressVisual resolves from the execution class, live work is a download and stopped work is a build, unit-tested on the JVM. ProgressVisuals maps that to a raw resource, and is the only place in the app where the file name appears. BUILD deliberately resolves to the same asset for now: Maps wants art of its own and does not have it yet, and a placeholder beats a second copy. Giving it one is a line there, or a case in the domain if a single module turns out to need its own — no layout is touched either way. The three existing blocks were verified identical before extracting, so they render as before. Courses gains the animation in the same position as the others, which is the only visible change.
…overclaiming Review follow-ups. applyForModule took no module name, so it built the operation with an empty platform — and the per-platform exception in forOperation matches on platform(). The hook that justified resolving instead of placing was unreachable from the one place most likely to need it. It takes the key now, and a test fails if that regresses. The key parsing moved to the domain as ProgressVisual.forKey, which is where ContentType.byKey already lives; it had been put in presentation out of habit. That also makes it testable, so "mod:", an unknown key and an empty one are covered — the prefix is the part that breaks quietly, and an off-by-one there would classify every module as content. The module-install card's block was spaced at 16dp, not the shared 12dp. I called the three blocks identical having compared only their contents, not the frame around them; its include overrides the margin. ProgressVisuals moved out of redesign to util, beside Snackbars and ByteFormatter, so a shared UI helper does not live in the legacy flat package and kolibri stops reaching into it for this. And the shared layout no longer says "the animation, once", because it is not: BackupJobFragment picks k2go_backup_loop or k2go_restore_loop from its mode (ADFA-4961), by this same principle, written earlier. It stays outside on purpose — backup and restore are system operations, not content — so the comment names it and a TODO says to extend that precedent rather than build a third mechanism.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
First step of the one-host work; this PR only covers the animation.
The working Lottie was pasted verbatim into three card layouts — ZIM, Maps and
module install — each with the file name written in its XML, and was missing from
Courses entirely. That is how a type ends up without one and how three copies
drift apart.
One shared layout now holds the block and each card includes it where its own
composition wants it: placement stays the card's business, the asset does not.
The block declares no
lottie_rawReson purpose — a layout that can show ananimation on its own is a layout that can contradict the rule — so nothing plays
until a card asks.
The rule is in the domain:
ProgressVisualresolves from the execution class,live work is a download and stopped work is a build, unit-tested on the JVM
along with the
mod:key parsing.ProgressVisuals(util) maps that to a rawresource and is the only place in the app where the file name appears. A module
passes its own key, so the per-platform exception point is reachable from the one
place most likely to need it.
BUILDdeliberately resolves to the same asset for now: Maps wants art of itsown and does not have it yet, and a placeholder beats a second copy.
Not every animation in the app.
BackupJobFragmentpicksk2go_backup_loop/k2go_restore_loopfrom its mode (ADFA-4961) by this sameprinciple, written earlier, and keeps its own block — backup and restore are
system operations, not content. The shared layout says so and a TODO says to
extend that precedent rather than build a third mechanism.
The three existing blocks were verified identical before extracting, except the
module card's 16dp margin, which its include overrides. Verified on device: the
four details show one animation each, the three existing ones unchanged, and the
backup screen still uses its own.