Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .claude/skills/github-pr/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ matched pull request's body in full.
| 6 | `v0.6.0 — Dishka DI, scrolling text, in-app guide from the repo` | PRs #60–#74; issues #96, #97, #99, #101, #103, #104 |
| 7 | `Dependencies — dependabot bumps` | every dependabot bump; deliberately not a version, and open for good |
| 8 | `v0.7.0 — School-year calendar, day ribbon, rearrangeable tabs` | PRs #75–#85, #128; issues #98, #100, #105–#108 |
| 9 | `v0.8.0 — On-device checks, 89-region e-diary survey` | PRs #129, #133, #134, #186, #187, #189, #234, #238, #239; issues #109–#117, #130–#132, #167–#185, #188, #219–#233, #237 — **open**, the first whose work needs an emulator or a phone |
| 9 | `v0.8.0 — On-device checks, 89-region e-diary survey` | PRs #129, #133, #134, #186, #187, #189, #234, #238, #239, #241; issues #109–#117, #130–#132, #167–#185, #188, #219–#233, #237, #240, #242 — **open**, the first whose work needs an emulator or a phone |
| 10 | `v0.9.0 — NetSchool e-diary, onboarding via the school's diary` | PRs #140, #214, #218; issues #135–#139, #141, #145–#165, #190–#213 — **open**, the one being worked on |

All ten were renamed on 25 September 2026: every title now names what the version
Expand Down
252 changes: 138 additions & 114 deletions HANDOVER.md

Large diffs are not rendered by default.

