feat(android): neutral chat surfaces, symbol icons and reading tokens

Lay the shared foundation for iOS-level chat polish:

- Typography tokens mirror iOS HapiTypography: zero tracking on body
  slots, trimmed leading, strict CJK line breaking, row title/subtitle and
  heading tokens; code uses bundled JetBrains Mono NL (OFL, no ligatures).
- Static schemes get hue-free surface ladders (Material's baseline tinted
  every surface lavender) and the dark scheme sets onPrimary instead of
  inheriting Material purple. NeutralChatSurfaces keeps conversation
  surfaces gray under Material You; presets and OLED pass through.
- Extended colors add textSecondary, cardSurface and composerSurface.
- Material Symbols Rounded vector drawables (ic_sym_*) replace emoji and
  text glyphs in later commits; ChatActionButton is the one inline action
  style (48dp minimum, 10dp corners, one filled primary).
- Transcript rows use iOS TranscriptRowRole gaps instead of a flat 10dp.
- Roborazzi + Robolectric visual specimens (record on demand; Roborazzi
  pinned to 1.60.0 because 1.61+ ships Kotlin 2.3 metadata).
This commit is contained in:
weishu
2026-11-13 16:42:32 +08:00
parent 6ea40f9e44
commit 0a8bb2ffc7
55 changed files with 918 additions and 85 deletions
+34 -3
View File
@@ -369,11 +369,42 @@ content, or a failed clipboard operation, offers UTF-8 file export through
FileProvider and Android's sharesheet; Binder receives a URI, not the text.
Exports older than 24 hours are cleaned on the next export.
Body/composer/user text uses 16sp/24sp, code/diff/terminal 14sp/20sp, captions
12sp/16sp. Content and composer share a centered 720dp reading column with
16dp minimum side margins. Bubble widths use actual container constraints,
Reading metrics match iOS `HapiTypography` (`ui/theme/HapiTypography.kt`):
body/composer/user text 16sp/24sp with zero tracking, strict CJK line breaking
and leading trimmed above the first and below the last line; code/diff/terminal
14sp/20sp in bundled JetBrains Mono NL (SIL OFL, no ligatures); inline code 14sp
on a glyph-hugging chip; captions 12sp/16sp; headings 24/20/18/17sp semibold.
Markdown blocks are 12dp apart, 24dp before a heading and 8dp after one; list
items 8dp. Transcript rows use iOS `TranscriptRowRole` gaps (8dp between tools
or between user prompts, 24dp before and 16dp after a user turn, otherwise
12dp). Content and composer share a centered 720dp reading column with 16dp
minimum side margins. Bubble widths use actual container constraints,
including split-screen; Android font scaling remains enabled.
Chat surfaces stay neutral gray: the static schemes carry hue-free surface
ladders, and `NeutralChatSurfaces` reapplies them over Material You so the
wallpaper only tints accents inside a conversation (presets and OLED pass
through). Transcript icons are Material Symbols Rounded vector drawables
(`res/drawable/ic_sym_*`, Apache-2.0), never emoji or text glyphs. Inline
actions (approvals, plan actions) share `ChatActionButton`: 48dp minimum,
10dp corners, one filled primary per row.
### Visual specimens
`app/src/test/.../specimens/` renders deterministic, non-networked specimens
(Markdown, reasoning, tool cards, approvals, composer states) under Robolectric
native graphics in light/dark/OLED. Ordinary unit-test runs only compose them;
capture images with:
```sh
./gradlew :app:recordRoborazziDebug --tests 'app.hapi.companion.specimens.*'
# → app/build/outputs/roborazzi/specimens/*.png
```
They are review aids for visual changes, not committed goldens or store
screenshots. Roborazzi is pinned to 1.60.0: later releases ship Kotlin 2.3
metadata this Kotlin 2.1 build cannot read.
## Connection status and home filters
The chat subtitle reserves its height. **Reconnecting · Tap to retry** appears
+10
View File
@@ -8,6 +8,8 @@ plugins {
alias(libs.plugins.kotlin.compose)
// New-session form draft + prefs persist as JSON blobs in DataStore (B-M3d).
alias(libs.plugins.kotlin.serialization)
// Visual specimens: `./gradlew :app:recordRoborazziDebug` (README).
alias(libs.plugins.roborazzi)
// com.google.gms.google-services is applied CONDITIONALLY below (B-M4a):
// the plugin hard-fails when app/google-services.json is missing, and the
// repo must build green without any Firebase project configured.
@@ -132,6 +134,8 @@ android {
}
testOptions {
// Robolectric specimens resolve fonts, drawables and strings.
unitTests.isIncludeAndroidResources = true
unitTests.all { test ->
// Chat pipeline smoke tests replay golden fixtures from the repo
// root (same wiring as :core:protocol / :core:data).
@@ -213,4 +217,10 @@ dependencies {
testImplementation(libs.turbine)
// Generated media fetch tests: real HTTP round-trip against localhost.
testImplementation(libs.okhttp.mockwebserver)
// Visual specimens (Compose rendered under Robolectric native graphics).
testImplementation(platform(libs.androidx.compose.bom))
testImplementation(libs.androidx.compose.ui.test.junit4)
testImplementation(libs.robolectric)
testImplementation(libs.roborazzi)
testImplementation(libs.roborazzi.compose)
}
@@ -32,6 +32,7 @@ import app.hapi.companion.feature.chat.composer.DictationController
import app.hapi.companion.ui.markdown.LocalMarkdownLinkHandler
import app.hapi.companion.ui.markdown.LocalMarkdownRenderCache
import app.hapi.companion.ui.theme.HapiTypography
import app.hapi.companion.ui.theme.NeutralChatSurfaces
import app.hapi.companion.ui.theme.ReadingColumn
import app.hapi.protocol.chat.*
import kotlinx.coroutines.launch
@@ -125,44 +126,46 @@ internal fun ChatHost(
LocalMarkdownRenderCache provides viewModel.markdownCache,
LocalMarkdownLinkHandler provides rememberChatLinkHandler(onOpenFile = openFile),
) {
Box(Modifier.fillMaxSize()) {
NavHost(navigation, startDestination = "thread") {
composable("thread") {
ChatScreen(
viewModel, media, onBack, snackbarHostState = snackbar,
dictation = dictation, onOpenFiles = { pauseReading(); onOpenFiles() }, onOpenFile = openFile,
onOpenScratchlist = onOpenScratchlist?.let { open -> { pauseReading(); open() } },
transcriptList = transcriptList, readingState = reading,
)
}
for (kind in listOf("group", "tool", "process", "message")) {
composable("$kind/{id}", arguments = listOf(navArgument("id") { type = NavType.StringType })) { destination ->
val id = destination.arguments?.getString("id").orEmpty()
val revision by viewModel.inspection.revision.collectAsState()
val back = { navigation.popBackStack(); Unit }
val close = { navigation.popBackStack("thread", false); Unit }
when (kind) {
"group" -> {
val group = remember(id, revision) { viewModel.inspection.group(id) }
if (group == null) MissingInspection(back, close)
else ToolGroupBrowser(group, state.basePath, actions::openTool, back, close)
}
"message" -> {
val message = remember(id, revision) { viewModel.inspection.message(id) }
if (message == null) MissingInspection(back, close)
else MessageReader(message.value.text, message.stale, back, close)
}
else -> {
val tool = remember(id, revision) { viewModel.inspection.tool(id) }
if (tool == null) MissingInspection(back, close)
else ToolReader(tool, kind == "process", state.basePath, openFile, back, close)
NeutralChatSurfaces {
Box(Modifier.fillMaxSize()) {
NavHost(navigation, startDestination = "thread") {
composable("thread") {
ChatScreen(
viewModel, media, onBack, snackbarHostState = snackbar,
dictation = dictation, onOpenFiles = { pauseReading(); onOpenFiles() }, onOpenFile = openFile,
onOpenScratchlist = onOpenScratchlist?.let { open -> { pauseReading(); open() } },
transcriptList = transcriptList, readingState = reading,
)
}
for (kind in listOf("group", "tool", "process", "message")) {
composable("$kind/{id}", arguments = listOf(navArgument("id") { type = NavType.StringType })) { destination ->
val id = destination.arguments?.getString("id").orEmpty()
val revision by viewModel.inspection.revision.collectAsState()
val back = { navigation.popBackStack(); Unit }
val close = { navigation.popBackStack("thread", false); Unit }
when (kind) {
"group" -> {
val group = remember(id, revision) { viewModel.inspection.group(id) }
if (group == null) MissingInspection(back, close)
else ToolGroupBrowser(group, state.basePath, actions::openTool, back, close)
}
"message" -> {
val message = remember(id, revision) { viewModel.inspection.message(id) }
if (message == null) MissingInspection(back, close)
else MessageReader(message.value.text, message.stale, back, close)
}
else -> {
val tool = remember(id, revision) { viewModel.inspection.tool(id) }
if (tool == null) MissingInspection(back, close)
else ToolReader(tool, kind == "process", state.basePath, openFile, back, close)
}
}
}
}
}
}
if (entry?.destination?.route != "thread") {
SnackbarHost(snackbar, Modifier.align(Alignment.BottomCenter).navigationBarsPadding())
if (entry?.destination?.route != "thread") {
SnackbarHost(snackbar, Modifier.align(Alignment.BottomCenter).navigationBarsPadding())
}
}
}
}
@@ -13,7 +13,7 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.lazy.LazyListState
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
import androidx.compose.foundation.lazy.itemsIndexed
import androidx.compose.foundation.lazy.rememberLazyListState
import androidx.compose.material3.CircularProgressIndicator
import androidx.compose.material3.MaterialTheme
@@ -38,10 +38,14 @@ import androidx.compose.ui.layout.layout
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import app.hapi.companion.R
import app.hapi.data.store.ChatHistoryPagingState
import app.hapi.protocol.chat.AggregatedAssistantMeta
import app.hapi.protocol.chat.ToolCallBlock
import app.hapi.protocol.chat.ToolGroupBlock
import app.hapi.protocol.chat.UserTextBlock
import app.hapi.protocol.chat.VisibleChatBlock
import app.hapi.protocol.chat.buildMessageMetadataLabels
import app.hapi.protocol.chat.messageMetadataForBlock
@@ -82,7 +86,6 @@ internal fun ChatTranscript(
val heights = remember(state.sessionId) { mutableMapOf<String, Int>() }
val density = LocalDensity.current
val estimatedHeight = with(density) { 100.dp.roundToPx() }
val spacing = with(density) { 10.dp.roundToPx() }
val headerHeight = with(density) { 44.dp.roundToPx() }
val isDragged by listState.interactionSource.collectIsDraggedAsState()
// Restore intent with LazyListState, otherwise the first tail effect
@@ -122,8 +125,9 @@ internal fun ChatTranscript(
}
var distance = listState.firstVisibleItemScrollOffset
for (index in 0 until listState.firstVisibleItemIndex) {
distance += if (index == 0) headerHeight + spacing
else (heights[current.getOrNull(index - 1)?.id] ?: estimatedHeight) + spacing
// Measured row heights include their role-based top gap.
distance += if (index == 0) headerHeight
else heights[current.getOrNull(index - 1)?.id] ?: estimatedHeight
if (distance > height) break
}
val short = !listState.canScrollBackward && !listState.canScrollForward
@@ -257,15 +261,17 @@ internal fun ChatTranscript(
}
},
contentPadding = PaddingValues(vertical = 10.dp),
verticalArrangement = Arrangement.spacedBy(10.dp, Alignment.Bottom),
verticalArrangement = Arrangement.Bottom,
) {
item(key = HISTORY_KEY, contentType = HISTORY_KEY) {
HistoryControl(paging.phase, state.hasMore, state.isSyncingTail, onRetryHistory)
}
items(rows, key = { it.id }, contentType = { it.block.contentKind }) { row ->
itemsIndexed(rows, key = { _, row -> row.id }, contentType = { _, row -> row.block.contentKind }) { index, row ->
rowState.SaveableStateProvider(row.id) {
val gap = transcriptRowGap(row.block, rows.getOrNull(index - 1)?.block)
val rowModifier = Modifier
.onSizeChanged { heights[row.id] = it.height }
.padding(top = gap)
.testTag("chat-row-" + row.id)
app.hapi.companion.ui.theme.ReadingColumn(modifier = rowModifier) {
Column(modifier = Modifier.fillMaxWidth()) {
@@ -358,3 +364,28 @@ private fun HistoryControl(
}
}
}
/** Presentation-only rhythm (iOS `TranscriptRowRole`); independent of grouping and IDs. */
internal enum class TranscriptRowRole { User, Tool, Content }
internal val VisibleChatBlock.rowRole: TranscriptRowRole
get() = when (this) {
is UserTextBlock -> TranscriptRowRole.User
is ToolCallBlock, is ToolGroupBlock -> TranscriptRowRole.Tool
else -> TranscriptRowRole.Content
}
/**
* Gap above a transcript row: tight between consecutive tools or user
* prompts, generous around a user turn, 12dp otherwise (and after history).
*/
internal fun transcriptRowGap(block: VisibleChatBlock, previous: VisibleChatBlock?): Dp {
val role = block.rowRole
val before = previous?.rowRole ?: return 12.dp
return when {
role == TranscriptRowRole.User -> if (before == TranscriptRowRole.User) 8.dp else 24.dp
before == TranscriptRowRole.User -> 16.dp
role == TranscriptRowRole.Tool && before == TranscriptRowRole.Tool -> 8.dp
else -> 12.dp
}
}
@@ -25,7 +25,6 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
@@ -33,6 +32,7 @@ import androidx.compose.ui.unit.sp
import app.hapi.companion.R
import app.hapi.companion.ui.markdown.Markdown
import app.hapi.companion.ui.theme.HapiTheme
import app.hapi.companion.ui.theme.HapiTypography
import app.hapi.companion.ui.theme.hapi
import app.hapi.protocol.chat.CodexReview
import app.hapi.protocol.chat.CodexReviewBlock
@@ -177,7 +177,7 @@ private fun FindingRow(finding: CodexReviewFinding) {
formatLocation(finding)?.let { location ->
Text(
text = location,
style = MaterialTheme.typography.labelSmall.copy(fontFamily = FontFamily.Monospace, fontSize = 10.sp),
style = MaterialTheme.typography.labelSmall.copy(fontFamily = HapiTypography.monoFamily, fontSize = 10.sp),
color = colors.hint,
modifier = Modifier.padding(top = 4.dp),
)
@@ -42,12 +42,12 @@ import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import app.hapi.companion.R
import app.hapi.companion.ui.theme.HapiTypography
import app.hapi.companion.ui.theme.hapi
import app.hapi.protocol.git.GitFileStatus
import app.hapi.protocol.wire.FileSearchItem
@@ -267,7 +267,7 @@ private fun GitFileRow(file: GitFileStatus, onClick: () -> Unit) {
if (file.linesAdded > 0 && file.linesRemoved > 0) append(' ')
if (file.linesRemoved > 0) append("-${file.linesRemoved}")
},
fontFamily = FontFamily.Monospace,
fontFamily = HapiTypography.monoFamily,
fontSize = 11.sp,
color = colors.hint,
)
@@ -29,8 +29,8 @@ import androidx.compose.material3.Text
import androidx.compose.material3.TopAppBar
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.geometry.Offset
@@ -39,9 +39,9 @@ import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.drawscope.Stroke
import androidx.compose.ui.graphics.lerp
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.unit.dp
import app.hapi.companion.R
import app.hapi.companion.ui.theme.HapiTypography
import app.hapi.protocol.wire.SqliteStorageUsageResponse
/**
@@ -212,7 +212,7 @@ internal fun StorageUsageCard(usage: SqliteStorageUsageResponse, modifier: Modif
Text(
text = usage.path,
style = MaterialTheme.typography.bodySmall,
fontFamily = FontFamily.Monospace,
fontFamily = HapiTypography.monoFamily,
)
}
}
@@ -0,0 +1,67 @@
package app.hapi.companion.ui.components
import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.RowScope
import androidx.compose.foundation.layout.defaultMinSize
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.Button
import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.OutlinedButton
import androidx.compose.material3.ProvideTextStyle
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import app.hapi.companion.ui.theme.hapi
/** Visual weight of a [ChatActionButton]. */
enum class ChatActionProminence {
/** The one filled action of a row (Allow, Submit answer, Implement plan). */
Primary,
/** Hairline-bordered companion actions (Deny, Previous, Continue planning). */
Secondary,
}
/**
* The single button style for inline transcript actions — approvals, question
* navigation, plan actions and queued-message actions (iOS
* `ChatActionButtonStyle`). It owns the full touch target (48dp minimum,
* 10dp corners); callers must not add another minimum height or padding.
* Only geometry is shared: each caller keeps its own submission semantics.
*/
@Composable
fun ChatActionButton(
onClick: () -> Unit,
modifier: Modifier = Modifier,
prominence: ChatActionProminence = ChatActionProminence.Secondary,
enabled: Boolean = true,
content: @Composable RowScope.() -> Unit,
) {
val sized = modifier.defaultMinSize(minHeight = 48.dp)
val textStyle = MaterialTheme.typography.labelLarge.copy(fontSize = 15.sp, letterSpacing = 0.sp, fontWeight = FontWeight.Medium)
when (prominence) {
ChatActionProminence.Primary -> Button(
onClick = onClick,
modifier = sized,
enabled = enabled,
shape = ChatActionShape,
contentPadding = ChatActionPadding,
) { ProvideTextStyle(textStyle) { content() } }
ChatActionProminence.Secondary -> OutlinedButton(
onClick = onClick,
modifier = sized,
enabled = enabled,
shape = ChatActionShape,
contentPadding = ChatActionPadding,
border = BorderStroke(1.dp, MaterialTheme.hapi.divider),
colors = ButtonDefaults.outlinedButtonColors(contentColor = MaterialTheme.colorScheme.onSurface),
) { ProvideTextStyle(textStyle) { content() } }
}
}
private val ChatActionShape = RoundedCornerShape(10.dp)
private val ChatActionPadding = PaddingValues(horizontal = 16.dp, vertical = 10.dp)
@@ -28,7 +28,6 @@ import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.AnnotatedString
import androidx.compose.ui.text.SpanStyle
import androidx.compose.ui.text.buildAnnotatedString
import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.text.withStyle
@@ -36,6 +35,7 @@ import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import app.hapi.companion.R
import app.hapi.companion.ui.theme.HapiExtendedColors
import app.hapi.companion.ui.theme.HapiTypography
import app.hapi.companion.ui.theme.hapi
import app.hapi.protocol.git.DiffChangeKind
import app.hapi.protocol.git.DiffFile
@@ -93,7 +93,7 @@ fun DiffView(
) {
Text(
text = row.text,
fontFamily = FontFamily.Monospace,
fontFamily = HapiTypography.monoFamily,
fontSize = 14.sp,
lineHeight = 20.sp,
softWrap = false,
@@ -140,7 +140,7 @@ private fun DiffHeader(file: DiffFile, colors: HapiExtendedColors) {
}
Text(
text = title,
fontFamily = FontFamily.Monospace,
fontFamily = HapiTypography.monoFamily,
fontSize = 11.sp,
letterSpacing = 0.5.sp,
color = colors.codeHeaderForeground,
@@ -38,7 +38,6 @@ import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.semantics.contentDescription
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
@@ -47,6 +46,7 @@ import androidx.compose.ui.viewinterop.AndroidView
import app.hapi.companion.R
import app.hapi.companion.ui.components.FullTextAction
import app.hapi.companion.ui.theme.HapiExtendedColors
import app.hapi.companion.ui.theme.HapiTypography
import app.hapi.companion.ui.theme.hapi
import java.util.concurrent.atomic.AtomicBoolean
import java.util.concurrent.atomic.AtomicInteger
@@ -314,7 +314,7 @@ private fun MermaidDiagramHeader(code: String, colors: HapiExtendedColors) {
) {
Text(
text = "mermaid".uppercase(),
fontFamily = FontFamily.Monospace,
fontFamily = HapiTypography.monoFamily,
fontSize = 11.sp,
lineHeight = 16.sp,
letterSpacing = 0.8.sp,
@@ -357,7 +357,7 @@ private fun MermaidDiagramFallback(
text = message,
fontSize = 11.sp,
lineHeight = 15.sp,
fontFamily = FontFamily.Monospace,
fontFamily = HapiTypography.monoFamily,
color = colors.hint,
)
}
@@ -370,7 +370,7 @@ private fun MermaidDiagramFallback(
) {
Text(
text = code,
fontFamily = FontFamily.Monospace,
fontFamily = HapiTypography.monoFamily,
fontSize = 14.sp,
lineHeight = 20.sp,
softWrap = false,
@@ -43,6 +43,16 @@ data class HapiExtendedColors(
val hint: Color,
/** Amber caution accent for warning bands (context indicator, cautions). */
val warning: Color,
/**
* Secondary reading text (iOS `textSecondary`): tool subtitles, reasoning
* labels, status captions. Darker than [hint], which stays for
* placeholders and disabled-looking metadata.
*/
val textSecondary: Color,
/** Neutral fill for inline transcript cards (tools, approvals, groups). */
val cardSurface: Color,
/** Composer card fill: lifts off the canvas instead of sinking into it. */
val composerSurface: Color,
)
/** Mirrors `:root` (light) tokens in web/src/index.css. */
@@ -68,6 +78,9 @@ val HapiLightExtendedColors = HapiExtendedColors(
hint = Color(0xFF6B7280),
// Amber-700: 5.0:1 on white.
warning = Color(0xFFB45309),
textSecondary = Color(0xFF52555E),
cardSurface = Color(0xFFF6F7F9),
composerSurface = Color(0xFFFFFFFF),
)
/** Mirrors `[data-theme="dark"]` tokens in web/src/index.css. */
@@ -93,6 +106,9 @@ val HapiDarkExtendedColors = HapiExtendedColors(
hint = Color(0xFF8E8E93),
// Amber-400: 10.2:1 on the M3 dark surface.
warning = Color(0xFFFBBF24),
textSecondary = Color(0xFFA8ADB8),
cardSurface = Color(0xFF171A21),
composerSurface = Color(0xFF1C2028),
)
/**
@@ -121,6 +137,9 @@ val HapiOledExtendedColors = HapiExtendedColors(
hint = Color(0xFF8E8E93),
// Amber-400 on the pure-black canvas.
warning = Color(0xFFFBBF24),
textSecondary = Color(0xFFA8ADB8),
cardSurface = Color(0xFF0A0A0C),
composerSurface = Color(0xFF131316),
)
val LocalHapiExtendedColors = staticCompositionLocalOf { HapiLightExtendedColors }
@@ -10,46 +10,106 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.Font
import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.LineBreak
import androidx.compose.ui.text.style.LineHeightStyle
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import app.hapi.companion.R
/** sp delegates scaling (including Android 14's nonlinear scaling) to the platform. */
/**
* Reading metrics shared with iOS `HapiTypography`: 16/24 body, 15 inline
* code, 14/20 code, 12/16 captions, 24/20/18/17 headings. sp delegates
* scaling (including Android 14's nonlinear scaling) to the platform.
*/
object HapiTypography {
/** Primary reading style: chat bubbles and long-form markdown. */
val body = TextStyle(fontSize = 16.sp, lineHeight = 24.sp)
/**
* JetBrains Mono NL (SIL OFL 1.1; license in the font's name table). The
* no-ligature cut keeps `!=`/`->` in agent output literal, like SF Mono.
*/
val monoFamily = FontFamily(
Font(R.font.jetbrains_mono_regular, FontWeight.Normal),
Font(R.font.jetbrains_mono_bold, FontWeight.Bold),
)
/**
* Monospace style for code blocks and CLI output. Material has no code
* slot, so views that render code consume this token directly; it never
* leaks into the shared scale's reading slots.
* Leading is distributed between lines only (iOS `lineSpacing`): the first
* line's ascent and the last line's descent are trimmed, so block spacing
* tokens measure the visible gap instead of hidden half-leading.
*/
val code = TextStyle(fontFamily = FontFamily.Monospace, fontSize = 14.sp, lineHeight = 20.sp)
private val trimmedLeading = LineHeightStyle(
alignment = LineHeightStyle.Alignment.Center,
trim = LineHeightStyle.Trim.Both,
)
/** Compact metadata style: timestamps, counters, table headers. */
val caption = TextStyle(fontSize = 12.sp, lineHeight = 16.sp)
/** Primary reading style: chat bubbles and long-form markdown. */
val body = TextStyle(
fontSize = 16.sp,
lineHeight = 24.sp,
letterSpacing = 0.sp,
lineHeightStyle = trimmedLeading,
// Strict CJK breaking rules and high-quality line filling.
lineBreak = LineBreak.Paragraph,
)
/**
* Monospace style for code blocks, CLI output and diffs. Material has no
* code slot, so views that render code consume this token directly.
*/
val code = TextStyle(
fontFamily = monoFamily,
fontSize = 14.sp,
lineHeight = 20.sp,
letterSpacing = 0.sp,
lineHeightStyle = trimmedLeading,
)
/** Compact metadata style: timestamps, counters, tool subtitles. */
val caption = TextStyle(fontSize = 12.sp, lineHeight = 16.sp, letterSpacing = 0.sp)
/** Tool summary titles and similar one-line labels (iOS 15pt medium). */
val rowTitle = TextStyle(fontSize = 15.sp, lineHeight = 20.sp, letterSpacing = 0.sp, fontWeight = FontWeight.Medium)
/** Tool summary subtitles and secondary row text (iOS 13pt). */
val rowSubtitle = TextStyle(fontSize = 13.sp, lineHeight = 18.sp, letterSpacing = 0.sp)
/** Markdown heading by level; matches iOS `headingSize`. */
fun heading(level: Int): TextStyle {
val size = when (level) {
1 -> 24
2 -> 20
3 -> 18
else -> 17
}
return body.copy(
fontSize = size.sp,
lineHeight = (size * 1.3f).sp,
fontWeight = FontWeight.SemiBold,
)
}
/** Material's stock scale; the base the app scale derives every slot from. */
private val platformDefaults = Typography()
/**
* The Material type scale the whole app renders with. It is anchored on
* the reading tokens above instead of existing as an unrelated parallel
* system: [body] drives `bodyLarge` (the chat reading size) and [caption]
* drives `bodySmall` (the metadata size). Only size and leading come from
* the tokens -- weight, tracking and family stay Material's -- and every
* slot without a token copies its platform default verbatim, so the many
* existing `MaterialTheme.typography` call sites stay pixel-identical
* while future token changes propagate through one place.
* The Material type scale the whole app renders with. [body] drives
* `bodyLarge` and [caption] drives `bodySmall`. Body slots drop Material's
* 0.25–0.5sp tracking, which reads loose next to CJK and system UI text;
* title and label slots keep their platform defaults.
*/
val scale: Typography = Typography(
bodyLarge = platformDefaults.bodyLarge.copy(
fontSize = body.fontSize,
lineHeight = body.lineHeight,
letterSpacing = 0.sp,
),
bodyMedium = platformDefaults.bodyMedium.copy(letterSpacing = 0.sp),
bodySmall = platformDefaults.bodySmall.copy(
fontSize = caption.fontSize,
lineHeight = caption.lineHeight,
letterSpacing = 0.sp,
),
)
}
@@ -2,6 +2,7 @@ package app.hapi.companion.ui.theme
import android.os.Build
import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.material3.ColorScheme
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Typography
import androidx.compose.material3.darkColorScheme
@@ -10,20 +11,73 @@ import androidx.compose.material3.dynamicLightColorScheme
import androidx.compose.material3.lightColorScheme
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.staticCompositionLocalOf
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalContext
/**
* Neutral (hue-free) surface ladders mirroring iOS `HapiTheme.light/.dark`.
* Material's baseline schemes tint every surface lavender; HAPI keeps
* surfaces gray and lets only the accent roles carry color. [NeutralChatSurfaces]
* reapplies these over Material You so wallpaper hues never tint the transcript.
*/
private fun ColorScheme.withNeutralSurfaces(dark: Boolean): ColorScheme = if (dark) {
copy(
background = Color(0xFF0F1115),
onBackground = Color(0xFFE8EAED),
surface = Color(0xFF0F1115),
onSurface = Color(0xFFE8EAED),
surfaceVariant = Color(0xFF23272F),
onSurfaceVariant = Color(0xFFA8ADB8),
surfaceTint = Color(0xFF6E7481),
surfaceBright = Color(0xFF2A2E37),
surfaceDim = Color(0xFF0F1115),
surfaceContainerLowest = Color(0xFF0B0D10),
surfaceContainerLow = Color(0xFF14171C),
surfaceContainer = Color(0xFF181B22),
surfaceContainerHigh = Color(0xFF1E2129),
surfaceContainerHighest = Color(0xFF262A33),
outline = Color(0xFF6E7481),
outlineVariant = Color(0xFF2A2E37),
inverseSurface = Color(0xFFE8EAED),
inverseOnSurface = Color(0xFF1C1D22),
)
} else {
copy(
background = Color(0xFFFFFFFF),
onBackground = Color(0xFF1C1D22),
surface = Color(0xFFFFFFFF),
onSurface = Color(0xFF1C1D22),
surfaceVariant = Color(0xFFEEF0F3),
onSurfaceVariant = Color(0xFF52555E),
surfaceTint = Color(0xFF8A8D96),
surfaceBright = Color(0xFFFFFFFF),
surfaceDim = Color(0xFFE2E4E8),
surfaceContainerLowest = Color(0xFFFFFFFF),
surfaceContainerLow = Color(0xFFF6F7F9),
surfaceContainer = Color(0xFFF1F3F5),
surfaceContainerHigh = Color(0xFFECEEF1),
surfaceContainerHighest = Color(0xFFE5E7EB),
outline = Color(0xFF8A8D96),
outlineVariant = Color(0xFFE5E7EB),
inverseSurface = Color(0xFF2B2D33),
inverseOnSurface = Color(0xFFF1F3F5),
)
}
private val LightColorScheme = lightColorScheme(
primary = Color(0xFF3D6837),
secondary = Color(0xFF54634D),
tertiary = Color(0xFF386569),
)
).withNeutralSurfaces(dark = false)
private val DarkColorScheme = darkColorScheme(
primary = Color(0xFFA3D397),
// Material's baseline onPrimary is purple; ink on the light-green accent.
onPrimary = Color(0xFF0F1115),
secondary = Color(0xFFBCCBB2),
tertiary = Color(0xFFA0CFD2),
)
).withNeutralSurfaces(dark = true)
/**
* Pure-black scheme for OLED panels (mirrors the web `[data-theme="oled"]`
@@ -160,7 +214,10 @@ fun HapiTheme(
}
val extendedColors = presetPalette?.extendedColors(baseExtendedColors) ?: baseExtendedColors
CompositionLocalProvider(LocalHapiExtendedColors provides extendedColors) {
CompositionLocalProvider(
LocalHapiExtendedColors provides extendedColors,
LocalThemeSchemeSource provides schemeSource,
) {
MaterialTheme(
colorScheme = colorScheme,
typography = typography,
@@ -168,3 +225,26 @@ fun HapiTheme(
)
}
}
internal val LocalThemeSchemeSource = staticCompositionLocalOf<ThemeSchemeSource> { ThemeSchemeSource.StaticLight }
/**
* Keeps conversation surfaces neutral under Material You: the wallpaper still
* drives accent roles, but the canvas, containers and on-surface text use the
* same gray ladder as the static schemes. Presets and OLED are deliberate
* palette choices and pass through unchanged.
*/
@Composable
fun NeutralChatSurfaces(content: @Composable () -> Unit) {
val source = LocalThemeSchemeSource.current
if (source !is ThemeSchemeSource.Dynamic) {
content()
return
}
MaterialTheme(
colorScheme = MaterialTheme.colorScheme.withNeutralSurfaces(source.dark),
typography = MaterialTheme.typography,
shapes = MaterialTheme.shapes,
content = content,
)
}
@@ -273,6 +273,9 @@ fun ThemePresetPalette.extendedColors(base: HapiExtendedColors): HapiExtendedCol
divider = border,
link = accent,
hint = hint,
textSecondary = mix(hint, foreground, 0.35),
cardSurface = surface,
composerSurface = if (isDark) surfaceHover else background,
)
/** Card-face preview colors for the preset picker (web `COLOR_THEME_OPTIONS`). */
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Material Symbols Rounded `add` (Apache-2.0); tint at the call site. -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<group android:translateY="960">
<path
android:fillColor="#FF000000"
android:pathData="M440-440H240q-17 0-28.5-11.5T200-480q0-17 11.5-28.5T240-520h200v-200q0-17 11.5-28.5T480-760q17 0 28.5 11.5T520-720v200h200q17 0 28.5 11.5T760-480q0 17-11.5 28.5T720-440H520v200q0 17-11.5 28.5T480-200q-17 0-28.5-11.5T440-240v-200Z" />
</group>
</vector>
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Material Symbols Rounded `arrow_outward` (Apache-2.0); tint at the call site. -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<group android:translateY="960">
<path
android:fillColor="#FF000000"
android:pathData="M640-624 284-268q-11 11-28 11t-28-11q-11-11-11-28t11-28l356-356H280q-17 0-28.5-11.5T240-720q0-17 11.5-28.5T280-760h400q17 0 28.5 11.5T720-720v400q0 17-11.5 28.5T680-280q-17 0-28.5-11.5T640-320v-304Z" />
</group>
</vector>
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Material Symbols Rounded `arrow_upward` (Apache-2.0); tint at the call site. -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<group android:translateY="960">
<path
android:fillColor="#FF000000"
android:pathData="M440-647 244-451q-12 12-28 11.5T188-452q-11-12-11.5-28t11.5-28l264-264q6-6 13-8.5t15-2.5q8 0 15 2.5t13 8.5l264 264q11 11 11 27.5T772-452q-12 12-28.5 12T715-452L520-647v447q0 17-11.5 28.5T480-160q-17 0-28.5-11.5T440-200v-447Z" />
</group>
</vector>
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Material Symbols Rounded `assignment` (Apache-2.0); tint at the call site. -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<group android:translateY="960">
<path
android:fillColor="#FF000000"
android:pathData="M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h168q13-36 43.5-58t68.5-22q38 0 68.5 22t43.5 58h168q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h560v-560H200v560Zm120-80h200q17 0 28.5-11.5T560-320q0-17-11.5-28.5T520-360H320q-17 0-28.5 11.5T280-320q0 17 11.5 28.5T320-280Zm0-160h320q17 0 28.5-11.5T680-480q0-17-11.5-28.5T640-520H320q-17 0-28.5 11.5T280-480q0 17 11.5 28.5T320-440Zm0-160h320q17 0 28.5-11.5T680-640q0-17-11.5-28.5T640-680H320q-17 0-28.5 11.5T280-640q0 17 11.5 28.5T320-600Zm160-190q13 0 21.5-8.5T510-820q0-13-8.5-21.5T480-850q-13 0-21.5 8.5T450-820q0 13 8.5 21.5T480-790ZM200-200v-560 560Z" />
</group>
</vector>
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Material Symbols Rounded `attach_file` (Apache-2.0); tint at the call site. -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<group android:translateY="960">
<path
android:fillColor="#FF000000"
android:pathData="M720-330q0 104-73 177T470-80q-104 0-177-73t-73-177v-370q0-75 52.5-127.5T400-880q75 0 127.5 52.5T580-700v350q0 46-32 78t-78 32q-46 0-78-32t-32-78v-330q0-17 11.5-28.5T400-720q17 0 28.5 11.5T440-680v330q0 13 8.5 21.5T470-320q13 0 21.5-8.5T500-350v-350q-1-42-29.5-71T400-800q-42 0-71 29t-29 71v370q-1 71 49 120.5T470-160q70 0 119-49.5T640-330v-350q0-17 11.5-28.5T680-720q17 0 28.5 11.5T720-680v350Z" />
</group>
</vector>
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Material Symbols Rounded `bolt` (Apache-2.0); tint at the call site. -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<group android:translateY="960">
<path
android:fillColor="#FF000000"
android:pathData="m422-232 207-248H469l29-227-185 267h139l-30 208Zm-62-128H236q-24 0-35.5-21.5T203-423l299-430q10-14 26-19.5t33 .5q17 6 25 21t6 32l-32 259h155q26 0 36.5 23t-6.5 43L416-100q-11 13-27 17t-31-3q-15-7-23.5-21.5T328-139l32-221Zm111-110Z" />
</group>
</vector>
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Material Symbols Rounded `build` (Apache-2.0); tint at the call site. -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<group android:translateY="960">
<path
android:fillColor="#FF000000"
android:pathData="M360-360q-100 0-170-70t-70-170q0-20 3-40t11-38q5-10 12.5-15t16.5-7q9-2 18.5.5T199-689l105 105 72-72-105-105q-8-8-10.5-17.5T260-797q2-9 7-16.5t15-12.5q18-8 38-11t40-3q100 0 170 70t70 170q0 23-4 43.5T584-516l202 200q29 29 29 71t-29 71q-29 29-71 29t-71-30L444-376q-20 8-40.5 12t-43.5 4Zm0-80q26 0 52-8t47-25l243 243q5 5 13.5 4.5T729-231q5-5 5-13.5t-5-13.5L486-500q18-20 26-46.5t8-53.5q0-60-38.5-104.5T386-758l74 74q12 12 12 28t-12 28L332-500q-12 12-28 12t-28-12l-74-74q9 57 53.5 95.5T360-440Zm109-51Z" />
</group>
</vector>
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Material Symbols Rounded `cancel` (Apache-2.0); tint at the call site. -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<group android:translateY="960">
<path
android:fillColor="#FF000000"
android:pathData="m480-424 116 116q11 11 28 11t28-11q11-11 11-28t-11-28L536-480l116-116q11-11 11-28t-11-28q-11-11-28-11t-28 11L480-536 364-652q-11-11-28-11t-28 11q-11 11-11 28t11 28l116 116-116 116q-11 11-11 28t11 28q11 11 28 11t28-11l116-116Zm0 344q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-80q134 0 227-93t93-227q0-134-93-227t-227-93q-134 0-227 93t-93 227q0 134 93 227t227 93Zm0-320Z" />
</group>
</vector>
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Material Symbols Rounded `chat_bubble` (Apache-2.0); tint at the call site. -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<group android:translateY="960">
<path
android:fillColor="#FF000000"
android:pathData="m240-240-92 92q-19 19-43.5 8.5T80-177v-623q0-33 23.5-56.5T160-880h640q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H240Zm-34-80h594v-480H160v525l46-45Zm-46 0v-480 480Z" />
</group>
</vector>
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Material Symbols Rounded `check` (Apache-2.0); tint at the call site. -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<group android:translateY="960">
<path
android:fillColor="#FF000000"
android:pathData="m382-354 339-339q12-12 28-12t28 12q12 12 12 28.5T777-636L410-268q-12 12-28 12t-28-12L182-440q-12-12-11.5-28.5T183-497q12-12 28.5-12t28.5 12l142 143Z" />
</group>
</vector>
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Material Symbols Rounded `check_circle` (Apache-2.0); tint at the call site. -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<group android:translateY="960">
<path
android:fillColor="#FF000000"
android:pathData="m424-408-86-86q-11-11-28-11t-28 11q-11 11-11 28t11 28l114 114q12 12 28 12t28-12l226-226q11-11 11-28t-11-28q-11-11-28-11t-28 11L424-408Zm56 328q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-80q134 0 227-93t93-227q0-134-93-227t-227-93q-134 0-227 93t-93 227q0 134 93 227t227 93Zm0-320Z" />
</group>
</vector>
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Material Symbols Rounded `chevron_right` (Apache-2.0); tint at the call site. -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<group android:translateY="960">
<path
android:fillColor="#FF000000"
android:pathData="M504-480 348-636q-11-11-11-28t11-28q11-11 28-11t28 11l184 184q6 6 8.5 13t2.5 15q0 8-2.5 15t-8.5 13L404-268q-11 11-28 11t-28-11q-11-11-11-28t11-28l156-156Z" />
</group>
</vector>
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Material Symbols Rounded `close` (Apache-2.0); tint at the call site. -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<group android:translateY="960">
<path
android:fillColor="#FF000000"
android:pathData="M480-424 284-228q-11 11-28 11t-28-11q-11-11-11-28t11-28l196-196-196-196q-11-11-11-28t11-28q11-11 28-11t28 11l196 196 196-196q11-11 28-11t28 11q11 11 11 28t-11 28L536-480l196 196q11 11 11 28t-11 28q-11 11-28 11t-28-11L480-424Z" />
</group>
</vector>
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Material Symbols Rounded `content_copy` (Apache-2.0); tint at the call site. -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<group android:translateY="960">
<path
android:fillColor="#FF000000"
android:pathData="M360-240q-33 0-56.5-23.5T280-320v-480q0-33 23.5-56.5T360-880h360q33 0 56.5 23.5T800-800v480q0 33-23.5 56.5T720-240H360Zm0-80h360v-480H360v480ZM200-80q-33 0-56.5-23.5T120-160v-520q0-17 11.5-28.5T160-720q17 0 28.5 11.5T200-680v520h400q17 0 28.5 11.5T640-120q0 17-11.5 28.5T600-80H200Zm160-240v-480 480Z" />
</group>
</vector>
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Material Symbols Rounded `description` (Apache-2.0); tint at the call site. -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<group android:translateY="960">
<path
android:fillColor="#FF000000"
android:pathData="M360-240h240q17 0 28.5-11.5T640-280q0-17-11.5-28.5T600-320H360q-17 0-28.5 11.5T320-280q0 17 11.5 28.5T360-240Zm0-160h240q17 0 28.5-11.5T640-440q0-17-11.5-28.5T600-480H360q-17 0-28.5 11.5T320-440q0 17 11.5 28.5T360-400ZM240-80q-33 0-56.5-23.5T160-160v-640q0-33 23.5-56.5T240-880h287q16 0 30.5 6t25.5 17l194 194q11 11 17 25.5t6 30.5v447q0 33-23.5 56.5T720-80H240Zm280-560v-160H240v640h480v-440H560q-17 0-28.5-11.5T520-640ZM240-800v200-200 640-640Z" />
</group>
</vector>
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Material Symbols Rounded `edit` (Apache-2.0); tint at the call site. -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<group android:translateY="960">
<path
android:fillColor="#FF000000"
android:pathData="M200-200h57l391-391-57-57-391 391v57Zm-40 80q-17 0-28.5-11.5T120-160v-97q0-16 6-30.5t17-25.5l505-504q12-11 26.5-17t30.5-6q16 0 31 6t26 18l55 56q12 11 17.5 26t5.5 30q0 16-5.5 30.5T817-647L313-143q-11 11-25.5 17t-30.5 6h-97Zm600-584-56-56 56 56Zm-141 85-28-29 57 57-29-28Z" />
</group>
</vector>
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Material Symbols Rounded `error` (Apache-2.0); tint at the call site. -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<group android:translateY="960">
<path
android:fillColor="#FF000000"
android:pathData="M480-280q17 0 28.5-11.5T520-320q0-17-11.5-28.5T480-360q-17 0-28.5 11.5T440-320q0 17 11.5 28.5T480-280Zm0-160q17 0 28.5-11.5T520-480v-160q0-17-11.5-28.5T480-680q-17 0-28.5 11.5T440-640v160q0 17 11.5 28.5T480-440Zm0 360q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-80q134 0 227-93t93-227q0-134-93-227t-227-93q-134 0-227 93t-93 227q0 134 93 227t227 93Zm0-320Z" />
</group>
</vector>
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Material Symbols Rounded `expand_more` (Apache-2.0); tint at the call site. -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<group android:translateY="960">
<path
android:fillColor="#FF000000"
android:pathData="M480-362q-8 0-15-2.5t-13-8.5L268-557q-11-11-11-28t11-28q11-11 28-11t28 11l156 156 156-156q11-11 28-11t28 11q11 11 11 28t-11 28L508-373q-6 6-13 8.5t-15 2.5Z" />
</group>
</vector>
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Material Symbols Rounded `extension` (Apache-2.0); tint at the call site. -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<group android:translateY="960">
<path
android:fillColor="#FF000000"
android:pathData="M352-120H200q-33 0-56.5-23.5T120-200v-152q48 0 84-30.5t36-77.5q0-47-36-77.5T120-568v-152q0-33 23.5-56.5T200-800h160q0-42 29-71t71-29q42 0 71 29t29 71h160q33 0 56.5 23.5T800-720v160q42 0 71 29t29 71q0 42-29 71t-71 29v160q0 33-23.5 56.5T720-120H568q0-50-31.5-85T460-240q-45 0-76.5 35T352-120Zm-152-80h85q24-66 77-93t98-27q45 0 98 27t77 93h85v-240h80q8 0 14-6t6-14q0-8-6-14t-14-6h-80v-240H480v-80q0-8-6-14t-14-6q-8 0-14 6t-6 14v80H200v88q54 20 87 67t33 105q0 57-33 104t-87 68v88Zm260-260Z" />
</group>
</vector>
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Material Symbols Rounded `group` (Apache-2.0); tint at the call site. -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<group android:translateY="960">
<path
android:fillColor="#FF000000"
android:pathData="M40-272q0-34 17.5-62.5T104-378q62-31 126-46.5T360-440q66 0 130 15.5T616-378q29 15 46.5 43.5T680-272v32q0 33-23.5 56.5T600-160H120q-33 0-56.5-23.5T40-240v-32Zm800 112H738q11-18 16.5-38.5T760-240v-40q0-44-24.5-84.5T666-434q51 6 96 20.5t84 35.5q36 20 55 44.5t19 53.5v40q0 33-23.5 56.5T840-160ZM360-480q-66 0-113-47t-47-113q0-66 47-113t113-47q66 0 113 47t47 113q0 66-47 113t-113 47Zm400-160q0 66-47 113t-113 47q-11 0-28-2.5t-28-5.5q27-32 41.5-71t14.5-81q0-42-14.5-81T544-792q14-5 28-6.5t28-1.5q66 0 113 47t47 113ZM120-240h480v-32q0-11-5.5-20T580-306q-54-27-109-40.5T360-360q-56 0-111 13.5T140-306q-9 5-14.5 14t-5.5 20v32Zm240-320q33 0 56.5-23.5T440-640q0-33-23.5-56.5T360-720q-33 0-56.5 23.5T280-640q0 33 23.5 56.5T360-560Zm0 320Zm0-400Z" />
</group>
</vector>
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Material Symbols Rounded `help` (Apache-2.0); tint at the call site. -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<group android:translateY="960">
<path
android:fillColor="#FF000000"
android:pathData="M478-240q21 0 35.5-14.5T528-290q0-21-14.5-35.5T478-340q-21 0-35.5 14.5T428-290q0 21 14.5 35.5T478-240Zm2 160q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-80q134 0 227-93t93-227q0-134-93-227t-227-93q-134 0-227 93t-93 227q0 134 93 227t227 93Zm0-320Zm4-172q25 0 43.5 16t18.5 40q0 22-13.5 39T502-525q-23 20-40.5 44T444-427q0 14 10.5 23.5T479-394q15 0 25.5-10t13.5-25q4-21 18-37.5t30-31.5q23-22 39.5-48t16.5-58q0-51-41.5-83.5T484-720q-38 0-72.5 16T359-655q-7 12-4.5 25.5T368-609q14 8 29 5t25-17q11-15 27.5-23t34.5-8Z" />
</group>
</vector>
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Material Symbols Rounded `hourglass_empty` (Apache-2.0); tint at the call site. -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<group android:translateY="960">
<path
android:fillColor="#FF000000"
android:pathData="M320-160h320v-120q0-66-47-113t-113-47q-66 0-113 47t-47 113v120Zm160-360q66 0 113-47t47-113v-120H320v120q0 66 47 113t113 47ZM200-80q-17 0-28.5-11.5T160-120q0-17 11.5-28.5T200-160h40v-120q0-61 28.5-114.5T348-480q-51-32-79.5-85.5T240-680v-120h-40q-17 0-28.5-11.5T160-840q0-17 11.5-28.5T200-880h560q17 0 28.5 11.5T800-840q0 17-11.5 28.5T760-800h-40v120q0 61-28.5 114.5T612-480q51 32 79.5 85.5T720-280v120h40q17 0 28.5 11.5T800-120q0 17-11.5 28.5T760-80H200Z" />
</group>
</vector>
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Material Symbols Rounded `image` (Apache-2.0); tint at the call site. -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<group android:translateY="960">
<path
android:fillColor="#FF000000"
android:pathData="M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h560v-560H200v560Zm0 0v-560 560Zm80-80h400q12 0 18-11t-2-21L586-459q-6-8-16-8t-16 8L450-320l-74-99q-6-8-16-8t-16 8l-80 107q-8 10-2 21t18 11Z" />
</group>
</vector>
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Material Symbols Rounded `language` (Apache-2.0); tint at the call site. -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<group android:translateY="960">
<path
android:fillColor="#FF000000"
android:pathData="M480-80q-82 0-155-31.5t-127.5-86Q143-252 111.5-325T80-480q0-83 31.5-155.5t86-127Q252-817 325-848.5T480-880q83 0 155.5 31.5t127 86q54.5 54.5 86 127T880-480q0 82-31.5 155t-86 127.5q-54.5 54.5-127 86T480-80Zm0-82q26-36 45-75t31-83H404q12 44 31 83t45 75Zm-104-16q-18-33-31.5-68.5T322-320H204q29 50 72.5 87t99.5 55Zm208 0q56-18 99.5-55t72.5-87H638q-9 38-22.5 73.5T584-178ZM170-400h136q-3-20-4.5-39.5T300-480q0-21 1.5-40.5T306-560H170q-5 20-7.5 39.5T160-480q0 21 2.5 40.5T170-400Zm216 0h188q3-20 4.5-39.5T580-480q0-21-1.5-40.5T574-560H386q-3 20-4.5 39.5T380-480q0 21 1.5 40.5T386-400Zm268 0h136q5-20 7.5-39.5T800-480q0-21-2.5-40.5T790-560H654q3 20 4.5 39.5T660-480q0 21-1.5 40.5T654-400Zm-16-240h118q-29-50-72.5-87T584-782q18 33 31.5 68.5T638-640Zm-234 0h152q-12-44-31-83t-45-75q-26 36-45 75t-31 83Zm-200 0h118q9-38 22.5-73.5T376-782q-56 18-99.5 55T204-640Z" />
</group>
</vector>
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Material Symbols Rounded `lightbulb` (Apache-2.0); tint at the call site. -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<group android:translateY="960">
<path
android:fillColor="#FF000000"
android:pathData="M480-80q-33 0-56.5-23.5T400-160h160q0 33-23.5 56.5T480-80ZM360-200q-17 0-28.5-11.5T320-240q0-17 11.5-28.5T360-280h240q17 0 28.5 11.5T640-240q0 17-11.5 28.5T600-200H360Zm-30-120q-69-41-109.5-110T180-580q0-125 87.5-212.5T480-880q125 0 212.5 87.5T780-580q0 81-40.5 150T630-320H330Zm24-80h252q45-32 69.5-79T700-580q0-92-64-156t-156-64q-92 0-156 64t-64 156q0 54 24.5 101t69.5 79Zm126 0Z" />
</group>
</vector>
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Material Symbols Rounded `mic` (Apache-2.0); tint at the call site. -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<group android:translateY="960">
<path
android:fillColor="#FF000000"
android:pathData="M480-400q-50 0-85-35t-35-85v-240q0-50 35-85t85-35q50 0 85 35t35 85v240q0 50-35 85t-85 35Zm0-240Zm-40 480v-83q-92-13-157.5-78T203-479q-2-17 9-29t28-12q17 0 28.5 11.5T284-480q14 70 69.5 115T480-320q72 0 127-45.5T676-480q4-17 15.5-28.5T720-520q17 0 28 12t9 29q-14 91-79 157t-158 79v83q0 17-11.5 28.5T480-120q-17 0-28.5-11.5T440-160Zm40-320q17 0 28.5-11.5T520-520v-240q0-17-11.5-28.5T480-800q-17 0-28.5 11.5T440-760v240q0 17 11.5 28.5T480-480Z" />
</group>
</vector>
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Material Symbols Rounded `more_horiz` (Apache-2.0); tint at the call site. -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<group android:translateY="960">
<path
android:fillColor="#FF000000"
android:pathData="M240-400q-33 0-56.5-23.5T160-480q0-33 23.5-56.5T240-560q33 0 56.5 23.5T320-480q0 33-23.5 56.5T240-400Zm240 0q-33 0-56.5-23.5T400-480q0-33 23.5-56.5T480-560q33 0 56.5 23.5T560-480q0 33-23.5 56.5T480-400Zm240 0q-33 0-56.5-23.5T640-480q0-33 23.5-56.5T720-560q33 0 56.5 23.5T800-480q0 33-23.5 56.5T720-400Z" />
</group>
</vector>
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Material Symbols Rounded `refresh` (Apache-2.0); tint at the call site. -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<group android:translateY="960">
<path
android:fillColor="#FF000000"
android:pathData="M480-160q-134 0-227-93t-93-227q0-134 93-227t227-93q69 0 132 28.5T720-690v-70q0-17 11.5-28.5T760-800q17 0 28.5 11.5T800-760v200q0 17-11.5 28.5T760-520H560q-17 0-28.5-11.5T520-560q0-17 11.5-28.5T560-600h128q-32-56-87.5-88T480-720q-100 0-170 70t-70 170q0 100 70 170t170 70q68 0 124.5-34.5T692-367q8-14 22.5-19.5t29.5-.5q16 5 23 21t-1 30q-41 80-117 128t-169 48Z" />
</group>
</vector>
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Material Symbols Rounded `schedule` (Apache-2.0); tint at the call site. -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<group android:translateY="960">
<path
android:fillColor="#FF000000"
android:pathData="M520-496v-144q0-17-11.5-28.5T480-680q-17 0-28.5 11.5T440-640v159q0 8 3 15.5t9 13.5l132 132q11 11 28 11t28-11q11-11 11-28t-11-28L520-496ZM480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-400Zm0 320q133 0 226.5-93.5T800-480q0-133-93.5-226.5T480-800q-133 0-226.5 93.5T160-480q0 133 93.5 226.5T480-160Z" />
</group>
</vector>
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Material Symbols Rounded `search` (Apache-2.0); tint at the call site. -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<group android:translateY="960">
<path
android:fillColor="#FF000000"
android:pathData="M380-320q-109 0-184.5-75.5T120-580q0-109 75.5-184.5T380-840q109 0 184.5 75.5T640-580q0 44-14 83t-38 69l224 224q11 11 11 28t-11 28q-11 11-28 11t-28-11L532-372q-30 24-69 38t-83 14Zm0-80q75 0 127.5-52.5T560-580q0-75-52.5-127.5T380-760q-75 0-127.5 52.5T200-580q0 75 52.5 127.5T380-400Z" />
</group>
</vector>
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Material Symbols Rounded `send` (Apache-2.0); tint at the call site. -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<group android:translateY="960">
<path
android:fillColor="#FF000000"
android:pathData="M792-443 176-183q-20 8-38-3.5T120-220v-520q0-22 18-33.5t38-3.5l616 260q25 11 25 37t-25 37ZM200-280l474-200-474-200v140l240 60-240 60v140Zm0 0v-400 400Z" />
</group>
</vector>
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Material Symbols Rounded `stop_fill1` (Apache-2.0); tint at the call site. -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<group android:translateY="960">
<path
android:fillColor="#FF000000"
android:pathData="M240-320v-320q0-33 23.5-56.5T320-720h320q33 0 56.5 23.5T720-640v320q0 33-23.5 56.5T640-240H320q-33 0-56.5-23.5T240-320Z" />
</group>
</vector>
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Material Symbols Rounded `subdirectory_arrow_right` (Apache-2.0); tint at the call site. -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<group android:translateY="960">
<path
android:fillColor="#FF000000"
android:pathData="M532-149q-12-12-12-28t12-28l115-115H280q-33 0-56.5-23.5T200-400v-360q0-17 11.5-28.5T240-800q17 0 28.5 11.5T280-760v360h367L531-516q-12-12-11.5-28t11.5-28q12-12 28-12.5t28 11.5l185 185q6 6 8.5 13t2.5 15q0 8-2.5 15t-8.5 13L589-149q-12 12-28.5 12T532-149Z" />
</group>
</vector>
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Material Symbols Rounded `terminal` (Apache-2.0); tint at the call site. -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<group android:translateY="960">
<path
android:fillColor="#FF000000"
android:pathData="M160-160q-33 0-56.5-23.5T80-240v-480q0-33 23.5-56.5T160-800h640q33 0 56.5 23.5T880-720v480q0 33-23.5 56.5T800-160H160Zm0-80h640v-400H160v400Zm187-200-76-76q-12-12-11.5-28t12.5-28q12-11 28-11.5t28 11.5l104 104q12 12 12 28t-12 28L328-308q-11 11-27.5 11.5T272-308q-11-11-11-28t11-28l75-76Zm173 160q-17 0-28.5-11.5T480-320q0-17 11.5-28.5T520-360h160q17 0 28.5 11.5T720-320q0 17-11.5 28.5T680-280H520Z" />
</group>
</vector>
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Material Symbols Rounded `visibility` (Apache-2.0); tint at the call site. -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<group android:translateY="960">
<path
android:fillColor="#FF000000"
android:pathData="M480-320q75 0 127.5-52.5T660-500q0-75-52.5-127.5T480-680q-75 0-127.5 52.5T300-500q0 75 52.5 127.5T480-320Zm0-72q-45 0-76.5-31.5T372-500q0-45 31.5-76.5T480-608q45 0 76.5 31.5T588-500q0 45-31.5 76.5T480-392Zm0 192q-134 0-244.5-72T61-462q-5-9-7.5-18.5T51-500q0-10 2.5-19.5T61-538q64-118 174.5-190T480-800q134 0 244.5 72T899-538q5 9 7.5 18.5T909-500q0 10-2.5 19.5T899-462q-64 118-174.5 190T480-200Zm0-300Zm0 220q113 0 207.5-59.5T832-500q-50-101-144.5-160.5T480-720q-113 0-207.5 59.5T128-500q50 101 144.5 160.5T480-280Z" />
</group>
</vector>
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Material Symbols Rounded `warning` (Apache-2.0); tint at the call site. -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<group android:translateY="960">
<path
android:fillColor="#FF000000"
android:pathData="M109-120q-11 0-20-5.5T75-140q-5-9-5.5-19.5T75-180l370-640q6-10 15.5-15t19.5-5q10 0 19.5 5t15.5 15l370 640q6 10 5.5 20.5T885-140q-5 9-14 14.5t-20 5.5H109Zm69-80h604L480-720 178-200Zm302-40q17 0 28.5-11.5T520-280q0-17-11.5-28.5T480-320q-17 0-28.5 11.5T440-280q0 17 11.5 28.5T480-240Zm0-120q17 0 28.5-11.5T520-400v-120q0-17-11.5-28.5T480-560q-17 0-28.5 11.5T440-520v120q0 17 11.5 28.5T480-360Zm0-100Z" />
</group>
</vector>
@@ -0,0 +1,45 @@
package app.hapi.companion.specimens
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.width
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.test.junit4.ComposeContentTestRule
import androidx.compose.ui.test.onRoot
import androidx.compose.ui.unit.dp
import app.hapi.companion.ui.theme.HapiTheme
import com.github.takahirom.roborazzi.captureRoboImage
/**
* Deterministic visual specimens (fake data, no hub): the Android analogue of
* the iOS `TypographySnapshotTests` captures. Plain `testDebugUnitTest` runs
* compose every specimen as a smoke test; images are only written by
* `./gradlew :app:recordRoborazziDebug`, into `app/build/outputs/roborazzi/`.
* They are review aids, not committed goldens or store screenshots.
*/
internal enum class SpecimenTheme(val dark: Boolean, val oled: Boolean) {
Light(dark = false, oled = false),
Dark(dark = true, oled = false),
Oled(dark = true, oled = true),
}
/** Phone-width canvas (Pixel 8 / 412dp) with the transcript's 16dp margins. */
@Composable
internal fun Specimen(theme: SpecimenTheme, content: @Composable () -> Unit) {
HapiTheme(darkTheme = theme.dark, dynamicColor = false, oled = theme.oled) {
Surface(color = MaterialTheme.colorScheme.background) {
Box(Modifier.width(412.dp).padding(horizontal = 16.dp, vertical = 20.dp)) {
Column { content() }
}
}
}
}
internal fun ComposeContentTestRule.captureSpecimen(name: String, theme: SpecimenTheme) {
waitForIdle()
onRoot().captureRoboImage("build/outputs/roborazzi/specimens/$name-${theme.name.lowercase()}.png")
}
@@ -2,14 +2,15 @@ package app.hapi.companion.ui.theme
import androidx.compose.material3.Typography
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.unit.sp
import kotlin.test.Test
import kotlin.test.assertEquals
/**
* Contract of the app-wide Material type scale: the reading tokens drive
* their anchored slots, every other slot stays byte-for-byte at the Material
* platform default, and the monospace code token never reaches a reading slot.
* their anchored slots, body slots drop Material's tracking, every other slot
* stays byte-for-byte at the Material platform default, and the bundled
* monospace code family never reaches a reading slot.
*/
class HapiTypographyScaleTest {
@@ -30,16 +31,23 @@ class HapiTypographyScaleTest {
}
@Test
fun `anchored slots keep Material weight, tracking and family`() {
fun `anchored slots keep Material weight and family`() {
val scale = HapiTypography.scale
assertEquals(platformDefaults.bodyLarge.fontWeight, scale.bodyLarge.fontWeight)
assertEquals(platformDefaults.bodyLarge.letterSpacing, scale.bodyLarge.letterSpacing)
assertEquals(platformDefaults.bodyLarge.fontFamily, scale.bodyLarge.fontFamily)
assertEquals(platformDefaults.bodySmall.fontWeight, scale.bodySmall.fontWeight)
assertEquals(platformDefaults.bodySmall.letterSpacing, scale.bodySmall.letterSpacing)
assertEquals(platformDefaults.bodySmall.fontFamily, scale.bodySmall.fontFamily)
}
@Test
fun `body slots drop Material tracking, all else stays default`() {
val scale = HapiTypography.scale
assertEquals(0.sp, scale.bodyLarge.letterSpacing)
assertEquals(0.sp, scale.bodyMedium.letterSpacing)
assertEquals(0.sp, scale.bodySmall.letterSpacing)
assertEquals(platformDefaults.bodyMedium.copy(letterSpacing = 0.sp), scale.bodyMedium)
}
@Test
fun `slots without a token stay exactly at the platform default`() {
val scale = HapiTypography.scale
@@ -53,7 +61,6 @@ class HapiTypographyScaleTest {
"titleLarge" to (platformDefaults.titleLarge to scale.titleLarge),
"titleMedium" to (platformDefaults.titleMedium to scale.titleMedium),
"titleSmall" to (platformDefaults.titleSmall to scale.titleSmall),
"bodyMedium" to (platformDefaults.bodyMedium to scale.bodyMedium),
"labelLarge" to (platformDefaults.labelLarge to scale.labelLarge),
"labelMedium" to (platformDefaults.labelMedium to scale.labelMedium),
"labelSmall" to (platformDefaults.labelSmall to scale.labelSmall),
@@ -65,7 +72,7 @@ class HapiTypographyScaleTest {
@Test
fun `code token stays monospaced and out of the reading slots`() {
assertEquals(FontFamily.Monospace, HapiTypography.code.fontFamily)
assertEquals(HapiTypography.monoFamily, HapiTypography.code.fontFamily)
// Reading slots keep whatever family Material ships with (SansSerif
// in this version); the monospace family lives only in the code token.
assertEquals(platformDefaults.bodyLarge.fontFamily, HapiTypography.scale.bodyLarge.fontFamily)
+9
View File
@@ -42,6 +42,11 @@ fragment = "1.8.5"
# Per-app locales (B-M5a): AppCompatDelegate.setApplicationLocales back to
# API 26 (appcompat 1.7.1, 2025-06, on Google Maven).
appcompat = "1.7.1"
# Visual specimens (JVM screenshots, see README "Visual specimens"):
# Robolectric 4.17 renders SDK 36 with native graphics; Roborazzi captures.
robolectric = "4.17"
# 1.61+ ships Kotlin 2.3 metadata, unreadable by this Kotlin 2.1 build.
roborazzi = "1.60.0"
[libraries]
# AndroidX
@@ -99,6 +104,9 @@ junit = { group = "junit", name = "junit", version.ref = "junit" }
kotlin-test = { group = "org.jetbrains.kotlin", name = "kotlin-test", version.ref = "kotlin" }
okhttp-mockwebserver = { group = "com.squareup.okhttp3", name = "mockwebserver", version.ref = "okhttp" }
turbine = { group = "app.cash.turbine", name = "turbine", version.ref = "turbine" }
robolectric = { group = "org.robolectric", name = "robolectric", version.ref = "robolectric" }
roborazzi = { group = "io.github.takahirom.roborazzi", name = "roborazzi", version.ref = "roborazzi" }
roborazzi-compose = { group = "io.github.takahirom.roborazzi", name = "roborazzi-compose", version.ref = "roborazzi" }
[plugins]
android-application = { id = "com.android.application", version.ref = "agp" }
@@ -109,3 +117,4 @@ kotlin-compose = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "ko
kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
# Applied conditionally in :app (only when google-services.json exists).
google-services = { id = "com.google.gms.google-services", version.ref = "googleServices" }
roborazzi = { id = "io.github.takahirom.roborazzi", version.ref = "roborazzi" }