UI refinement pass

Remove gesture-help bottom-bars from many places in the UI, adjust
layouts to be able to handle larger fonts, and other small UI fixes.
This commit is contained in:
James Babcock committed 2026-08-22 18:48:20 -07:00
1 parent dc18737dfc
commit 35e6977c6c
17 files changed
+394 -321

No files matched your search

+20 -10
View File
@@ -4,19 +4,24 @@ import { wrapText, truncateText } from "../../graphics/textwrap";
import { clamp } from "../../util/numeric-util";
import { readUpcomingEvents, type CalendarEvent } from "../../native/calendar";
import { timeFormatSetting } from "../../ui/dashboard-settings";
import { GESTURE_CLICK, GESTURE_DOUBLE_CLICK } from "../../ui/gestures";
import { GESTURE_CLICK } from "../../ui/gestures";
import { hasCalendarPermission } from "../../g2/android-permissions";
import { type DashboardInputEvent, type Layer, type LayerContext } from "../../ui/layers";
import { lineStep } from "../../ui/metrics";
const PAGE_X = 12;
const PAGE_Y = 12;
// Title position, shared with the other list apps (terminal, notifications).
const TITLE_X = 18;
const TITLE_Y = 10;
const LIST_TOP = 38;
const ROW_X = 16;
const DAY_HEADER_HEIGHT = 16;
const ROW_GAP = 4;
const MAX_EVENTS = 50;
/** Height of the day header band above a row that starts a new day. */
function dayHeaderHeight(font: UiFont): number {
return font.lineHeight + 4;
}
const WEEKDAYS = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
const MONTHS = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
@@ -43,26 +48,31 @@ export class CalendarLayer implements Layer {
const font = getDefaultSmallFont();
const { width, height } = ctx.stack.getBaseSize();
const image = new GrayImage(width, height, 0);
image.drawText(font, PAGE_X + 12, PAGE_Y + 9, "Calendar", 220);
if (!hasCalendarPermission()) {
image.drawText(font, TITLE_X, TITLE_Y, "Calendar", 220);
this.paintPermissionPrompt(image, font, width, height);
return image;
}
const events = readUpcomingEvents(MAX_EVENTS);
if (!events.length) {
image.drawText(font, TITLE_X, TITLE_Y, "Calendar", 220);
image.drawText(font, 24, 72, "No upcoming events.", 190);
image.drawText(font, 24, height - 36, `${GESTURE_DOUBLE_CLICK} back`, 110);
return image;
}
const rows = buildEventRows(font, events);
this.selectedIndex = clamp(this.selectedIndex, 0, rows.length - 1);
image.drawText(font, width - 96, PAGE_Y + 9, `${this.selectedIndex + 1}/${rows.length}`, 150);
const listBottom = height;
const scrollY = scrollForSelected(rows, this.selectedIndex, listBottom - LIST_TOP);
// The title scrolls away with the list; row text is deferred glyphs
// (composited above raster fills), so a fixed title would show through
// rows scrolled over it.
if (TITLE_Y - scrollY + font.lineHeight > 0) {
image.drawText(font, TITLE_X, TITLE_Y - scrollY, "Calendar", 220);
}
let cursorY = LIST_TOP - scrollY;
for (let index = 0; index < rows.length; index++) {
const row = rows[index]!;
@@ -96,7 +106,7 @@ export class CalendarLayer implements Layer {
for (let index = 0; index < lines.length; index++) {
image.drawText(font, 24, 72 + index * lineStep(font), lines[index]!, 190);
}
image.drawText(font, 24, height - 36, `${GESTURE_CLICK} request ${GESTURE_DOUBLE_CLICK} back`, 110);
image.drawText(font, 24, height - 36, `${GESTURE_CLICK} request`, 110);
}
}
@@ -119,7 +129,7 @@ function buildEventRows(font: UiFont, events: CalendarEvent[]): EventRow[] {
event,
dayHeader,
lines,
height: (dayHeader ? DAY_HEADER_HEIGHT : 0) + 6 + lines.length * lineStep(font),
height: (dayHeader ? dayHeaderHeight(font) : 0) + 6 + lines.length * lineStep(font),
});
}
return rows;
@@ -137,7 +147,7 @@ function drawEventRow(
let cursorY = y;
if (row.dayHeader) {
image.drawText(font, x, cursorY + 2, row.dayHeader, 150);
cursorY += DAY_HEADER_HEIGHT;
cursorY += dayHeaderHeight(font);
}
const bodyHeight = row.lines.length * lineStep(font) + 4;
if (selected) {