K2GO-385 refactor(ui): shared filter chip, button roles and status badge - #545
Merged
luisguzman-adfa merged 11 commits intoSep 5, 2026
Merged
Conversation
…rt, Books filters)
PR3 third slice, part 1 -- the filter-chip role from the pill-roles design decision
(board k2go-chip-vs-button-v1). Three screens each hand-rolled their own selectable
chip, which is why the ZIM sort chips ("By size", "A-Z") looked different from the
category chips and from the Books filters. Unify them into one component.
- New shared K2GoFilterChip: a Material 3 Chip styled to the decision's filter-chip
spec -- 8dp corner, 32dp (the 32dp step on the 4dp role ladder), selectable with a
leading check when active, app-teal (filled + on-teal text when selected;
transparent + teal outline + teal text when not). create(...) builds one;
style(chip, selected) applies it to an XML-inflated chip.
- ZimLandingFragment (category filters) and BooksLandingFragment (Popular / Educational
/ My books) build theirs through create(), dropping their 48dp teal-pill / drawable
builders.
- ZimCategoryFragment sort chips (By size / A-Z / Grouped) become Material Chips in the
layout and are styled through style() on every render; the label still carries the
sort direction ("By size ▲").
Shape now signals the type -- 8dp corner + check = a toggle -- distinct from the stadium
action button, the dot+text status and the 8dp metadata tag. First Material Chip use in
the app (the theme is already Material 3, so the widget resolves).
…oot-surface variant + FQR) PR3 third slice, part 2 -- the download-progress buttons were the last surface off the one app button system (three button strategies coexisted). Bring them in, respecting that they sit on two different surfaces. - New boot-surface button variants Widget.K2Go.Button.Outlined.OnBootPaper / Widget.K2Go.Button.Text.OnBootPaper: the app button's stadium shape + type, but colour from the fixed boot tokens (k2go_boot_ink/muted). The rootfs download surface is a fixed light "paper" in both light and dark (ADFA-4814), so a theme-coloured button would be unreadable there. - activity_library rootfs download: Pause/Resume/Retry and Cancel move from bare Widget.Material3.Button.Outlined/Text (+ inline boot colours) to those variants -- same boot colours, now with the app's stadium shape, and the colour recipe lives in the style. - FqrController maps download overlay: its Stop/Retry + Cancel move from a bare Material3 outlined button to Widget.K2Go.Button.Outlined via the shared ThemeOverlay. FQR's overlay is a themed (day/night) surface, so the K2Go outlined style's theme teal is correct there -- not the boot tokens. So both download surfaces now use the app's stadium button; they differ only in colour source (fixed boot tokens vs theme), which is the real difference between the surfaces.
…olibri browse chips Two things found reviewing PR3c on device. 1. The filter chip's check never showed. A bare new Chip(ctx) picks up the theme's default (Assist) chipStyle, which carries no checkedIcon, so setCheckedIconVisible alone drew nothing. Set a plain check (new ic_check_16) explicitly on the chip; it tints on-teal on the selected fill. The check is the design's "toggle" cue, so every filter chip (ZIM / Books / Kolibri) now shows it. 2. KolibriBrowseFragment was a missed filter-chip surface -- its own sort toggles (By size / A-Z) and category chips still used the old k2go_chip_bg/k2go_pill_bg drawable pair, so they looked different from the ZIM/Books chips. Migrate them onto K2GoFilterChip like the others (sort chips: TextView -> <Chip> in the layout, styled via style(); category chip: create()); the sort label still carries its direction.
…tton styles Theme.K2Go sets materialButtonStyle to Widget.K2Go.Button, so a bare <Button> already inflates as the filled teal stadium button (on_teal text, caps off) and the per-layout android:textColor="@android:color/white" + android:backgroundTint="@color/k2go_teal" (+ textAllCaps="false") on 16 filled CTAs were re-stating the style. Removed them so the button style owns colour and type in one place; text now uses the semantic on_teal token instead of pure white. Also point the two remaining raw-Material3 buttons at the K2Go styles: fragment_k2go_library home status action -> Widget.K2Go.Button.Outlined, fragment_k2go_backup_job cancel -> Widget.K2Go.Button.Text.
…t a filled pill Pill-roles Q4: the Authentication service state (Default / Custom / Not installed) is a status, so it now renders as the shared K2GoStatusBadge (semantic dot + text) instead of a hand-rolled filled TextView pill. Colours are unchanged -- Default and Not installed neutral, Custom teal -- so only the form changes (dot+text, no container), matching the other lifecycle statuses. Drops the local setChip pill helper and its k2go_pill_bg / k2go_pill_teal use here.
Pill-roles Q9 flags the "Recommended" element in the edition select row as a filled teal pill that competes with the row's own radio and reads as an action. In our code that element was already dead: ADFA-5295 stopped steering users to an edition, so every edition passes recommended=false and k2go_edition_reco is always GONE. Rather than restyle UI that never renders, remove the scaffolding -- the reco TextView (and its now single-child wrapper), the recommended field/constructor arg, and the visibility line. If a recommended edition is ever reintroduced, Q9's answer is a subtle trait tag (K2GoChip valence), not a filled pill. The k2go_recommended string is left in place (a plausible future reuse); it now reads as an unused resource until then.
Pill-roles Q8: an inline action (Copy, Share) is the text tier of the button, never a raw TextView -- so it gets a ripple, a 48dp target and a leading icon. The manual pairing-code block's Copy and Share (fragment_k2go_clone) move from clickable TextViews to Widget.K2Go.Button.Text with a leading icon (ic_content_copy / new ic_share); the per-view padding / textColor / textAppearance the style already owns are dropped, and Share loses its trailing chevron for the leading share glyph. Java is unchanged (MaterialButton is a TextView).
bg_beta_pill.xml has no references in code or layouts (verified by grep); it is leftover from a retired beta pill. Remove it so the drawable set stays honest.
…ouch ripple Pill-roles Q6, light variant. The Connect and Clone two-way mode strips (Hotspot/Wi-Fi, Send/Receive) keep their teal-strip look -- the active segment already renders as a teal pill with on-teal text -- but were plain TextViews: no ripple, and a screen reader read them as loose labels. They now expose radio-group semantics (each segment announced as a checkable RadioButton, checked when active, marked selected) and get a touch ripple from android:foreground. The change also removes a duplicate truth: the identical paintTab lived in both ConnectFragment and CloneFragment; both now call one shared SegmentedTabs.paint. A full MaterialButtonToggleGroup swap was deliberately not taken -- the visible result is the same teal strip, so the churn across these two large fragments did not buy a user-visible change.
A horizontally-scrollable filter-chip row could end a chip flush at the edge, so it read as the last chip and hid the rest (seen on the ZIM landing: selecting a right-side group pinned it to the edge, hiding the following groups). Per the design (k2go-chip-scroll-affordance-v1), add a shared K2GoFilterChip.revealSelected(scroll, row): a horizontal edge fade (34dp -- kept legible for low vision, right while more remains, left once scrolled) plus, on (re)build, a scroll that reveals the selected chip with its neighbours peeking instead of pinned to an edge. Wired into ZimLandingFragment's category chip row -- the only live scrollable filter row. Books has three non-scrolling chips and Kolibri's group row is GONE until its groups are authored; both call the same shared helper when needed.
The Copy action's string carried a "glyph as icon" prefix; once Copy became a Material text button with a leading app:icon (the official Material content_copy), the glyph and the icon rendered as two copy icons side by side. Remove the prefix from k2go_clone_copy_btn across all 34 locale files -- the single official Material icon comes from app:icon now. Share was already plain text, so it was unaffected.
luisguzman-adfa
deleted the
refactor/K2GO-385-filter-chips-boot-buttons
branch
September 5, 2026 21:54
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.
Applies the pill-roles decision to the chip / button / status surfaces (the non-dialog, non-typography part of K2GO-385), and cleans up the button layer while in there.
Filter chip. One shared K2GoFilterChip (8dp corner, 32dp, a leading check when selected) replaces the three per-screen chip builders that had drifted apart: ZIM landing (theme chips), ZIM category (By size / A-Z / Grouped sort), Books (Popular / Educational / My books), plus the Kolibri browse sort + category chips. New ic_check_16 for the checked state (a bare Material chip has no checked icon).
Buttons on the app system.
Dropped the redundant per-layout textColor=white + backgroundTint=teal (+ textAllCaps) on 16 filled CTAs -- Widget.K2Go.Button already owns them, so text now uses the on_teal token. No visible change intended.
Two raw-Material3 buttons point at the K2Go styles: library-home status action -> Widget.K2Go.Button.Outlined; backup-job cancel -> Widget.K2Go.Button.Text.
The rootfs download controls join the app button system: new Widget.K2Go.Button.*.OnBootPaper variants (app stadium shape + the fixed boot tokens, because that surface is a fixed light paper in both themes, ADFA-4814); the FQR maps overlay uses the theme-teal K2Go outlined style via the shared overlay.
Clone's manual pairing-code Copy / Share move from raw TextViews to Widget.K2Go.Button.Text with a leading icon (new ic_share).
Status badge. The Authentication service state (Default / Custom / Not installed) reads as the shared K2GoStatusBadge (dot + text), not a filled pill -- colours unchanged (Custom teal, others neutral).
Segmented strips. The Connect / Clone mode strips (Hotspot/Wi-Fi, Send/Receive) keep their teal-strip look but now expose a single-select radio group to accessibility services and gain a touch ripple; the identical paintTab from both fragments is unified into one SegmentedTabs. (Deliberately the light variant -- the strip already renders as a segmented control, so a full MaterialButtonToggleGroup swap was not taken.)
Removals. The dead "Recommended" edition pill (ADFA-5295 stopped steering, so it never rendered) and the unreferenced bg_beta_pill drawable.
Verification. Visual; on-device pass pending -- filter chips show the check; boot + FQR buttons stay readable (incl. dark mode); the two style-swap buttons fit their rows; the auth state reads as a dot+text badge; Copy / Share are text-tier buttons; the segmented strips ripple and announce as radios.