This folder goes deeper into each scaling strategy in AppDimens Dynamic: what it is, the formula, how to import it, and when to pick each mode. Each strategy’s code lives in com.appdimens.dynamic.compose.<strategy> and com.appdimens.dynamic.code.<strategy> with no cross-imports between strategies.
Product docs: PRD.md (product requirements) · PDR.md (technical design, development plan, prompt requirements, traceability matrix) · MATHEMATICS-AND-CALCULUS.md (formulas, constants, and calculation kernels).
For cache, bypass, and performance, see also library/PERFORMANCE.md.
Naming parity (compose vs code): In library/src/main/java/com/appdimens/dynamic/, each strategy folder pairs Dimen<Strategy>DpExtensions.kt (layout facilitators → Float px + Context) with Dimen<Strategy>SpExtensions.kt where Sp facilitators exist — the same filenames as under compose/<strategy>/, so it is easy to jump between UI toolkits. Scaled uses DimenSdpExtensions.kt and DimenSspExtensions.kt inside the scaled/ subfolder (packages stay top-level compose / code). Plain View helpers remain in Dimen<Strategy>PlainPx.kt per strategy plus shared logic in com.appdimens.dynamic.code.plain.
Compose API (catálogo scaled, convenções de nomes e comportamento espelhado nas outras estratégias): COMPOSE-API-CONVENTIONS.md — inclui §4.5 helpers View/code Plain (Float px + Context, Dimen*PlainPx.kt por estratégia, lógica partilhada em com.appdimens.dynamic.code.plain). Resize por restrições (autoResize*, ResizeBound, compose.resize / code.resize) está em resize.md e no KDoc: compose.resize, code.resize.
KDoc API reference (gerado a partir do KDoc /** … */ da library — pacotes, tipos, membros): index.md. Os ficheiros por símbolo estão em KDOC/ (caminhos curtos sem [ / ] para o GitHub resolver links Markdown).
Atualizar KDOC/ a partir do HTML do Dokka: com a saída já gerada em DOCUMENTATION2/ (ver library/build.gradle.kts), execute na raiz do repo: python3 scripts/sync_kdoc_from_dokka_html.py — reescreve DOCUMENTATION/KDOC/ e o ficheiro package-list a partir desse HTML (sem precisar de voltar a correr o Gradle neste passo). Depois de alterar código ou KDoc, gere HTML com ./gradlew :library:dokkaGenerateHtml e volte a correr o script para manter nomes e membros alinhados (por exemplo unitSizeInDp em vez de unitSizePerPx).
Nota: o Dokka pode mostrar ERROR CLASS em tipos Compose nas páginas exportadas; isso reflecte a resolução de classpath na geração, não um erro da library. As páginas narrativas (scaled.md, library/PERFORMANCE.md, COMPOSE-API-CONVENTIONS.md) podem estar mais actualizadas em texto corrido do que tabelas KDoc até sincronizar.
| Strategy | Document |
|---|---|
| Unified math (all strategies) | MATHEMATICS-AND-CALCULUS.md |
| Scaled (default SDP / HDP / WDP) | scaled.md |
Percent (linear 1/300 + space*) |
percent.md |
| Power (sublinear) | power.md |
| Fluid (320–768 dp band) | fluid.md |
| Auto (linear + log after 480 dp) | auto.md |
| Diagonal | diagonal.md |
| Fill (“cover”) | fill.md |
| Fit (“contain”) | fit.md |
| Interpolated | interpolated.md |
| Logarithmic | logarithmic.md |
| Perimeter | perimeter.md |
| Density | density.md |
| Resize (constraint-based auto-fit) | resize.md |
| Physical units (mm, cm, in) | physical-units.md |
- KDoc API — root index
0b. Mathematics & calculus — formal reference - Compose API reference — conventions & scaled catalog
- Scaled — recommended starting point
- Percent
- Power
- Fluid
- Auto
- Diagonal
- Fill
- Fit
- Interpolated
- Logarithmic
- Perimeter
- Density
- Resize
- Physical units
- Mathematics & calculus
flowchart LR
start[New_layout]
scaled[scaled_sdp_hdp_wdp]
qa[QA_phone_tablet]
other[Other_strategy]
start --> scaled
scaled --> qa
qa -->|curve_not_right| other
Always start with scaled; switch strategy only where visual QA or requirements (TV, ultrawide, split-screen) need a different growth curve.