launcher: match GrapheneOS Launcher3 phone UI geometry
- Commit
c5e750e87d6820fd66a88680e3610a1ef5ecef01- Author
- Vayun Mathur <[email protected]>
- When
- 2026-12-06 16:50 UTC (37 minutes ago)
- Parents
3c055c1
The previous phone work matched Launcher3 feature sets; the owner requires the identical UI. Re-pulled Launcher3QuickStep 17 (same sha256 as the earlier audit) from the owner's Pixel 9 Pro XL and measured its binary resources (device_profiles, handheld spec files, paddings_5_col, dimens, layouts, launcher_preferences). Full evidence and the 28-row gap table are in analysis/launcher3-ui-gap.md (gitignored); no stock assets were copied, geometry is recreated. New pure domain Launcher3Geometry carries the measured values: icon 66dp@4col / 57dp@5col, label 14/12sp, edge margin 10.77dp, cell gutter 16dp, cell padding 8dp, indicator 6dp/4dp/24dp, drop targets 56dp/28dp/80dp, folder columns workspace-1 with 16dp gutter and a 56dp name footer, all-apps 48dp search/pills, 128x2 divider, widget-picker text sizes, workspace scale 0.97, and the paddings_5_col top/bottom buckets. UI now reads from it: CellLayout measures margin+gutter (CellMetrics pitch/span/cellAt/cellBounds, HomeDropLogic and widget spans updated), WorkspacePage applies the bucket paddings, PageIndicator uses uniform dots, the drawer uses Fixed(workspace columns) with the stock header/tabs/divider, and Settings uses the stock GrapheneOS strings. All existing settings keys, grid options, list layout, predictions, work handling, widget hosting and drag behaviour are preserved. Tests: Launcher3GeometryTest pins the measured numbers and the CellMetrics pitch/span/cellAt math; settings and widget-picker UI tests follow the stock labels/format. Verified with ./gradlew :launcher:lint :launcher:lintVitalRelease :launcher:testDevUnitTest --max-workers=128: BUILD SUCCESSFUL, 438 tests, 0 failures (baseline on origin/main was also green).
Diff
launcher/AGENTS.md
diff --git a/launcher/AGENTS.md b/launcher/AGENTS.mdindex 1a74d3bdcd..6979ff952a 100644--- a/launcher/AGENTS.md+++ b/launcher/AGENTS.md@@ -116,6 +116,7 @@ neither runs on the wrong form factor. - com/vayunmathur/launcher/domain/HotseatArrange.kt - com/vayunmathur/launcher/domain/LauncherItemType.kt - com/vayunmathur/launcher/domain/LauncherTuning.kt+- com/vayunmathur/launcher/domain/Launcher3Geometry.kt — GrapheneOS Launcher3 phone geometry (icon/label sizes by column count, edge margin, cell gutter, indicator/drop-target/folder/all-apps/widget-picker dimens, paddings buckets); phone UI reads sizes from here, evidence in `analysis/launcher3-ui-gap.md` (gitignored) - com/vayunmathur/launcher/domain/PageCount.kt - com/vayunmathur/launcher/domain/ReorderDwell.kt - com/vayunmathur/launcher/domain/FastScroll.kt
launcher/src/main/java/com/vayunmathur/launcher/domain/Launcher3Geometry.kt
diff --git a/launcher/src/main/java/com/vayunmathur/launcher/domain/Launcher3Geometry.kt b/launcher/src/main/java/com/vayunmathur/launcher/domain/Launcher3Geometry.ktnew file mode 100644index 0000000000..e033b352e9--- /dev/null+++ b/launcher/src/main/java/com/vayunmathur/launcher/domain/Launcher3Geometry.kt@@ -0,0 +1,135 @@+package com.vayunmathur.launcher.domain++/**+ * GrapheneOS Launcher3 (Launcher3QuickStep 17) phone geometry, measured from+ * the stock APK's binary resources. See analysis/launcher3-ui-gap.md for the+ * evidence table. Pure values and bucket math so the geometry is testable+ * without Compose; UI files convert dp/sp at the call site.+ *+ * Measured values come from device_profiles.xml, the handheld spec files,+ * paddings_5_col.xml and dimens in the pulled APK. Values for grid column+ * counts GrapheneOS does not ship on phones (3 and 6, kept because our+ * settings offer them) follow the APK's iconSize ladder one step beyond the+ * measured 4- and 5-column points and are marked as ladder steps, not+ * measurements.+ */+object Launcher3Geometry {++ // device_profiles.xml handheld profiles + spec_handheld_workspace_cell_*:+ // 4 columns -> iconSize60dp resource (66dp), text 14sp;+ // 5 columns -> iconSize52dp resource (57dp), text 12sp.+ // 3 and 6 columns step one rung along the same iconSize ladder+ // (iconSize66dp=72dp, iconSize48dp=52dp); text follows the measured+ // 16sp (2x2) / 14sp / 12sp progression.+ fun iconSizeDp(columns: Int): Float = when (columns.coerceIn(3, 6)) {+ 3 -> 72f+ 4 -> 66f+ 5 -> 57f+ else -> 52f+ }++ fun labelTextSizeSp(columns: Int): Float = when (columns.coerceIn(3, 6)) {+ 3 -> 16f+ 4 -> 14f+ else -> 12f+ }++ /** device_profiles: numAllAppsColumns equals the workspace columns on phones. */+ fun allAppsColumns(workspaceColumns: Int): Int = workspaceColumns++ /** device_profiles: 4-column workspace -> 3x3 folder, 5-column -> 4x4 folder. */+ fun folderColumns(workspaceColumns: Int): Int =+ (workspaceColumns - 1).coerceIn(3, 4)++ // dimens: dynamic_grid_edge_margin / cell_layout_padding.+ const val WorkspaceEdgeMarginDp = 10.77f++ // device_profiles borderSpace / dynamic_grid_cell_border_spacing.+ const val CellBorderSpacingDp = 16f++ // dimens: dynamic_grid_cell_padding_x; spec cell iconDrawablePadding (5-col).+ const val CellPaddingXD = 8f+ const val IconDrawablePaddingDp = 4f++ // dimens: all_apps_icon_drawable_padding.+ const val AllAppsDrawablePaddingDp = 8f++ // dimens: all_apps_label_text_size.+ const val AllAppsLabelTextSizeSp = 14f++ // dimens: page_indicator_dot_size, page_indicator_gap_width,+ // workspace_page_indicator_height.+ const val PageIndicatorDotDp = 6f+ const val PageIndicatorGapDp = 4f+ const val PageIndicatorHeightDp = 24f++ // dimens: workspace_content_scale (the workspace behind a fully open drawer).+ const val WorkspaceContentScale = 0.97f++ // dimens: all_apps_search_bar_field_height, all_apps_header_pill_height,+ // all_apps_header_pill_corner_radius, all_apps_header_top_padding,+ // all_apps_header_bottom_padding, all_apps_tabs_margin_top.+ const val AllAppsSearchFieldHeightDp = 48f+ const val AllAppsHeaderPillHeightDp = 48f+ const val AllAppsHeaderPillRadiusDp = 12f+ const val AllAppsHeaderTopPaddingDp = 36f+ const val AllAppsHeaderBottomPaddingDp = 14f+ const val AllAppsTabsMarginTopDp = 8f++ // dimens: all_apps_divider_width, all_apps_divider_height.+ const val AllAppsDividerWidthDp = 128f+ const val AllAppsDividerHeightDp = 2f++ // dimens: dynamic_grid_drop_target_size, drop_target_top_margin,+ // drop_target_bottom_margin, drop_target_button_gap,+ // drop_target_button_frame_radius, drop_target_text_size.+ const val DropTargetSizeDp = 56f+ const val DropTargetTopMarginDp = 32f+ const val DropTargetBottomMarginDp = 16f+ const val DropTargetButtonGapDp = 28f+ const val DropTargetFrameRadiusDp = 80f+ const val DropTargetTextSizeSp = 16f++ // dimens: folder_top_padding_default, folder_content_padding_left_right,+ // folder_cell_x_padding, folder_cell_y_padding, folder_footer_height_default.+ const val FolderTopPaddingDp = 24f+ const val FolderContentPaddingDp = 8f+ const val FolderCellXPaddingDp = 9f+ const val FolderCellYPaddingDp = 6f+ const val FolderFooterHeightDp = 56f+ const val FolderGutterDp = 16f++ // dimens: fastscroll_popup_text_size (width/height/margin live in DrawerFastScroll).+ const val FastScrollPopupTextSizeSp = 32f++ // dimens: widget_picker_title_font_size, widget_picker_header_app_title_font_size,+ // widget_cell_title_font_size, widget_cell_description_font_size.+ const val WidgetPickerTitleSizeSp = 24f+ const val WidgetGroupTitleSizeSp = 16f+ const val WidgetCellTitleSizeSp = 14f+ const val WidgetCellDescriptionSizeSp = 12f++ /**+ * paddings_5_col.xml: workspace top padding for the measured empty-space+ * bucket. maxEmptySpace is the vertical room left after the grid's+ * minimum cells, in dp.+ */+ fun workspaceTopPaddingDp(maxEmptySpaceDp: Float): Float = when {+ maxEmptySpaceDp <= 23f -> 0f+ maxEmptySpaceDp <= 45f -> 8f+ maxEmptySpaceDp <= 64f -> 16f+ maxEmptySpaceDp <= 115f -> 36f+ maxEmptySpaceDp <= 139f -> 48f+ maxEmptySpaceDp <= 155f -> 60f+ else -> 72f+ }++ /** paddings_5_col.xml: extra bottom padding under the workspace (hotseat excluded). */+ fun workspaceBottomExtraDp(maxEmptySpaceDp: Float): Float = when {+ maxEmptySpaceDp <= 45f -> 0f+ else -> workspaceTopPaddingDp(maxEmptySpaceDp)+ }++ /** Minimum workspace cell height of the matching handheld device profile. */+ fun minCellHeightDp(columns: Int): Float = if (columns <= 4) 104f else 108f+}
launcher/src/main/java/com/vayunmathur/launcher/domain/LauncherTuning.kt
diff --git a/launcher/src/main/java/com/vayunmathur/launcher/domain/LauncherTuning.kt b/launcher/src/main/java/com/vayunmathur/launcher/domain/LauncherTuning.ktindex ccd667ea30..c947063da7 100644--- a/launcher/src/main/java/com/vayunmathur/launcher/domain/LauncherTuning.kt+++ b/launcher/src/main/java/com/vayunmathur/launcher/domain/LauncherTuning.kt@@ -44,8 +44,8 @@ object LauncherTuning { */ const val DraggedAlpha = 0f - /** How far the workspace shrinks behind a fully open drawer, as Launcher3's does. */- const val WorkspaceScaleBehindDrawer = 0.92f+ /** How far the workspace shrinks behind a fully open drawer: `workspace_content_scale`. */+ const val WorkspaceScaleBehindDrawer = 0.97f /** * How far an item provisionally displaced by a drag pulses back towards where it came from, as a
launcher/src/main/java/com/vayunmathur/launcher/platform/LauncherLifecycleOps.kt
diff --git a/launcher/src/main/java/com/vayunmathur/launcher/platform/LauncherLifecycleOps.kt b/launcher/src/main/java/com/vayunmathur/launcher/platform/LauncherLifecycleOps.ktindex 2e8eaf41fb..dd1ca696ec 100644--- a/launcher/src/main/java/com/vayunmathur/launcher/platform/LauncherLifecycleOps.kt+++ b/launcher/src/main/java/com/vayunmathur/launcher/platform/LauncherLifecycleOps.kt@@ -135,6 +135,7 @@ internal fun LauncherViewModel.loadPreferencesImpl() { iconScale = iconScale, listLayout = drawerListLayout, twoLineLabels = drawerTwoLine,+ columns = columns, ) }
launcher/src/main/java/com/vayunmathur/launcher/platform/LauncherMenuOps.kt
diff --git a/launcher/src/main/java/com/vayunmathur/launcher/platform/LauncherMenuOps.kt b/launcher/src/main/java/com/vayunmathur/launcher/platform/LauncherMenuOps.ktindex 2198b48391..99fcb4f6cb 100644--- a/launcher/src/main/java/com/vayunmathur/launcher/platform/LauncherMenuOps.kt+++ b/launcher/src/main/java/com/vayunmathur/launcher/platform/LauncherMenuOps.kt@@ -134,6 +134,7 @@ internal fun LauncherViewModel.changeGridImpl(transform: (GridSpec) -> GridSpec) val next = transform(homeState.value.grid) repository.regrid(next) homeState.value = homeState.value.copy(grid = next)+ drawerState.value = drawerState.value.copy(columns = next.columns) settingsState.value = settingsState.value.copy( columns = next.columns, rows = next.rows,
launcher/src/main/java/com/vayunmathur/launcher/platform/LauncherUiContract.kt
diff --git a/launcher/src/main/java/com/vayunmathur/launcher/platform/LauncherUiContract.kt b/launcher/src/main/java/com/vayunmathur/launcher/platform/LauncherUiContract.ktindex 74bcd1fa41..0fa067de00 100644--- a/launcher/src/main/java/com/vayunmathur/launcher/platform/LauncherUiContract.kt+++ b/launcher/src/main/java/com/vayunmathur/launcher/platform/LauncherUiContract.kt@@ -219,6 +219,8 @@ data class DrawerUiState( val listLayout: Boolean = false, /** GrapheneOS `pref_enable_two_line_toggle` (default off): drawer grid labels may wrap to two lines. */ val twoLineLabels: Boolean = false,+ /** Workspace columns; Launcher3's all-apps grid uses the same column count. */+ val columns: Int = 5, /** * Whether the work profile is paused, or null when this build cannot pause it. *
launcher/src/main/java/com/vayunmathur/launcher/ui/DrawerCells.kt
diff --git a/launcher/src/main/java/com/vayunmathur/launcher/ui/DrawerCells.kt b/launcher/src/main/java/com/vayunmathur/launcher/ui/DrawerCells.ktindex f9fca0a586..d73311c83f 100644--- a/launcher/src/main/java/com/vayunmathur/launcher/ui/DrawerCells.kt+++ b/launcher/src/main/java/com/vayunmathur/launcher/ui/DrawerCells.kt@@ -16,7 +16,10 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.geometry.Rect import androidx.compose.ui.text.style.TextOverflow+import androidx.compose.ui.unit.dp+import androidx.compose.ui.unit.sp import com.vayunmathur.launcher.domain.CellRect+import com.vayunmathur.launcher.domain.Launcher3Geometry import com.vayunmathur.launcher.domain.LauncherItemType import com.vayunmathur.launcher.platform.DrawerActions import com.vayunmathur.launcher.platform.DrawerApp@@ -81,6 +84,11 @@ internal fun DrawerCell( // always drawn in list mode: an unlabelled list of icons is just a narrow grid. showLabel = state.showLabels && !listLayout, labelMaxLines = if (state.twoLineLabels && !listLayout) 2 else 1,+ // All-apps cells match the workspace icon (spec_all_apps_cell_match_workspace)+ // with all_apps_label_text_size 14sp and 8dp drawable padding.+ iconSize = Launcher3Geometry.iconSizeDp(state.columns).dp,+ labelTextSize = Launcher3Geometry.AllAppsLabelTextSizeSp.sp,+ labelTopPadding = Launcher3Geometry.AllAppsDrawablePaddingDp.dp, ) } val badgedIcon = @Composable {@@ -129,7 +137,11 @@ internal fun DrawerCell( modifier = Modifier.fillMaxWidth().padding(horizontal = Spacing.md), verticalAlignment = Alignment.CenterVertically, ) {- Box(Modifier.width(LauncherIconSize * state.iconScale)) { badgedIcon() }+ Box(+ Modifier.width(+ Launcher3Geometry.iconSizeDp(state.columns).dp * state.iconScale,+ ),+ ) { badgedIcon() } Text( app.label, style = MaterialTheme.typography.bodyLarge,
launcher/src/main/java/com/vayunmathur/launcher/ui/DrawerContent.kt
diff --git a/launcher/src/main/java/com/vayunmathur/launcher/ui/DrawerContent.kt b/launcher/src/main/java/com/vayunmathur/launcher/ui/DrawerContent.ktindex 70348fd350..d7416c33b4 100644--- a/launcher/src/main/java/com/vayunmathur/launcher/ui/DrawerContent.kt+++ b/launcher/src/main/java/com/vayunmathur/launcher/ui/DrawerContent.kt@@ -4,11 +4,13 @@ package com.vayunmathur.launcher.ui import androidx.activity.compose.BackHandler import androidx.compose.foundation.background+import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth+import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.systemBarsPadding@@ -29,16 +31,15 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp+import androidx.compose.ui.unit.sp+import com.vayunmathur.launcher.domain.Launcher3Geometry import com.vayunmathur.launcher.platform.DrawerActions import com.vayunmathur.launcher.platform.DrawerUiState import com.vayunmathur.launcher.ui.components.FastScrollStrip import com.vayunmathur.library.ui.CommonSearchBar-import com.vayunmathur.library.ui.HorizontalDivider import com.vayunmathur.library.ui.MaterialTheme-import com.vayunmathur.library.ui.PrimaryTabRow import com.vayunmathur.library.ui.SettingsSwitchRow import com.vayunmathur.library.ui.Spacing-import com.vayunmathur.library.ui.Tab import com.vayunmathur.library.ui.Text import com.vayunmathur.library.ui.R as UiR import kotlinx.coroutines.launch@@ -96,50 +97,95 @@ fun DrawerContent( .background(MaterialTheme.colorScheme.surface.copy(alpha = SHEET_ALPHA)), ) { Column(modifier = Modifier.fillMaxSize().systemBarsPadding()) {- // The handle Launcher3 draws at the top of the sheet (`bottom_sheet_handle`). It says- // the surface is draggable, which is the only affordance the swipe-to-close gesture has.- Box(- modifier = Modifier.fillMaxWidth().padding(vertical = Spacing.sm),- contentAlignment = Alignment.Center,- ) {- Box(- modifier = Modifier- .size(width = HANDLE_WIDTH, height = HANDLE_HEIGHT)- .clip(RoundedCornerShape(HANDLE_HEIGHT / 2))- .background(MaterialTheme.colorScheme.onSurfaceVariant),- )- }-+ // Launcher3 all-apps header: no drag handle on this surface (the+ // handle belongs to the widget-picker sheet); the search field+ // sits under all_apps_header_top_padding with its own pill. CommonSearchBar( value = state.query, onValueChange = actions::setQuery, placeholder = stringResource(UiR.string.search),- padding = PaddingValues(horizontal = Spacing.lg, vertical = Spacing.sm),+ modifier = Modifier.height(+ Launcher3Geometry.AllAppsSearchFieldHeightDp.dp,+ ),+ padding = PaddingValues(+ start = Spacing.lg,+ end = Spacing.lg,+ top = Launcher3Geometry.AllAppsHeaderTopPaddingDp.dp,+ bottom = Launcher3Geometry.AllAppsHeaderBottomPaddingDp.dp,+ ), ) // Predictions are about reaching for something without looking; a filtered list is // already the user telling us what they want, so the row would be in the way. if (state.query.isBlank() && !work && state.predictions.isNotEmpty()) { PredictionsRow(state, actions, draggable)- // Launcher3's `apps_divider_view`: the predictions are a different kind of list from- // the alphabet below them, and without a rule between them they read as its first row.- HorizontalDivider(- modifier = Modifier.padding(horizontal = Spacing.lg, vertical = Spacing.sm),- )+ // Launcher3's apps divider: a centred 128x2dp rule+ // (all_apps_divider_width/height) between predictions and the alphabet.+ Box(+ modifier = Modifier+ .fillMaxWidth()+ .padding(vertical = Spacing.sm),+ contentAlignment = Alignment.Center,+ ) {+ Box(+ modifier = Modifier+ .size(+ width = Launcher3Geometry.AllAppsDividerWidthDp.dp,+ height = Launcher3Geometry.AllAppsDividerHeightDp.dp,+ )+ .background(MaterialTheme.colorScheme.outlineVariant),+ )+ } } if (hasWork) {- PrimaryTabRow(selectedTabIndex = if (work) 1 else 0) {- Tab(- selected = !work,- onClick = { showWork = false },- text = { Text("Personal") },- )- Tab(- selected = work,- onClick = { showWork = true },- text = { Text("Work") },- )+ // PersonalWorkSlidingTabStrip: two pill buttons, 48dp tall+ // (all_apps_header_pill_height), 14sp, under an 8dp top margin.+ androidx.compose.foundation.layout.Row(+ modifier = Modifier+ .fillMaxWidth()+ .padding(+ top = Launcher3Geometry.AllAppsTabsMarginTopDp.dp,+ start = Spacing.lg,+ end = Spacing.lg,+ )+ .height(Launcher3Geometry.AllAppsHeaderPillHeightDp.dp),+ horizontalArrangement = androidx.compose.foundation.layout.Arrangement.spacedBy(+ Launcher3Geometry.AllAppsTabsMarginTopDp.dp,+ ),+ ) {+ listOf(false, true).forEach { isWork ->+ val selectedTab = work == isWork+ Box(+ modifier = Modifier+ .weight(1f)+ .fillMaxSize()+ .clip(+ RoundedCornerShape(+ Launcher3Geometry.AllAppsHeaderPillRadiusDp.dp,+ ),+ )+ .background(+ if (selectedTab) {+ MaterialTheme.colorScheme.secondaryContainer+ } else {+ MaterialTheme.colorScheme.surfaceVariant+ },+ )+ .clickable { showWork = isWork },+ contentAlignment = Alignment.Center,+ ) {+ Text(+ if (isWork) "Work" else "Personal",+ fontSize = 14.sp,+ color = if (selectedTab) {+ MaterialTheme.colorScheme.onSecondaryContainer+ } else {+ MaterialTheme.colorScheme.onSurfaceVariant+ },+ )+ }+ } } } @@ -179,9 +225,12 @@ fun DrawerContent( // untouched rather than needing a second code path for a LazyColumn. columns = if (state.listLayout) GridCells.Fixed(1)- else GridCells.Adaptive(DRAWER_CELL_MIN),+ else GridCells.Fixed(Launcher3Geometry.allAppsColumns(state.columns)), state = gridState,- contentPadding = PaddingValues(Spacing.sm),+ contentPadding = PaddingValues(+ horizontal = Launcher3Geometry.WorkspaceEdgeMarginDp.dp,+ vertical = Spacing.sm,+ ), modifier = Modifier.fillMaxSize(), ) { items(apps, key = { it.key.componentName.flattenToShortString() + it.key.profileSerial }) { app ->@@ -219,13 +268,6 @@ fun DrawerContent( } } -/** Launcher3's `bottom_sheet_handle`. */-private val HANDLE_WIDTH = 48.dp-private val HANDLE_HEIGHT = 2.dp--/** Wide enough for a label under a 48dp icon without truncating most app names. */-private val DRAWER_CELL_MIN = 76.dp- /** The corner radius of the sheet the drawer is drawn as. */ private val SHEET_CORNER = 28.dp
launcher/src/main/java/com/vayunmathur/launcher/ui/DrawerFastScroll.kt
diff --git a/launcher/src/main/java/com/vayunmathur/launcher/ui/DrawerFastScroll.kt b/launcher/src/main/java/com/vayunmathur/launcher/ui/DrawerFastScroll.ktindex 3298c85c5e..5a97e403ee 100644--- a/launcher/src/main/java/com/vayunmathur/launcher/ui/DrawerFastScroll.kt+++ b/launcher/src/main/java/com/vayunmathur/launcher/ui/DrawerFastScroll.kt@@ -24,6 +24,7 @@ import androidx.compose.ui.geometry.Size import androidx.compose.ui.layout.layout import androidx.compose.ui.unit.IntOffset import androidx.compose.ui.unit.dp+import androidx.compose.ui.unit.sp import com.vayunmathur.launcher.domain.FastScroll import com.vayunmathur.launcher.platform.DrawerApp import com.vayunmathur.launcher.ui.components.FastScrollStrip@@ -171,6 +172,7 @@ internal fun LetterBubble(apps: List<DrawerApp>, fraction: Float) { Text( letter.toString(), style = MaterialTheme.typography.headlineMedium,+ fontSize = com.vayunmathur.launcher.domain.Launcher3Geometry.FastScrollPopupTextSizeSp.sp, color = MaterialTheme.colorScheme.onPrimaryContainer, ) }
launcher/src/main/java/com/vayunmathur/launcher/ui/FolderContent.kt
diff --git a/launcher/src/main/java/com/vayunmathur/launcher/ui/FolderContent.kt b/launcher/src/main/java/com/vayunmathur/launcher/ui/FolderContent.ktindex d76f04e300..6434f8ebe7 100644--- a/launcher/src/main/java/com/vayunmathur/launcher/ui/FolderContent.kt+++ b/launcher/src/main/java/com/vayunmathur/launcher/ui/FolderContent.kt@@ -28,8 +28,10 @@ import androidx.compose.ui.graphics.graphicsLayer import androidx.compose.ui.layout.boundsInWindow import androidx.compose.ui.layout.onGloballyPositioned import androidx.compose.ui.unit.dp+import androidx.compose.ui.unit.sp import com.vayunmathur.launcher.domain.CellRect import com.vayunmathur.launcher.domain.ContainerRef+import com.vayunmathur.launcher.domain.Launcher3Geometry import com.vayunmathur.launcher.platform.FolderActions import com.vayunmathur.launcher.platform.WorkspaceItem import com.vayunmathur.launcher.ui.components.DragPayload@@ -70,6 +72,7 @@ fun FolderContent( modifier: Modifier = Modifier, showLabels: Boolean = true, iconScale: Float = 1f,+ workspaceColumns: Int = 5, anchor: Rect = Rect.Zero, progress: () -> Float = { 1f }, onDragLeft: () -> Unit = {},@@ -132,23 +135,30 @@ fun FolderContent( }, ) { Column(- modifier = Modifier.padding(Spacing.lg),+ modifier = Modifier.padding(+ start = Launcher3Geometry.FolderContentPaddingDp.dp,+ end = Launcher3Geometry.FolderContentPaddingDp.dp,+ top = Launcher3Geometry.FolderTopPaddingDp.dp,+ bottom = Spacing.sm,+ ), verticalArrangement = Arrangement.spacedBy(Spacing.md), ) {- // Editable in place, because a folder created by a drop has no name and naming it- // is the first thing anyone wants to do.- OutlinedTextField(- value = folder.label,- onValueChange = { actions.rename(folder.id, it) },- label = { Text("Folder name") },- singleLine = true,- modifier = Modifier.fillMaxWidth(),- )-+ // Folder grid first, name in the footer, as Launcher3's Folder+ // lays it out (folder_footer_height_default under the cells). LazyVerticalGrid(- columns = GridCells.Fixed(FOLDER_COLUMNS),- contentPadding = PaddingValues(Spacing.xs),- verticalArrangement = Arrangement.spacedBy(Spacing.sm),+ columns = GridCells.Fixed(+ Launcher3Geometry.folderColumns(workspaceColumns),+ ),+ contentPadding = PaddingValues(+ horizontal = Launcher3Geometry.FolderCellXPaddingDp.dp,+ vertical = Launcher3Geometry.FolderCellYPaddingDp.dp,+ ),+ horizontalArrangement = Arrangement.spacedBy(+ Launcher3Geometry.FolderGutterDp.dp,+ ),+ verticalArrangement = Arrangement.spacedBy(+ Launcher3Geometry.FolderGutterDp.dp,+ ), modifier = Modifier.fillMaxWidth().heightIn(max = FOLDER_MAX_HEIGHT), ) { itemsIndexed(folder.children, key = { _, child -> child.id }) { index, child ->@@ -159,6 +169,7 @@ fun FolderContent( actions = actions, showLabels = showLabels, iconScale = iconScale,+ workspaceColumns = workspaceColumns, dimmed = drag.payload?.itemId == child.id, onDismiss = onDismiss, // A reorder rewrites every rank after the one that moved, so without@@ -167,6 +178,23 @@ fun FolderContent( ) } }++ // Footer (folder_footer_height_default): the name, editable+ // in place — a folder created by a drop has no name yet.+ Box(+ modifier = Modifier+ .fillMaxWidth()+ .heightIn(min = Launcher3Geometry.FolderFooterHeightDp.dp),+ contentAlignment = Alignment.Center,+ ) {+ OutlinedTextField(+ value = folder.label,+ onValueChange = { actions.rename(folder.id, it) },+ label = { Text("Folder name") },+ singleLine = true,+ modifier = Modifier.fillMaxWidth(),+ )+ } } } }@@ -180,6 +208,7 @@ private fun FolderChild( actions: FolderActions, showLabels: Boolean, iconScale: Float,+ workspaceColumns: Int = 5, dimmed: Boolean, onDismiss: () -> Unit, modifier: Modifier = Modifier,@@ -224,6 +253,8 @@ private fun FolderChild( item = if (dimmed) child.copy(hidden = true) else child, scale = iconScale, showLabel = showLabels,+ iconSize = Launcher3Geometry.iconSizeDp(workspaceColumns).dp,+ labelTextSize = Launcher3Geometry.labelTextSizeSp(workspaceColumns).sp, modifier = Modifier.clickable { actions.launchChild( child,@@ -238,8 +269,6 @@ private fun FolderChild( } } -private const val FOLDER_COLUMNS = 4- /** Tall enough for three rows; past that the folder scrolls rather than filling the screen. */ private val FOLDER_MAX_HEIGHT = 320.dp
launcher/src/main/java/com/vayunmathur/launcher/ui/HomeDropLogic.kt
diff --git a/launcher/src/main/java/com/vayunmathur/launcher/ui/HomeDropLogic.kt b/launcher/src/main/java/com/vayunmathur/launcher/ui/HomeDropLogic.ktindex b700863e00..125aedfd50 100644--- a/launcher/src/main/java/com/vayunmathur/launcher/ui/HomeDropLogic.kt+++ b/launcher/src/main/java/com/vayunmathur/launcher/ui/HomeDropLogic.kt@@ -122,8 +122,8 @@ internal fun mergeTargetAt( dx = at.x - centre.x, dy = at.y - centre.y, iconSizePx = iconSizePx,- cellWidthPx = metrics.cellWidthPx.toFloat(),- cellHeightPx = metrics.cellHeightPx.toFloat(),+ cellWidthPx = metrics.pitchXPx.toFloat(),+ cellHeightPx = metrics.pitchYPx.toFloat(), ) if (progress > (best?.progress ?: 0f)) best = MergeCandidate(item.id, progress) }@@ -141,10 +141,12 @@ internal data class MergeCandidate(val id: Long, val progress: Float) */ internal fun cellBounds(rect: CellRect, pageBounds: Rect, metrics: CellMetrics): Rect? { if (metrics.cellWidthPx == 0 || metrics.cellHeightPx == 0) return null+ val left = pageBounds.left + metrics.paddingLeftPx + rect.cellX * metrics.pitchXPx+ val top = pageBounds.top + metrics.paddingTopPx + rect.cellY * metrics.pitchYPx return Rect(- left = pageBounds.left + rect.cellX * metrics.cellWidthPx.toFloat(),- top = pageBounds.top + rect.cellY * metrics.cellHeightPx.toFloat(),- right = pageBounds.left + rect.right * metrics.cellWidthPx.toFloat(),- bottom = pageBounds.top + rect.bottom * metrics.cellHeightPx.toFloat(),+ left = left,+ top = top,+ right = left + metrics.spanWidthPx(rect.spanX),+ bottom = top + metrics.spanHeightPx(rect.spanY), ) }
launcher/src/main/java/com/vayunmathur/launcher/ui/HomeOverlays.kt
diff --git a/launcher/src/main/java/com/vayunmathur/launcher/ui/HomeOverlays.kt b/launcher/src/main/java/com/vayunmathur/launcher/ui/HomeOverlays.ktindex 469f1b9eed..6b9135220b 100644--- a/launcher/src/main/java/com/vayunmathur/launcher/ui/HomeOverlays.kt+++ b/launcher/src/main/java/com/vayunmathur/launcher/ui/HomeOverlays.kt@@ -71,6 +71,7 @@ internal fun BoxScope.HomeOverlays( actions = folderActions, showLabels = showLabels, iconScale = iconScale,+ workspaceColumns = drawerState.columns, anchor = folderAnchor, progress = { folder.value }, onDragLeft = onCloseFolder,
launcher/src/main/java/com/vayunmathur/launcher/ui/HotseatBar.kt
diff --git a/launcher/src/main/java/com/vayunmathur/launcher/ui/HotseatBar.kt b/launcher/src/main/java/com/vayunmathur/launcher/ui/HotseatBar.ktindex 4cdc9f8ed9..d6e584f934 100644--- a/launcher/src/main/java/com/vayunmathur/launcher/ui/HotseatBar.kt+++ b/launcher/src/main/java/com/vayunmathur/launcher/ui/HotseatBar.kt@@ -18,6 +18,7 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.alpha import androidx.compose.ui.geometry.Rect+import androidx.compose.ui.unit.dp import com.vayunmathur.launcher.domain.CellRect import com.vayunmathur.launcher.domain.ContainerRef import com.vayunmathur.launcher.domain.LauncherItemType@@ -47,8 +48,12 @@ internal fun Hotseat( modifier = Modifier .fillMaxWidth() .height(HOTSEAT_HEIGHT)- .padding(horizontal = Spacing.sm),- horizontalArrangement = Arrangement.spacedBy(Spacing.xs),+ // Same edge margin as the workspace, so hotseat cells sit under+ // workspace columns (Launcher3 dynamic_grid_edge_margin).+ .padding(horizontal = com.vayunmathur.launcher.domain.Launcher3Geometry.WorkspaceEdgeMarginDp.dp),+ horizontalArrangement = Arrangement.spacedBy(+ com.vayunmathur.launcher.domain.Launcher3Geometry.CellBorderSpacingDp.dp,+ ), verticalAlignment = Alignment.CenterVertically, ) { repeat(state.grid.hotseatSlots) { slot ->@@ -134,6 +139,7 @@ internal fun HotseatCell( LauncherItemIcon( item = item, scale = state.iconScale,+ iconSize = com.vayunmathur.launcher.domain.Launcher3Geometry.iconSizeDp(state.grid.columns).dp, // Labels are dropped in the hotseat: the slots are narrow, and these are the icons // seen often enough not to need naming. showLabel = false,
launcher/src/main/java/com/vayunmathur/launcher/ui/SettingsContent.kt
diff --git a/launcher/src/main/java/com/vayunmathur/launcher/ui/SettingsContent.kt b/launcher/src/main/java/com/vayunmathur/launcher/ui/SettingsContent.ktindex 7be5873ebf..970bf904a5 100644--- a/launcher/src/main/java/com/vayunmathur/launcher/ui/SettingsContent.kt+++ b/launcher/src/main/java/com/vayunmathur/launcher/ui/SettingsContent.kt@@ -41,7 +41,7 @@ fun SettingsContent( onBack: () -> Unit = {}, onOpenWidgetPicker: () -> Unit = {}, ) {- AppScaffold(title = "Home screen", onNavigateBack = onBack) { padding ->+ AppScaffold(title = "Home settings", onNavigateBack = onBack) { padding -> Column( modifier = Modifier .fillMaxSize()@@ -123,9 +123,11 @@ fun SettingsContent( ) } + // Stock wording from launcher_preferences.xml: pref_add_icon_to_home+ // title/summary and the Apps list settings screen. SettingsSwitchRow(- title = "Add apps to Home screen",- supportingText = "Newly installed apps are added to the home screen",+ title = "Add app icons to Home screen",+ supportingText = "For new apps", checked = state.addAppsToHome, onCheckedChange = actions::setAddAppsToHome, leadingContent = { IconApps() },@@ -133,7 +135,7 @@ fun SettingsContent( SettingsDivider() - SettingsSection(title = stringResource(R.string.settings_app_drawer)) {+ SettingsSection(title = "Apps list settings") { SettingsSwitchRow( title = stringResource(R.string.settings_drawer_list_title), supportingText = stringResource(R.string.settings_drawer_list_summary),@@ -142,8 +144,8 @@ fun SettingsContent( leadingContent = { IconList() }, ) SettingsSwitchRow(- title = "Two-line labels",- supportingText = "App names in the drawer may use two lines",+ title = "Show long app names",+ supportingText = "Display long app names on two lines in search results and apps list", checked = state.drawerTwoLineLabels, onCheckedChange = actions::setDrawerTwoLineLabels, )
launcher/src/main/java/com/vayunmathur/launcher/ui/WidgetPickerContent.kt
diff --git a/launcher/src/main/java/com/vayunmathur/launcher/ui/WidgetPickerContent.kt b/launcher/src/main/java/com/vayunmathur/launcher/ui/WidgetPickerContent.ktindex 5de8066698..84a5845334 100644--- a/launcher/src/main/java/com/vayunmathur/launcher/ui/WidgetPickerContent.kt+++ b/launcher/src/main/java/com/vayunmathur/launcher/ui/WidgetPickerContent.kt@@ -22,6 +22,7 @@ import androidx.compose.ui.graphics.ImageBitmap import androidx.compose.ui.layout.ContentScale import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp+import androidx.compose.ui.unit.sp import com.vayunmathur.launcher.platform.LocalIconLoader import com.vayunmathur.launcher.platform.WidgetEntry import com.vayunmathur.launcher.platform.WidgetPickerActions@@ -55,6 +56,13 @@ fun WidgetPickerContent( modifier: Modifier = Modifier, ) { Column(modifier = modifier.fillMaxWidth()) {+ // Launcher3 widget picker title (widget_picker_title_font_size 24sp).+ Text(+ "Widgets",+ fontSize = com.vayunmathur.launcher.domain.Launcher3Geometry.WidgetPickerTitleSizeSp.sp,+ style = MaterialTheme.typography.headlineSmall,+ modifier = Modifier.padding(horizontal = Spacing.lg, vertical = Spacing.sm),+ ) CommonSearchBar( value = state.query, onValueChange = actions::setWidgetQuery,@@ -120,14 +128,21 @@ private fun WidgetRow(widget: WidgetEntry, onClick: () -> Unit) { } } Column(modifier = Modifier.padding(start = Spacing.md)) {- Text(widget.label.ifBlank { widget.provider }, style = MaterialTheme.typography.bodyLarge)+ Text(+ widget.label.ifBlank { widget.provider },+ style = MaterialTheme.typography.bodyLarge,+ fontSize = com.vayunmathur.launcher.domain.Launcher3Geometry.WidgetCellTitleSizeSp.sp,+ lineHeight = 20.sp,+ ) Text( if (widget.description.isBlank()) {- "${widget.spanX} x ${widget.spanY}"+ "${widget.spanX} × ${widget.spanY}" } else {- "${widget.spanX} x ${widget.spanY} - ${widget.description}"+ "${widget.spanX} × ${widget.spanY} · ${widget.description}" }, style = MaterialTheme.typography.bodySmall,+ fontSize = com.vayunmathur.launcher.domain.Launcher3Geometry.WidgetCellDescriptionSizeSp.sp,+ lineHeight = 16.sp, color = MaterialTheme.colorScheme.onSurfaceVariant, ) }
launcher/src/main/java/com/vayunmathur/launcher/ui/WorkspaceGrid.kt
diff --git a/launcher/src/main/java/com/vayunmathur/launcher/ui/WorkspaceGrid.kt b/launcher/src/main/java/com/vayunmathur/launcher/ui/WorkspaceGrid.ktindex 962a454f88..3bf0caf658 100644--- a/launcher/src/main/java/com/vayunmathur/launcher/ui/WorkspaceGrid.kt+++ b/launcher/src/main/java/com/vayunmathur/launcher/ui/WorkspaceGrid.kt@@ -16,9 +16,12 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.draw.alpha import androidx.compose.ui.geometry.Rect import androidx.compose.ui.platform.LocalDensity+import androidx.compose.ui.unit.dp+import androidx.compose.ui.unit.sp import com.vayunmathur.launcher.domain.CellRect import com.vayunmathur.launcher.domain.DropPlan import com.vayunmathur.launcher.domain.GridSpec+import com.vayunmathur.launcher.domain.Launcher3Geometry import com.vayunmathur.launcher.domain.LauncherItemType import com.vayunmathur.launcher.domain.LauncherTuning import com.vayunmathur.launcher.domain.ReorderDwell@@ -167,10 +170,10 @@ internal fun WorkspaceCell( HostedWidget( appWidgetId = widgetId, widthDp = with(density) {- (metrics.cellWidthPx * rect.spanX).toDp().value.toInt()+ metrics.spanWidthPx(rect.spanX).toDp().value.toInt() }, heightDp = with(density) {- (metrics.cellHeightPx * rect.spanY).toDp().value.toInt()+ metrics.spanHeightPx(rect.spanY).toDp().value.toInt() }, createView = widgetView, updateSize = updateWidgetSize,@@ -181,8 +184,8 @@ internal fun WorkspaceCell( // The previewed rect, not the saved one, so each step measures from the // geometry the user is looking at. rect = rect,- cellWidthPx = metrics.cellWidthPx,- cellHeightPx = metrics.cellHeightPx,+ cellWidthPx = metrics.pitchXPx,+ cellHeightPx = metrics.pitchYPx, onStep = onResizeStep, onRelease = onResizeRelease, // Sized to the widget; the frame grows itself past these bounds.@@ -195,6 +198,8 @@ internal fun WorkspaceCell( item = item, scale = state.iconScale, showLabel = state.showLabels,+ iconSize = Launcher3Geometry.iconSizeDp(state.grid.columns).dp,+ labelTextSize = Launcher3Geometry.labelTextSizeSp(state.grid.columns).sp, modifier = Modifier.clickable { onOpenFolder(item.id, bounds) }, ) @@ -202,6 +207,8 @@ internal fun WorkspaceCell( item = item, scale = state.iconScale, showLabel = state.showLabels,+ iconSize = Launcher3Geometry.iconSizeDp(state.grid.columns).dp,+ labelTextSize = Launcher3Geometry.labelTextSizeSp(state.grid.columns).sp, modifier = Modifier.clickable { actions.launchFrom(item, bounds) }, ) }
launcher/src/main/java/com/vayunmathur/launcher/ui/WorkspacePage.kt
diff --git a/launcher/src/main/java/com/vayunmathur/launcher/ui/WorkspacePage.kt b/launcher/src/main/java/com/vayunmathur/launcher/ui/WorkspacePage.ktindex 3141d3c4fa..a137f8206f 100644--- a/launcher/src/main/java/com/vayunmathur/launcher/ui/WorkspacePage.kt+++ b/launcher/src/main/java/com/vayunmathur/launcher/ui/WorkspacePage.kt@@ -55,8 +55,19 @@ internal fun WorkspacePage( val density = LocalDensity.current var metrics by remember { mutableStateOf(CellMetrics.Empty) } var bounds by remember { mutableStateOf(Rect.Zero) }+ var pageHeightPx by remember { mutableStateOf(0) }+ // Launcher3 paddings_5_col: leftover vertical room becomes top/bottom+ // workspace padding in measured buckets, not taller cells alone.+ val emptyDp = with(density) {+ pageHeightPx.toDp().value - state.grid.rows *+ com.vayunmathur.launcher.domain.Launcher3Geometry.minCellHeightDp(state.grid.columns)+ }+ val topPad = com.vayunmathur.launcher.domain.Launcher3Geometry.workspaceTopPaddingDp(emptyDp).dp+ val bottomPad = com.vayunmathur.launcher.domain.Launcher3Geometry.workspaceBottomExtraDp(emptyDp).dp val placed = remember(items) { items.associate { it.id to it.rect } }- val iconSizePx = with(density) { (LauncherIconSize * state.iconScale).toPx() }+ val iconSizePx = with(density) {+ (com.vayunmathur.launcher.domain.Launcher3Geometry.iconSizeDp(state.grid.columns).dp * state.iconScale).toPx()+ } // A resize in progress, previewed exactly as a drag is: the widget's own new rect plus whatever // it shoved aside, held here until the handle is released. Launcher3 commits on release too,@@ -89,11 +100,17 @@ internal fun WorkspacePage( merge = merge, ) + Box(+ modifier = Modifier+ .fillMaxSize()+ .onGloballyPositioned { pageHeightPx = it.size.height },+ ) { CellLayout( spec = state.grid, onMetrics = { metrics = it }, modifier = Modifier .fillMaxSize()+ .padding(top = topPad, bottom = bottomPad) .onGloballyPositioned { bounds = it.boundsInWindow() } .dropTarget( key = "page-$page",@@ -222,4 +239,5 @@ internal fun WorkspacePage( } } }+ } }
launcher/src/main/java/com/vayunmathur/launcher/ui/components/CellLayout.kt
diff --git a/launcher/src/main/java/com/vayunmathur/launcher/ui/components/CellLayout.kt b/launcher/src/main/java/com/vayunmathur/launcher/ui/components/CellLayout.ktindex be79e6c8ac..3ea77c4686 100644--- a/launcher/src/main/java/com/vayunmathur/launcher/ui/components/CellLayout.kt+++ b/launcher/src/main/java/com/vayunmathur/launcher/ui/components/CellLayout.kt@@ -7,6 +7,7 @@ import androidx.compose.ui.layout.Layout import androidx.compose.ui.layout.LookaheadScope import androidx.compose.ui.unit.Constraints import androidx.compose.ui.unit.IntOffset+import androidx.compose.ui.unit.dp import com.vayunmathur.launcher.domain.GridSpec /**@@ -21,12 +22,29 @@ data class CellMetrics( val rows: Int, val cellWidthPx: Int, val cellHeightPx: Int,+ /** Launcher3 edge margin inside the page, and the gutter between cells. */+ val paddingLeftPx: Int = 0,+ val paddingTopPx: Int = 0,+ val gutterXPx: Int = 0,+ val gutterYPx: Int = 0, ) {+ /** Distance between the starts of neighbouring cells. */+ val pitchXPx: Int get() = cellWidthPx + gutterXPx+ val pitchYPx: Int get() = cellHeightPx + gutterYPx++ /** On-screen width of a span, gutters between its cells included. */+ fun spanWidthPx(span: Int): Int =+ if (span <= 0) 0 else cellWidthPx * span + gutterXPx * (span - 1)++ /** On-screen height of a span, gutters between its cells included. */+ fun spanHeightPx(span: Int): Int =+ if (span <= 0) 0 else cellHeightPx * span + gutterYPx * (span - 1)+ /** The cell a point falls in, clamped into the grid. */ fun cellAt(x: Float, y: Float): Pair<Int, Int> { if (cellWidthPx <= 0 || cellHeightPx <= 0) return 0 to 0- val cellX = (x / cellWidthPx).toInt().coerceIn(0, columns - 1)- val cellY = (y / cellHeightPx).toInt().coerceIn(0, rows - 1)+ val cellX = ((x - paddingLeftPx) / pitchXPx).toInt().coerceIn(0, columns - 1)+ val cellY = ((y - paddingTopPx) / pitchYPx).toInt().coerceIn(0, rows - 1) return cellX to cellY } @@ -72,19 +90,42 @@ private fun CellGrid( onMetrics: (CellMetrics) -> Unit, content: @Composable () -> Unit, ) {+ val density = androidx.compose.ui.platform.LocalDensity.current+ val edgePx = with(density) {+ com.vayunmathur.launcher.domain.Launcher3Geometry.WorkspaceEdgeMarginDp.dp.roundToPx()+ }+ val gutterPx = with(density) {+ com.vayunmathur.launcher.domain.Launcher3Geometry.CellBorderSpacingDp.dp.roundToPx()+ } Layout(content = content, modifier = modifier) { measurables, constraints -> val width = constraints.maxWidth val height = constraints.maxHeight- val cellWidth = width / spec.columns- val cellHeight = height / spec.rows- onMetrics(CellMetrics(spec.columns, spec.rows, cellWidth, cellHeight))+ // Launcher3's scalable grid: an edge margin around the page and a+ // fixed border spacing between cells; cells share what is left.+ val usableWidth = (width - 2 * edgePx - gutterPx * (spec.columns - 1)).coerceAtLeast(0)+ val usableHeight = (height - gutterPx * (spec.rows - 1)).coerceAtLeast(0)+ val cellWidth = if (spec.columns > 0) usableWidth / spec.columns else 0+ val cellHeight = if (spec.rows > 0) usableHeight / spec.rows else 0+ onMetrics(+ CellMetrics(+ columns = spec.columns,+ rows = spec.rows,+ cellWidthPx = cellWidth,+ cellHeightPx = cellHeight,+ paddingLeftPx = edgePx,+ paddingTopPx = 0,+ gutterXPx = gutterPx,+ gutterYPx = gutterPx,+ ),+ ) // Leftover pixels from the integer division, handed one at a time to the leading // columns/rows so the last cell still reaches the edge.- val extraColumns = width - cellWidth * spec.columns- val extraRows = height - cellHeight * spec.rows- fun xOf(column: Int) = column * cellWidth + column.coerceAtMost(extraColumns)- fun yOf(row: Int) = row * cellHeight + row.coerceAtMost(extraRows)+ val extraColumns = usableWidth - cellWidth * spec.columns+ val extraRows = usableHeight - cellHeight * spec.rows+ fun xOf(column: Int) =+ edgePx + column * (cellWidth + gutterPx) + column.coerceAtMost(extraColumns)+ fun yOf(row: Int) = row * (cellHeight + gutterPx) + row.coerceAtMost(extraRows) val placements = measurables.map { measurable -> val rect = (measurable.parentData as? CellParentData)?.rect
launcher/src/main/java/com/vayunmathur/launcher/ui/components/DropBar.kt
diff --git a/launcher/src/main/java/com/vayunmathur/launcher/ui/components/DropBar.kt b/launcher/src/main/java/com/vayunmathur/launcher/ui/components/DropBar.ktindex d9bba03690..695364253e 100644--- a/launcher/src/main/java/com/vayunmathur/launcher/ui/components/DropBar.kt+++ b/launcher/src/main/java/com/vayunmathur/launcher/ui/components/DropBar.kt@@ -4,6 +4,7 @@ import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.RowScope import androidx.compose.foundation.layout.fillMaxWidth+import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.runtime.Composable@@ -17,6 +18,7 @@ import androidx.compose.ui.draw.clip import androidx.compose.ui.draw.drawBehind import androidx.compose.ui.geometry.Rect import androidx.compose.ui.unit.dp+import androidx.compose.ui.unit.sp import com.vayunmathur.launcher.domain.DropBarSecondary import com.vayunmathur.launcher.domain.DropBarTargets import com.vayunmathur.library.ui.ExpandVisibility@@ -53,8 +55,17 @@ fun DropBar( } Row(- modifier = Modifier.fillMaxWidth().padding(Spacing.sm),- horizontalArrangement = Arrangement.spacedBy(Spacing.sm),+ modifier = Modifier+ .fillMaxWidth()+ .padding(+ start = 4.dp,+ end = 4.dp,+ top = com.vayunmathur.launcher.domain.Launcher3Geometry.DropTargetTopMarginDp.dp,+ bottom = com.vayunmathur.launcher.domain.Launcher3Geometry.DropTargetBottomMarginDp.dp,+ ),+ horizontalArrangement = Arrangement.spacedBy(+ com.vayunmathur.launcher.domain.Launcher3Geometry.DropTargetButtonGapDp.dp,+ ), verticalAlignment = Alignment.CenterVertically, ) { DropBarTarget(@@ -108,7 +119,12 @@ private fun RowScope.DropBarTarget( Row( modifier = Modifier .weight(1f)- .clip(RoundedCornerShape(TARGET_CORNER))+ .height(com.vayunmathur.launcher.domain.Launcher3Geometry.DropTargetSizeDp.dp)+ .clip(+ RoundedCornerShape(+ com.vayunmathur.launcher.domain.Launcher3Geometry.DropTargetFrameRadiusDp.dp,+ ),+ ) // Drawn from the finger's position rather than composed from it: reading the position at // composition scope would recompose this bar on every frame of every drag. .drawBehind {@@ -132,16 +148,18 @@ private fun RowScope.DropBarTarget( }, ) .onAppWindowBounds { bounds = it }- .padding(Spacing.md),+ .padding(horizontal = Spacing.md), horizontalArrangement = Arrangement.Center, verticalAlignment = Alignment.CenterVertically, ) { icon()- Text(label, modifier = Modifier.padding(start = Spacing.sm))+ Text(+ label,+ fontSize = com.vayunmathur.launcher.domain.Launcher3Geometry.DropTargetTextSizeSp.sp,+ modifier = Modifier.padding(start = Spacing.sm),+ ) } } -private val TARGET_CORNER = 24.dp- /** Beats the page, the hotseat and a folder icon, so dropping on the bar always wins. */ const val REMOVE_PRIORITY = 100
launcher/src/main/java/com/vayunmathur/launcher/ui/components/LauncherAppIcon.kt
diff --git a/launcher/src/main/java/com/vayunmathur/launcher/ui/components/LauncherAppIcon.kt b/launcher/src/main/java/com/vayunmathur/launcher/ui/components/LauncherAppIcon.ktindex fec34d2644..bbb57ff917 100644--- a/launcher/src/main/java/com/vayunmathur/launcher/ui/components/LauncherAppIcon.kt+++ b/launcher/src/main/java/com/vayunmathur/launcher/ui/components/LauncherAppIcon.kt@@ -30,8 +30,13 @@ import com.vayunmathur.library.ui.Text import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.withContext -/** Nominal icon edge before the user's scale factor. Every cell is sized around this. */-val LauncherIconSize = 48.dp+/**+ * Icon edge at the default 5-column grid before the user's scale factor:+ * GrapheneOS Launcher3's 5-column handheld cell (`iconSize52dp` = 57dp in+ * device_profiles.xml). Other column counts use+ * [com.vayunmathur.launcher.domain.Launcher3Geometry.iconSizeDp].+ */+val LauncherIconSize = 57.dp /** * The dispatcher every icon rasterises on, with its concurrency bounded.@@ -71,6 +76,9 @@ fun LauncherAppIcon( showLabel: Boolean = true, dimmed: Boolean = false, labelMaxLines: Int = 1,+ iconSize: androidx.compose.ui.unit.Dp = LauncherIconSize,+ labelTextSize: androidx.compose.ui.unit.TextUnit = androidx.compose.ui.unit.TextUnit.Unspecified,+ labelTopPadding: androidx.compose.ui.unit.Dp = 4.dp, ) { val loader = LocalIconLoader.current val bitmap by produceState<ImageBitmap?>(initialValue = null, key, loader) {@@ -84,8 +92,10 @@ fun LauncherAppIcon( showLabel = showLabel, dimmed = dimmed, labelMaxLines = labelMaxLines,+ labelTextSize = labelTextSize,+ labelTopPadding = labelTopPadding, ) {- LauncherIconImage(bitmap, label, scale)+ LauncherIconImage(bitmap, label, scale, iconSize) } } @@ -96,16 +106,21 @@ fun LauncherAppIcon( * this would be a second chance for an icon to end up a different size. */ @Composable-internal fun LauncherIconImage(bitmap: ImageBitmap?, label: String, scale: Float) {+internal fun LauncherIconImage(+ bitmap: ImageBitmap?,+ label: String,+ scale: Float,+ iconSize: androidx.compose.ui.unit.Dp = LauncherIconSize,+) { if (bitmap != null) { Image( bitmap = bitmap, contentDescription = label, contentScale = ContentScale.Fit,- modifier = Modifier.size(LauncherIconSize * scale),+ modifier = Modifier.size(iconSize * scale), ) } else {- IconApps(Modifier.size(LauncherIconSize * scale))+ IconApps(Modifier.size(iconSize * scale)) } } @@ -122,12 +137,16 @@ internal fun LauncherIconCell( showLabel: Boolean, dimmed: Boolean, labelMaxLines: Int = 1,+ labelTextSize: androidx.compose.ui.unit.TextUnit = androidx.compose.ui.unit.TextUnit.Unspecified,+ labelTopPadding: androidx.compose.ui.unit.Dp = 4.dp, icon: @Composable () -> Unit, ) { val density = LocalDensity.current Column( modifier = modifier .fillMaxWidth()+ // Launcher3 dynamic_grid_cell_padding_x (8dp) inside every cell.+ .padding(horizontal = 8.dp) .alpha(if (dimmed) DIMMED_ALPHA else 1f), horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.Center,@@ -141,10 +160,12 @@ internal fun LauncherIconCell( // `onSurface` text is illegible over a light one - which is most photographs. style = MaterialTheme.typography.labelSmall.copy(shadow = labelShadow(density)), color = MaterialTheme.colorScheme.onSurface,+ fontSize = labelTextSize, maxLines = labelMaxLines, overflow = TextOverflow.Ellipsis, textAlign = TextAlign.Center,- modifier = Modifier.padding(top = 2.dp, start = 2.dp, end = 2.dp),+ // Icon-to-label gap is the cell spec's iconDrawablePadding.+ modifier = Modifier.padding(top = labelTopPadding, start = 2.dp, end = 2.dp), ) } }
launcher/src/main/java/com/vayunmathur/launcher/ui/components/LauncherItemIcon.kt
diff --git a/launcher/src/main/java/com/vayunmathur/launcher/ui/components/LauncherItemIcon.kt b/launcher/src/main/java/com/vayunmathur/launcher/ui/components/LauncherItemIcon.ktindex f16a2cda6d..eaf1bffa8b 100644--- a/launcher/src/main/java/com/vayunmathur/launcher/ui/components/LauncherItemIcon.kt+++ b/launcher/src/main/java/com/vayunmathur/launcher/ui/components/LauncherItemIcon.kt@@ -38,10 +38,13 @@ fun LauncherItemIcon( modifier: Modifier = Modifier, scale: Float = 1f, showLabel: Boolean = true,+ iconSize: androidx.compose.ui.unit.Dp = LauncherIconSize,+ labelTextSize: androidx.compose.ui.unit.TextUnit = androidx.compose.ui.unit.TextUnit.Unspecified,+ labelTopPadding: androidx.compose.ui.unit.Dp = 4.dp, ) { when (item.type) {- LauncherItemType.FOLDER -> FolderIcon(item, modifier, scale, showLabel)- LauncherItemType.DEEP_SHORTCUT -> ShortcutIcon(item, modifier, scale, showLabel)+ LauncherItemType.FOLDER -> FolderIcon(item, modifier, scale, showLabel, iconSize, labelTextSize, labelTopPadding)+ LauncherItemType.DEEP_SHORTCUT -> ShortcutIcon(item, modifier, scale, showLabel, iconSize, labelTextSize, labelTopPadding) else -> LauncherAppIcon( key = item.key, label = item.label,@@ -49,13 +52,24 @@ fun LauncherItemIcon( scale = scale, showLabel = showLabel, dimmed = item.hidden,+ iconSize = iconSize,+ labelTextSize = labelTextSize,+ labelTopPadding = labelTopPadding, ) } } /** A pinned deep shortcut: the same cell as an app, with artwork from a different source. */ @Composable-private fun ShortcutIcon(item: WorkspaceItem, modifier: Modifier, scale: Float, showLabel: Boolean) {+private fun ShortcutIcon(+ item: WorkspaceItem,+ modifier: Modifier,+ scale: Float,+ showLabel: Boolean,+ iconSize: androidx.compose.ui.unit.Dp = LauncherIconSize,+ labelTextSize: androidx.compose.ui.unit.TextUnit = androidx.compose.ui.unit.TextUnit.Unspecified,+ labelTopPadding: androidx.compose.ui.unit.Dp = 4.dp,+) { val loader = LocalIconLoader.current val key = item.key val bitmap by produceState<ImageBitmap?>(initialValue = null, key, item.shortcutId, loader) {@@ -71,8 +85,10 @@ private fun ShortcutIcon(item: WorkspaceItem, modifier: Modifier, scale: Float, modifier = modifier, showLabel = showLabel, dimmed = item.hidden,+ labelTextSize = labelTextSize,+ labelTopPadding = labelTopPadding, ) {- LauncherIconImage(bitmap, item.label, scale)+ LauncherIconImage(bitmap, item.label, scale, iconSize) } } @@ -87,16 +103,26 @@ private fun ShortcutIcon(item: WorkspaceItem, modifier: Modifier, scale: Float, * and a folder is indistinguishable from four very small apps. */ @Composable-private fun FolderIcon(item: WorkspaceItem, modifier: Modifier, scale: Float, showLabel: Boolean) {+private fun FolderIcon(+ item: WorkspaceItem,+ modifier: Modifier,+ scale: Float,+ showLabel: Boolean,+ iconSize: androidx.compose.ui.unit.Dp = LauncherIconSize,+ labelTextSize: androidx.compose.ui.unit.TextUnit = androidx.compose.ui.unit.TextUnit.Unspecified,+ labelTopPadding: androidx.compose.ui.unit.Dp = 4.dp,+) { LauncherIconCell( label = item.label, modifier = modifier, showLabel = showLabel, dimmed = false,+ labelTextSize = labelTextSize,+ labelTopPadding = labelTopPadding, ) { Box( modifier = Modifier- .size(LauncherIconSize * scale)+ .size(iconSize * scale) .shadow(FOLDER_ELEVATION, CircleShape) .clip(CircleShape) .background(MaterialTheme.colorScheme.surfaceVariant.copy(alpha = FOLDER_ALPHA))@@ -106,7 +132,7 @@ private fun FolderIcon(item: WorkspaceItem, modifier: Modifier, scale: Float, sh ) { val preview = item.children.take(FOLDER_PREVIEW_COUNT) if (preview.isEmpty()) {- IconFolder(Modifier.size(LauncherIconSize * scale * FOLDER_GLYPH_SCALE))+ IconFolder(Modifier.size(iconSize * scale * FOLDER_GLYPH_SCALE)) } else { Column(verticalArrangement = Arrangement.spacedBy(1.dp)) { preview.chunked(2).forEach { row ->@@ -117,6 +143,7 @@ private fun FolderIcon(item: WorkspaceItem, modifier: Modifier, scale: Float, sh label = child.label, scale = scale * FOLDER_CHILD_SCALE, showLabel = false,+ iconSize = iconSize, ) } }
launcher/src/main/java/com/vayunmathur/launcher/ui/components/PageIndicator.kt
diff --git a/launcher/src/main/java/com/vayunmathur/launcher/ui/components/PageIndicator.kt b/launcher/src/main/java/com/vayunmathur/launcher/ui/components/PageIndicator.ktindex 80182cae41..a4af927c00 100644--- a/launcher/src/main/java/com/vayunmathur/launcher/ui/components/PageIndicator.kt+++ b/launcher/src/main/java/com/vayunmathur/launcher/ui/components/PageIndicator.kt@@ -3,26 +3,23 @@ package com.vayunmathur.launcher.ui.components import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height-import androidx.compose.foundation.layout.padding import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.draw.drawBehind-import androidx.compose.ui.geometry.CornerRadius import androidx.compose.ui.geometry.Offset-import androidx.compose.ui.geometry.Size import androidx.compose.ui.unit.dp import com.vayunmathur.library.ui.MaterialTheme-import com.vayunmathur.library.ui.Spacing-import kotlin.math.abs /** * Page dots, with the active one sliding between them. Hidden for a single page, where they only * take up room. *- * [scrollProgress] is the pager's position as a fraction of a page — 1.5 meaning halfway between- * pages one and two — and the active dot follows it continuously, stretching towards the page being- * moved to as Launcher3's does. That is the difference between an indicator that is part of the- * gesture and one that repaints itself after the fact.+ * Geometry is Launcher3's: `page_indicator_dot_size` 6dp dots,+ * `page_indicator_gap_width` 4dp apart, in a `workspace_page_indicator_height`+ * 24dp strip, every dot the same size. [scrollProgress] is the pager's+ * position as a fraction of a page — 1.5 meaning halfway between pages one+ * and two — and the active dot follows it continuously, which is what makes+ * the indicator part of the gesture rather than a repaint after the fact. * * A lambda, and read only inside [drawBehind], for a reason worth stating: the pager's offset * changes every frame of a fling. Read at composition scope it would recompose the whole workspace@@ -40,13 +37,11 @@ fun PageIndicator( Box( modifier = modifier- .padding(vertical = Spacing.sm)- .height(DOT_SELECTED)+ .height(INDICATOR_HEIGHT) .fillMaxWidth() .drawBehind { val dot = DOT.toPx()- val active = DOT_SELECTED.toPx()- val gap = Spacing.sm.toPx()+ val gap = GAP.toPx() val step = dot + gap val row = pageCount * dot + (pageCount - 1) * gap val left = (size.width - row) / 2f@@ -61,30 +56,22 @@ fun PageIndicator( ) } - // Stretched across the gap while a page change is in flight: one rounded bar- // spanning from where it was to where it is going, which is what makes the- // indicator read as being dragged rather than as switching.+ // The active dot travels with the pager between its neighbours;+ // same size as every other dot, only its alpha sets it apart. val progress = scrollProgress().coerceIn(0f, (pageCount - 1).toFloat())- val centre = left + progress * step + dot / 2f- // A triangle over the fraction of a page travelled: nothing at either end, most in- // the middle, where the dot is between two pages and belongs to neither.- val between = progress - progress.toInt()- val width = active + active * STRETCH * (1f - abs(1f - 2f * between))- drawRoundRect(+ drawCircle( color = color,- topLeft = Offset(centre - width / 2f, centreY - active / 2f),- size = Size(width, active),- cornerRadius = CornerRadius(active / 2f),+ radius = dot / 2f,+ center = Offset(left + progress * step + dot / 2f, centreY), alpha = SELECTED_ALPHA, ) }, ) } +/** Launcher3 `page_indicator_dot_size` / `page_indicator_gap_width` / indicator strip height. */ private val DOT = 6.dp-private val DOT_SELECTED = 8.dp+private val GAP = 4.dp+private val INDICATOR_HEIGHT = 24.dp private const val SELECTED_ALPHA = 0.9f private const val UNSELECTED_ALPHA = 0.35f--/** How much longer the active dot gets at the midpoint between two pages. */-private const val STRETCH = 1.2f
launcher/src/test/java/com/vayunmathur/launcher/domain/Launcher3GeometryTest.kt
diff --git a/launcher/src/test/java/com/vayunmathur/launcher/domain/Launcher3GeometryTest.kt b/launcher/src/test/java/com/vayunmathur/launcher/domain/Launcher3GeometryTest.ktnew file mode 100644index 0000000000..f89e2e7f3b--- /dev/null+++ b/launcher/src/test/java/com/vayunmathur/launcher/domain/Launcher3GeometryTest.kt@@ -0,0 +1,98 @@+package com.vayunmathur.launcher.domain++import com.vayunmathur.launcher.ui.components.CellMetrics+import kotlin.test.Test+import kotlin.test.assertEquals+import kotlin.test.assertTrue++/**+ * Pins the GrapheneOS Launcher3 geometry measured from the pulled+ * Launcher3QuickStep 17 APK (device_profiles.xml, handheld spec files,+ * paddings_5_col.xml, dimens). If the stock build changes, these numbers+ * should be re-measured, not adjusted to fit.+ */+class Launcher3GeometryTest {++ @Test+ fun `measured icon sizes for stock phone grids`() {+ assertEquals(66f, Launcher3Geometry.iconSizeDp(4))+ assertEquals(57f, Launcher3Geometry.iconSizeDp(5))+ assertEquals(14f, Launcher3Geometry.labelTextSizeSp(4))+ assertEquals(12f, Launcher3Geometry.labelTextSizeSp(5))+ }++ @Test+ fun `icon size shrinks as columns grow beyond the stock grids`() {+ val sizes = (3..6).map { Launcher3Geometry.iconSizeDp(it) }+ assertEquals(sizes.sortedDescending(), sizes)+ assertTrue(sizes.all { it > 0f })+ }++ @Test+ fun `all apps and folder columns follow the workspace`() {+ assertEquals(4, Launcher3Geometry.allAppsColumns(4))+ assertEquals(5, Launcher3Geometry.allAppsColumns(5))+ assertEquals(3, Launcher3Geometry.folderColumns(4))+ assertEquals(4, Launcher3Geometry.folderColumns(5))+ }++ @Test+ fun `workspace top padding follows the paddings_5_col buckets`() {+ assertEquals(0f, Launcher3Geometry.workspaceTopPaddingDp(0f))+ assertEquals(0f, Launcher3Geometry.workspaceTopPaddingDp(23f))+ assertEquals(8f, Launcher3Geometry.workspaceTopPaddingDp(45f))+ assertEquals(16f, Launcher3Geometry.workspaceTopPaddingDp(64f))+ assertEquals(36f, Launcher3Geometry.workspaceTopPaddingDp(115f))+ assertEquals(48f, Launcher3Geometry.workspaceTopPaddingDp(139f))+ assertEquals(60f, Launcher3Geometry.workspaceTopPaddingDp(155f))+ assertEquals(72f, Launcher3Geometry.workspaceTopPaddingDp(400f))+ }++ @Test+ fun `workspace bottom extra stays zero for the first buckets`() {+ assertEquals(0f, Launcher3Geometry.workspaceBottomExtraDp(45f))+ assertEquals(16f, Launcher3Geometry.workspaceBottomExtraDp(64f))+ assertEquals(72f, Launcher3Geometry.workspaceBottomExtraDp(400f))+ }++ @Test+ fun `workspace scale behind the drawer is the stock dimen`() {+ assertEquals(0.97f, Launcher3Geometry.WorkspaceContentScale)+ assertEquals(+ Launcher3Geometry.WorkspaceContentScale,+ LauncherTuning.WorkspaceScaleBehindDrawer,+ )+ }+}++class CellMetricsGeometryTest {++ private val metrics = CellMetrics(+ columns = 5,+ rows = 5,+ cellWidthPx = 60,+ cellHeightPx = 100,+ paddingLeftPx = 30,+ paddingTopPx = 0,+ gutterXPx = 45,+ gutterYPx = 45,+ )++ @Test+ fun `pitch and spans include the gutters`() {+ assertEquals(105, metrics.pitchXPx)+ assertEquals(145, metrics.pitchYPx)+ assertEquals(60, metrics.spanWidthPx(1))+ assertEquals(165, metrics.spanWidthPx(2))+ assertEquals(245, metrics.spanHeightPx(2))+ }++ @Test+ fun `cellAt accounts for the edge margin`() {+ assertEquals(0 to 0, metrics.cellAt(30f, 0f))+ assertEquals(0 to 0, metrics.cellAt(89f, 99f))+ assertEquals(1 to 1, metrics.cellAt(135f, 145f))+ assertEquals(4 to 4, metrics.cellAt(10_000f, 10_000f))+ assertEquals(0 to 0, metrics.cellAt(-50f, -50f))+ }+}
launcher/src/test/java/com/vayunmathur/launcher/ui/LauncherSettingsUiTest.kt
diff --git a/launcher/src/test/java/com/vayunmathur/launcher/ui/LauncherSettingsUiTest.kt b/launcher/src/test/java/com/vayunmathur/launcher/ui/LauncherSettingsUiTest.ktindex b4d284b3a4..4fe2735212 100644--- a/launcher/src/test/java/com/vayunmathur/launcher/ui/LauncherSettingsUiTest.kt+++ b/launcher/src/test/java/com/vayunmathur/launcher/ui/LauncherSettingsUiTest.kt@@ -40,7 +40,7 @@ class LauncherSettingsUiTest { @Test fun topRowsRender() { show()- rule.onNodeWithText("Home screen").assertIsDisplayed()+ rule.onNodeWithText("Home settings").assertIsDisplayed() rule.onNodeWithText("Wallpaper").assertIsDisplayed() rule.onNodeWithText("Widgets").assertIsDisplayed() rule.onNodeWithText("Grid").assertIsDisplayed()@@ -109,8 +109,8 @@ class LauncherSettingsUiTest { @Test fun drawerListSectionRendersAfterScroll() { show()- rule.onNodeWithText("App drawer").performScrollTo()- rule.onNodeWithText("App drawer").assertIsDisplayed()+ rule.onNodeWithText("Apps list settings").performScrollTo()+ rule.onNodeWithText("Apps list settings").assertIsDisplayed() } @Test fun wallpaperRowClickReachesActions() {
launcher/src/test/java/com/vayunmathur/launcher/ui/LauncherWidgetPickerUiTest.kt
diff --git a/launcher/src/test/java/com/vayunmathur/launcher/ui/LauncherWidgetPickerUiTest.kt b/launcher/src/test/java/com/vayunmathur/launcher/ui/LauncherWidgetPickerUiTest.ktindex 3e1f18899a..7f61e0188f 100644--- a/launcher/src/test/java/com/vayunmathur/launcher/ui/LauncherWidgetPickerUiTest.kt+++ b/launcher/src/test/java/com/vayunmathur/launcher/ui/LauncherWidgetPickerUiTest.kt@@ -61,8 +61,8 @@ class LauncherWidgetPickerUiTest { show() rule.onNodeWithText("Clock").assertIsDisplayed() rule.onNodeWithText("Analog clock").assertIsDisplayed()- rule.onNodeWithText("2 x 2").assertIsDisplayed()- rule.onNodeWithText("4 x 1 - Time").assertIsDisplayed()+ rule.onNodeWithText("2 × 2").assertIsDisplayed()+ rule.onNodeWithText("4 × 1 · Time").assertIsDisplayed() } @Test fun blankLabelFallsBackToProvider() {