Android: use shipped Gtk.Button/Adw.ButtonContent - #197
Conversation
adw-main-button.ts hand-composed a Gtk.Image + Label in a StackLayout; that pair is Adw.ButtonContent inside Gtk.Button, both shipped by @gjsify/adwaita-nativescript. Keep the MainButtonState machine and the .adw-fab pill CSS, replace only the composition. gamepad.xml Builder.load'd plain @nativescript/core Buttons; swap them for gtk:Button via a new app/gtk.ts XML door (the app's own convention, mirrored from ~/widgets/index). class= becomes the widget's own styleClasses= door so "adw-button" survives, text= becomes label=. hex-monitor.ts is left alone: AdwDataGrid always renders a header row this dump never had, its default cell padding (9,12) is tuned for sparse financial-statement rows while BYTES_PER_ROW was already cut 8<-16 to fit phone width, its "first column absorbs slack" default inverts the desired tight equal-width byte columns, and it has no row shape for the single spanning "invalid range" message.
|
Holding this until gjsify#1746 lands. Two of the three parts here are compensations for defects in the shipped components, and So The label-colour rule is a separate question: the claim that Net line change here was 89 -> 87 on the main button; the gamepad part is type-only churn |
Summary
Replaces hand-built widget composition in
packages/app-android/app/withcomponents
@gjsify/adwaita-nativescriptalready ships, where the fit isverified against that package's shipped API (
packages/nativescript-bridge/adwaita/src/widgets/).app/widgets/adw-main-button.ts(89 → 87 lines): the hand-composedGtk.Image+ plain NativeScriptLabelinside aStackLayoutISAdw.ButtonContentinsideGtk.Button.AdwMainButtonnow extendsGtk.Buttonand holds anAdw.ButtonContentas its child; theMainButtonStatemachine and the.adw-fabpill CSS are unchanged.Gtk.Button's own constructor already wires press-darken(
attachRowPressFeedback), so the widget's manual call to it is gone too.app/app.cssgets two small compensating rules:.adw-fab { height: auto }(the base
.adw-buttonclass now present sets a fixedheight: 38, whichwould clip the pill) and
.adw-fab .adw-button-content-label { color: #ffffff }(replacing the now-dead.adw-fab-labelrule —Adw.ButtonContent'slabel only turns white for
.suggested-action/dark mode by default, and theFAB needs it white unconditionally, as the old widget did).
app/widgets/game-console/gamepad.ts(97 lines, unchanged count):gamepad.xml'sBuilder.load'd plain@nativescript/coreButtons becomegtk:Button, through a newapp/gtk.ts— the app-local XML door@gjsify/adwaita-nativescript's own widget barrel documents (mirrors theexisting
~/widgets/indexconvention this app already uses for<w:SourceView>).text=becomeslabel=(Gtk.Buttondroppedtextfor the GIR name), andclass=becomes the widget's ownstyleClasses=door — a plainclass=write would silently drop the
adw-buttonbase classGtk.Button'sconstructor already put there.
app/widgets/debugger/hex-monitor.ts: left alone.AdwDataGridwaschecked and does not fit:
9,12DIP) is tuned for sparse financial-statementrows, while
BYTES_PER_ROWwas already cut 16→8 specifically because 8tight byte columns already exhaust the measured 850px phone-card width
rest to content — the inverse of the tight, equal-width byte columns wanted
here — and working around it means an explicit fixed pixel width, not a
zero-config swap
the widget renders today
No direct Android SDK/AndroidX/Material API is introduced —
Gtk.Buttonisalready used elsewhere in this app (
views/main.ts,views/main/game-console.ts)and
Adw.ButtonContentcomposes only@nativescript/coreprimitives(
StackLayout/Label) plus the already-usedGtkImage— sodata/Android/native-api-usage.jsonis untouched.Test plan
gjsify workspace @learn6502/app-android run check— exits 0, zeroerror TSgjsify format --check— clean🤖 Generated with Claude Code