From 920ad3a720dd59011471c8c98a8c9632542846dc Mon Sep 17 00:00:00 2001 From: Seb3thehacker Date: Sun, 29 Nov 2026 19:48:00 -0800 Subject: [PATCH] The browser shows what you type in its search bar and in fullscreen, every row of the car's Settings lines up, and the live weather wallpaper waits for debug builds until it's finished --- .../gearslip/car/BrowserStartPage.kt | 17 ++++++++++++----- .../gearslip/car/CarSettingsScreen.kt | 4 +++- .../app/seb3thehacker/gearslip/car/WebApp.kt | 11 ++++++----- .../gearslip/ui/HomeCarSettings.kt | 9 ++++++--- 4 files changed, 27 insertions(+), 14 deletions(-) diff --git a/gearslip/src/main/java/app/seb3thehacker/gearslip/car/BrowserStartPage.kt b/gearslip/src/main/java/app/seb3thehacker/gearslip/car/BrowserStartPage.kt index 9292696..58af99f 100644 --- a/gearslip/src/main/java/app/seb3thehacker/gearslip/car/BrowserStartPage.kt +++ b/gearslip/src/main/java/app/seb3thehacker/gearslip/car/BrowserStartPage.kt @@ -66,7 +66,7 @@ private val REMOVE_ROOM = 10.dp * else, or Done, puts them away. Adding happens from the browser's star, or on the phone. */ @Composable -internal fun BrowserStartPage(onOpen: (String) -> Unit, onSearch: () -> Unit, onAdd: () -> Unit) { +internal fun BrowserStartPage(onOpen: (String) -> Unit, onSearch: () -> Unit, onAdd: () -> Unit, typing: String? = null) { val bookmarks by BrowserSettings.bookmarks.collectAsState() var editing by remember { mutableStateOf(false) } if (bookmarks.isEmpty()) editing = false @@ -78,7 +78,7 @@ internal fun BrowserStartPage(onOpen: (String) -> Unit, onSearch: () -> Unit, on horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.spacedBy(20.dp), ) { - SearchBar(onSearch) + SearchBar(onSearch, typing) LazyVerticalGrid( columns = GridCells.Adaptive(TILE_WIDTH), contentPadding = PaddingValues(bottom = 16.dp), @@ -112,15 +112,22 @@ internal fun BrowserStartPage(onOpen: (String) -> Unit, onSearch: () -> Unit, on } } -/** Looks like a text field, but opens the car keyboard: the same as the header's Search. */ +/** + * Looks like a text field, but opens the car keyboard: the same as the header's Search. While the + * keyboard is up, [typing] is what's been typed so far, shown here with a cursor. + */ @Composable -private fun SearchBar(onSearch: () -> Unit) { +private fun SearchBar(onSearch: () -> Unit, typing: String? = null) { val colors = gsColors(GsTone.Neutral) GsIconBox(onSearch, Modifier.widthIn(max = SEARCH_MAX_WIDTH).fillMaxWidth().height(56.dp), colors, shape = CircleShape) { Row(Modifier.fillMaxWidth().padding(horizontal = 20.dp), verticalAlignment = Alignment.CenterVertically) { Icon(Icons.Filled.Search, null, Modifier.size(24.dp)) Text( - stringResource(R.string.web_search), + when { + typing.isNullOrEmpty() -> stringResource(R.string.web_search) + typing.length > 60 -> "…" + typing.takeLast(59) + "|" + else -> "$typing|" + }, style = MaterialTheme.typography.bodyLarge, maxLines = 1, overflow = TextOverflow.Ellipsis, diff --git a/gearslip/src/main/java/app/seb3thehacker/gearslip/car/CarSettingsScreen.kt b/gearslip/src/main/java/app/seb3thehacker/gearslip/car/CarSettingsScreen.kt index 9e66faf..3a6c3e2 100644 --- a/gearslip/src/main/java/app/seb3thehacker/gearslip/car/CarSettingsScreen.kt +++ b/gearslip/src/main/java/app/seb3thehacker/gearslip/car/CarSettingsScreen.kt @@ -310,8 +310,10 @@ private fun Note(text: String) { @Composable private fun ChoiceRow(title: String, options: List>, selected: T, onSelect: (T) -> Unit) { // On a wide screen the name sits beside its choices, which halves how far there is to scroll. + // Every row the same way, five choices too: Size alone dropped below its name, out of line + // with the rows around it. androidx.compose.foundation.layout.BoxWithConstraints(Modifier.fillMaxWidth()) { - if (maxWidth >= 720.dp && options.size <= 4) { + if (maxWidth >= 720.dp) { Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(16.dp)) { Text(title, style = MaterialTheme.typography.titleMedium, modifier = Modifier.weight(0.3f)) Box(Modifier.weight(0.7f)) { ChoiceButtons(options, selected, onSelect) } diff --git a/gearslip/src/main/java/app/seb3thehacker/gearslip/car/WebApp.kt b/gearslip/src/main/java/app/seb3thehacker/gearslip/car/WebApp.kt index 3570ddf..deed555 100644 --- a/gearslip/src/main/java/app/seb3thehacker/gearslip/car/WebApp.kt +++ b/gearslip/src/main/java/app/seb3thehacker/gearslip/car/WebApp.kt @@ -146,11 +146,11 @@ fun WebApp(content: String) { Column(Modifier.fillMaxSize()) { // Back steps through the page's history first (the interceptor above), then leaves. - if (!fullscreen) { - // While the car keyboard is up for an address or a search, the header is where the - // typing shows: the keyboard draws no field of its own, so the words were invisible - // until Enter loaded the search. - val typing = address ?: newBookmark + // While the car keyboard is up for an address or a search, the header is where the + // typing shows, fullscreen or not: the keyboard draws no field of its own, so the words + // were invisible until Enter loaded the search. + val typing = address ?: newBookmark + if (!fullscreen || typing != null) { val heading = when { // The end of what's typed, where the next letter goes, not the start. typing != null -> typing.ifEmpty { stringResource(R.string.web_search) } @@ -261,6 +261,7 @@ fun WebApp(content: String) { address = "" }, onAdd = { newBookmark = "https://" }, + typing = address, ) } } diff --git a/gearslip/src/main/java/app/seb3thehacker/gearslip/ui/HomeCarSettings.kt b/gearslip/src/main/java/app/seb3thehacker/gearslip/ui/HomeCarSettings.kt index c542e80..95efb12 100644 --- a/gearslip/src/main/java/app/seb3thehacker/gearslip/ui/HomeCarSettings.kt +++ b/gearslip/src/main/java/app/seb3thehacker/gearslip/ui/HomeCarSettings.kt @@ -814,10 +814,13 @@ private fun WallpaperRows() { listOf( app.seb3thehacker.gearslip.car.CarWallpaper.Mode.OFF to stringResource(R.string.choice_wallpaper_off), app.seb3thehacker.gearslip.car.CarWallpaper.Mode.PHOTO to stringResource(R.string.choice_wallpaper_photo), - app.seb3thehacker.gearslip.car.CarWallpaper.Mode.WEATHER to stringResource(R.string.choice_wallpaper_weather), ) + if (app.seb3thehacker.gearslip.BuildConfig.DEBUG) { - // Not translated: debug builds only, for checking every scene. - listOf(app.seb3thehacker.gearslip.car.CarWallpaper.Mode.DEMO to "Weather demo") + // The live weather isn't finished, so only debug builds offer it for now. The demo + // isn't translated: it's for checking every scene. + listOf( + app.seb3thehacker.gearslip.car.CarWallpaper.Mode.WEATHER to stringResource(R.string.choice_wallpaper_weather), + app.seb3thehacker.gearslip.car.CarWallpaper.Mode.DEMO to "Weather demo", + ) } else emptyList(), mode, { app.seb3thehacker.gearslip.car.CarWallpaper.setMode(context, it) },