| 1 | import { DEFAULT_BASE_FONT_SIZE, normalizeBaseFontSize } from "./appearancePreferences"; |
| 2 | |
| 3 | /** Android controls follow the app's text size; buttons and menu rows retain a 48dp touch target. */ |
| 4 | export function resolveAndroidControlSizing(baseFontSize: number) { |
| 5 | const scale = normalizeBaseFontSize(baseFontSize) / DEFAULT_BASE_FONT_SIZE; |
| 6 | const iconSize = Math.round(24 * scale); |
| 7 | const buttonSize = Math.max(48, Math.round(48 * scale)); |
| 8 | const fabSize = Math.max(48, Math.round(56 * scale)); |
| 9 | |
| 10 | return { |
| 11 | scale, |
| 12 | iconSize, |
| 13 | smallIconSize: Math.round(16 * scale), |
| 14 | mediumIconSize: Math.round(18 * scale), |
| 15 | buttonSize, |
| 16 | fabSize, |
| 17 | largeFabSize: Math.round(96 * scale), |
| 18 | menuWidth: Math.round(250 * scale), |
| 19 | menuItemHeight: Math.max(48, Math.round(48 * scale)), |
| 20 | // Two floating actions, their gap, and the space below the lower action. |
| 21 | fabClearance: fabSize * 2 + 36, |
| 22 | }; |
| 23 | } |