7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ Read this before planning a release.
| `ruff check app tests scripts migrations` | clean |
| `python -m mypy` | clean, 153 modules — asks whether anything reaches for an attribute that does not exist |
| `pytest -q -n auto` | 2065 tests, green, about four minutes — the command CI runs |
| `./gradlew test` | 1579 tests, green, all five modules |
| `./gradlew test` | 1587 tests, green, all five modules |
| `./gradlew detekt` | no finding beyond each module's baseline, all five modules |
| `./gradlew assembleDebug` | the APK builds |
| `./gradlew assembleRelease` | the APK builds; R8 and resource shrinking pass |
Expand All @@ -233,7 +233,10 @@ twelve defects (#167–#178), and the fixes were checked on the same emulator. T
requests of that night about the tab bar and the pickers (#179–#184) are held by JVM tests;
on the emulator, which the owner was using at the same time, only the one-touch pickup and
the pill's round end were seen. What it could not give is written in `HANDOVER.md`: a thumb,
haptics, a real GPU, Doze on a school morning, TalkBack, a real diary account.
haptics, a real GPU, Doze on a school morning, TalkBack, a real diary account. On 2 October
2026 two API 37 emulators added the bearers sealed by the Keystore (#201), through an upgrade
in place and a reboot, and a release build signed with the owner's key refusing `http://` and
reading production over TLS (#202); no phone has run either (#241).

**What nothing checks automatically.** One test source set runs on a device, and only on
demand: `ToolbarOnDeviceTest` in `:core:designsystem` (#110), three tests of the tab bar's
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.heightIn
import androidx.compose.foundation.layout.navigationBars
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
Expand Down Expand Up @@ -77,6 +78,7 @@ import androidx.compose.ui.semantics.onLongClick
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.platform.LocalConfiguration
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.text.rememberTextMeasurer
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.Dp
Expand Down Expand Up @@ -123,10 +125,20 @@ data class ToolbarAction(
val onClick: (at: Offset) -> Unit,
)

/**
* The pill's test tag. The pill draws no text of its own, so its height — the
* one thing #240 got wrong — cannot be asked of any node but this one.
*/
internal const val ToolbarPillTag = "lessons_toolbar_pill"

/** Width of an icon-only item, and the height of every item. */
private val ItemSize: Dp = 48.dp

/** Extra width the selected item grows by to fit its label. */
/**
* What a label is counted as when deciding whether labels fit on the row at
* all — see [CompactScreenWidthDp] — and the least the row's spare width is
* taken to be. Not the width a label is drawn at: that is its own (#242).
*/
private val LabelWidth: Dp = 80.dp

/** Gap between two items while the toolbar is expanded. */
Expand Down Expand Up @@ -154,8 +166,24 @@ private const val CompactScreenWidthDp = 330
/** Diameter of the badge dot. */
private val BadgeSize: Dp = 8.dp

/** Longest a title may be in the toolbar's standard mode before it marquees. */
private val TitleWidthRange = 100.dp..250.dp
/** The padding on either side of a title in the toolbar's standard mode. */
private val TitlePadding: Dp = 8.dp

/**
* From this smallest width the window is a tablet's — Material's medium window
* class, and the usual line between a phone and a tablet.
*/
private const val TabletSmallestWidthDp = 600

/**
* How much of a tablet's window a label or a title may take before it scrolls.
*
* The owner's rule (#242): every button is as wide as its text, and the text
* stops growing at 30 % of a tablet's window; on a phone it may take whatever
* the row leaves it, so that the page's name is read rather than scrolled
* wherever there is room for it.
*/
private const val TabletLabelShare = 0.3f

/**
* The bar at the bottom: a vibrant pill floating over the content, where the
Expand Down Expand Up @@ -243,6 +271,7 @@ fun LessonsFloatingToolbar(
val slots = items.size + if (actionButton != null) 1 else 0
val hideLabel = fontScale > LabelFontScaleLimit ||
(screenWidth < CompactScreenWidthDp && slots > 3)
val tablet = LocalConfiguration.current.smallestScreenWidthDp >= TabletSmallestWidthDp

val colors = FloatingToolbarDefaults.vibrantFloatingToolbarColors(
toolbarContentColor = scheme.onSurface,
Expand All @@ -255,7 +284,8 @@ fun LessonsFloatingToolbar(
modifier = modifier
.fillMaxWidth()
.windowInsetsPadding(WindowInsets.navigationBars)
.padding(horizontal = 16.dp, vertical = 8.dp),
.padding(horizontal = 16.dp, vertical = 8.dp)
.heightIn(min = ActionSlotHeight),
contentAlignment = Alignment.Center,
) {
// The two modes cross-fade into each other and the pill resizes with a
Expand Down Expand Up @@ -299,12 +329,20 @@ fun LessonsFloatingToolbar(
) { backMode ->
if (backMode) {
Row(
// Material's horizontal padding, moved in here; see
// [PillContentPadding].
modifier = Modifier.padding(horizontal = PillEndPadding),
// Material's padding, all four sides of it, moved in
// here; see [PillContentPadding].
modifier = Modifier.padding(PillPadding),
verticalAlignment = Alignment.CenterVertically,
) {
BackAndTitle(title = title, onBackClick = onBackClick ?: {})
BackAndTitle(
title = title,
onBackClick = onBackClick ?: {},
titleMax = textCap(
screenWidth = screenWidth.dp,
tablet = tablet,
spare = spareTitleWidth(screenWidth.dp, actionButton != null),
),
)
}
} else {
ToolbarItems(
Expand All @@ -325,20 +363,24 @@ fun LessonsFloatingToolbar(
reordering = reordering,
onReorderingChange = onReorderingChange,
onReorder = onReorder,
labelMax = if (scrollableItems) {
LabelWidth
} else {
spareLabelWidth(screenWidth.dp, items.size, actionButton != null)
},
labelMax = textCap(
screenWidth = screenWidth.dp,
tablet = tablet,
spare = if (scrollableItems) {
scrollingItemsMaxWidth(actionButton != null) - PillPadding * 2 - ItemSize
} else {
spareLabelWidth(screenWidth.dp, items.size, actionButton != null)
},
),
)
}
}
}

// Nothing here: the mode morph is animated by the size transform above,
// and within a mode the pill's width already follows its tabs, which
// animate their own widths on a spring.
val pillModifier = Modifier
// Nothing but the tag: the mode morph is animated by the size transform
// above, and within a mode the pill's width already follows its tabs,
// which animate their own widths on a spring.
val pillModifier = Modifier.testTag(ToolbarPillTag)

// Two call sites rather than one with a nullable argument: the overload
// without the slot is what keeps a toolbar with no action button centred.
Expand Down Expand Up @@ -469,9 +511,9 @@ private fun ToolbarItems(
// padded and the window it scrolls in reaches the pill's edge:
// a section scrolled half out of view goes under the pill's
// round end rather than being cut off 8 dp inside it (#183).
.padding(horizontal = PillEndPadding)
.padding(PillPadding)
} else {
Modifier.padding(horizontal = PillEndPadding)
Modifier.padding(PillPadding)
},
verticalAlignment = Alignment.CenterVertically,
) {
Expand Down Expand Up @@ -558,12 +600,31 @@ private fun ToolbarItems(
* action button with its own gap. The terms are [scrollingItemsMaxWidth]'s.
*/
internal fun spareLabelWidth(screenWidth: Dp, items: Int, hasAction: Boolean): Dp {
val rest = ToolbarSideMargin * 2 + PillEndPadding * 2 + ItemSize * items +
val rest = ToolbarSideMargin * 2 + PillPadding * 2 + ItemSize * items +
ItemGap * (items - 1).coerceAtLeast(0) +
if (hasAction) ItemSize + ItemGap * 2 else 0.dp
return (screenWidth - rest).coerceAtLeast(LabelWidth)
}

/**
* The widest a title's text may grow in the standard mode: the window less the
* margins, the pill's ends, the back button and the gap after it, the title's
* own padding, and the button beside the pill if there is one.
*/
internal fun spareTitleWidth(screenWidth: Dp, hasAction: Boolean): Dp {
val rest = ToolbarSideMargin * 2 + PillPadding * 2 + ItemSize + ItemGap + TitlePadding * 2 +
if (hasAction) ItemSize + ItemGap * 2 else 0.dp
return (screenWidth - rest).coerceAtLeast(0.dp)
}

/**
* The widest a label or a title is drawn before it scrolls (#242): what the row
* can [spare] on a phone, and on a tablet no more than [TabletLabelShare] of the
* window either.
*/
internal fun textCap(screenWidth: Dp, tablet: Boolean, spare: Dp): Dp =
if (tablet) minOf(screenWidth * TabletLabelShare, spare) else spare

/**
* A tab's disc. Unselected it is transparent: it used to be the pill's own
* colour, invisible everywhere except where a carried tab, drawn above its
Expand Down Expand Up @@ -610,27 +671,46 @@ private fun scrollingItemsMaxWidth(hasAction: Boolean): Dp {
private val ToolbarSideMargin: Dp = 16.dp

/**
* Material's padding inside the pill, less its two ends (#183).
* How tall Material makes the bar when a button sits beside the pill: the
* button's slot, sized for a medium FAB (`FloatingToolbarDefaults.FabSizeRange`,
* internal to Material), with the 64 dp pill centred in it.
*
* A bar without a button keeps the same height, so the pill stands at one
* height on every page. Wrapping the pill alone made that bar 16 dp shorter,
* and, sitting on the bottom of the screen, it carried its pill 8 dp lower —
* the pill dropped as settings opened and rose as they closed (#240).
*/
private val ActionSlotHeight: Dp = 80.dp

/**
* Material's padding inside the pill: none, because all of it is in the rows.
*
* `FloatingToolbarDefaults.ContentPadding` is 8 dp all round, and in the layout
* with a button beside the pill Material scrolls its content inside it. A
* scroll container clips to a rectangle along its axis, so anything reaching
* an end — a documentation section scrolled half out of view, a held tab drawn
* larger, a jiggling one — was cut off by a straight edge 8 dp in from the
* pill's curve, and the round end the pill clips itself to was never reached.
* The ends' padding is [PillEndPadding] instead, inside every row, so the rows
* sit exactly where they did and everything that leaves them goes under the
* pill's own round end.
* So the ends' padding moved inside every row (#183), and everything that
* leaves a row goes under the pill's own round end.
*
* The top and bottom moved with them, because half of it inside is worse than
* either whole (#240). Without a button beside the pill Material balances the
* pill's padding against the interactive insets it reads off the content's
* alignment lines, and the back button's line said 8 dp in from the side and
* nothing from the top — so Material padded the pill by twice the difference,
* and every page without a button was 80 dp tall where it is 64 dp with one.
* With [PillPadding] on all four sides the insets agree and nothing is added.
*/
private val PillContentPadding = PaddingValues(vertical = 8.dp)
private val PillContentPadding = PaddingValues(0.dp)

/** The two ends of Material's padding, drawn inside the rows; see above. */
private val PillEndPadding: Dp = 8.dp
/** Material's padding, drawn inside every row on all four sides; see above. */
private val PillPadding: Dp = 8.dp

/**
* What the cap on the scrolling row keeps back on each side of it beyond the
* margins. It was a generous 16 dp estimate of Material's padding, when that
* sat outside the row; [PillEndPadding] is now inside, so this is only what
* sat outside the row; [PillPadding] is now inside, so this is only what
* the estimate had to spare, and the pill is exactly as wide as it was.
*/
private val PillSlack: Dp = 8.dp
Expand Down Expand Up @@ -721,17 +801,17 @@ private fun ToolbarTab(
// As wide as the label, not a fixed 80 dp: «Календарь» in bold is wider
// than that at the app's larger text scales and at a system font scale
// from about 1.1, and a label that does not fit is a marquee that never
// stops — mid-lap it read «› Кален…» (#227). Never narrower than 80 dp, so
// the short labels and the tests' geometry are as they were, and never
// wider than the row can spare.
// stops — mid-lap it read «› Кален…» (#227). Not held to 80 dp either, the
// floor #227 kept: «Today» sat in a pill twice its width (#242). Never
// wider than [labelMax], past which it scrolls.
val labelStyle = MaterialTheme.typography.labelLarge.emphasised(active = true)
val measurer = rememberTextMeasurer()
val density = LocalDensity.current
val labelFits = remember(item.label, labelStyle, density, labelMax) {
// A measurement, not a line on screen: one line is what the label is drawn on.
val px = measurer.measure(item.label, labelStyle, maxLines = 1, softWrap = false).size.width
// A pixel of slack for the round trip through dp.
with(density) { (px + 1).toDp() }.coerceIn(LabelWidth, labelMax.coerceAtLeast(LabelWidth))
with(density) { (px + 1).toDp() }.coerceAtMost(labelMax)
}
val labelWidth by animateDpAsState(
targetValue = if (selected && !hideLabel) labelFits else 0.dp,
Expand Down Expand Up @@ -972,6 +1052,7 @@ private fun ToolbarActionButton(action: ToolbarAction) {
private fun BackAndTitle(
title: String?,
onBackClick: () -> Unit,
titleMax: Dp,
) {
val scheme = MaterialTheme.colorScheme
val view = rememberHapticView()
Expand All @@ -997,17 +1078,18 @@ private fun BackAndTitle(
}
if (title != null) {
Spacer(Modifier.width(ItemGap))
// The width range and the padding go on the box, so the title is
// measured against the room it will actually be drawn in rather than
// against the toolbar. Same reason as the label above: a title that
// fits should sit still.
// The cap and the padding go on the box, so the title is measured
// against the room it will actually be drawn in rather than against
// the toolbar. Same reason as the label above: a title that fits
// should sit still. No floor: a short title used to sit in at least
// 100 dp, and «← Sync» was as wide a pill as «← Settings» (#242).
MarqueeText(
text = title,
style = MaterialTheme.typography.titleMedium,
color = scheme.background,
modifier = Modifier
.widthIn(min = TitleWidthRange.start, max = TitleWidthRange.endInclusive)
.padding(horizontal = 8.dp),
.widthIn(max = titleMax + TitlePadding * 2)
.padding(horizontal = TitlePadding),
)
}
}
Expand Down
Loading