Modern Apps git

← Modern-Apps.git

weather: significant UI overhaul

Commit
a49e7bee72c9ab12353fb9b71cae7c321013e996
Author
Vayun Mathur <[email protected]>
When
2026-05-30 15:08 UTC (6 months ago)
Parents
eb627c2

Diff

gradle/libs.versions.toml
diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.tomlindex 4d0f2ea9d3..96a30acb33 100644--- a/gradle/libs.versions.toml+++ b/gradle/libs.versions.toml@@ -58,6 +58,9 @@ material3AdaptiveNavigationSuite = "1.4.0" maplibre = "0.13.0" foundation = "1.11.2" materialkolor = "4.1.1"+protobuf = "4.28.3"+protobufPlugin = "0.9.4"+zxing = "3.5.3"  [libraries] # AndroidX Core & Lifecycle@@ -157,6 +160,9 @@ sqlcipher-android = { module = "net.zetetic:sqlcipher-android", version.ref = "s symbol-processing-gradle-plugin = { module = "com.google.devtools.ksp:symbol-processing-gradle-plugin", version.ref = "ksp" } androidx-compose-foundation = { group = "androidx.compose.foundation", name = "foundation", version.ref = "foundation" } materialkolor = { module = "com.materialkolor:material-kolor", version.ref = "materialkolor" }+protobuf-java = { module = "com.google.protobuf:protobuf-java", version.ref = "protobuf" }+protobuf-protoc = { module = "com.google.protobuf:protoc", version.ref = "protobuf" }+zxing-core = { module = "com.google.zxing:core", version.ref = "zxing" }  [plugins] android-application = { id = "com.android.application", version.ref = "agp" }@@ -164,4 +170,5 @@ android-library = { id = "com.android.library", version.ref = "agp" } kotlin-compose = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" } kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" } ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" }-dependency-analysis = { id="com.autonomousapps.dependency-analysis", version.ref = "comAutonomousappsDependencyAnalysisGradlePlugin" }\ No newline at end of file+dependency-analysis = { id="com.autonomousapps.dependency-analysis", version.ref = "comAutonomousappsDependencyAnalysisGradlePlugin" }+protobuf = { id = "com.google.protobuf", version.ref = "protobufPlugin" }\ No newline at end of file
weather/build.gradle.kts
diff --git a/weather/build.gradle.kts b/weather/build.gradle.ktsindex 2333939afe..0df89e7979 100644--- a/weather/build.gradle.kts+++ b/weather/build.gradle.kts@@ -12,7 +12,5 @@ android { dependencies {     implementation(project(":library:network"))     implementation(libs.androidx.datastore.preferences)-    implementation(libs.materialkolor)-    implementation(libs.reorderable)     implementRoom(libs) }
weather/src/main/java/com/vayunmathur/weather/MainActivity.kt
diff --git a/weather/src/main/java/com/vayunmathur/weather/MainActivity.kt b/weather/src/main/java/com/vayunmathur/weather/MainActivity.ktindex 5d56ae978b..800533d0f9 100644--- a/weather/src/main/java/com/vayunmathur/weather/MainActivity.kt+++ b/weather/src/main/java/com/vayunmathur/weather/MainActivity.kt@@ -6,6 +6,8 @@ import androidx.activity.compose.setContent import androidx.activity.enableEdgeToEdge import androidx.activity.viewModels import androidx.compose.runtime.Composable+import com.vayunmathur.library.ui.DynamicTheme+import com.vayunmathur.library.util.DialogPage import com.vayunmathur.library.util.ListDetailPage import com.vayunmathur.library.util.ListPage import com.vayunmathur.library.util.MainNavigation@@ -13,11 +15,9 @@ import com.vayunmathur.library.util.NavKey import com.vayunmathur.library.util.buildDatabase import com.vayunmathur.library.util.rememberNavBackStack import com.vayunmathur.weather.data.WeatherDatabase-import com.vayunmathur.weather.ui.AddLocationPage import com.vayunmathur.weather.ui.HomePage-import com.vayunmathur.weather.ui.LocationListPage+import com.vayunmathur.weather.ui.SearchLocationPage import com.vayunmathur.weather.ui.SettingsPage-import com.vayunmathur.weather.ui.WeatherTheme import com.vayunmathur.weather.util.WeatherViewModel import com.vayunmathur.weather.util.WeatherViewModelFactory import kotlinx.serialization.Serializable@@ -32,7 +32,7 @@ class MainActivity : ComponentActivity() {         super.onCreate(savedInstanceState)         enableEdgeToEdge()         setContent {-            WeatherTheme {+            DynamicTheme {                 Navigation(viewModel)             }         }@@ -42,8 +42,7 @@ class MainActivity : ComponentActivity() { @Serializable sealed interface Route : NavKey {     @Serializable data object Home : Route-    @Serializable data object Locations : Route-    @Serializable data object AddLocation : Route+    @Serializable data object SearchLocation : Route     @Serializable data object Settings : Route } @@ -52,8 +51,7 @@ fun Navigation(viewModel: WeatherViewModel) {     val backStack = rememberNavBackStack<Route>(Route.Home)     MainNavigation(backStack) {         entry<Route.Home>(metadata = ListPage()) { HomePage(backStack, viewModel) }-        entry<Route.Locations>(metadata = ListPage()) { LocationListPage(backStack, viewModel) }-        entry<Route.AddLocation>(metadata = ListDetailPage()) { AddLocationPage(backStack, viewModel) }+        entry<Route.SearchLocation>(metadata = DialogPage()) { SearchLocationPage(backStack, viewModel) }         entry<Route.Settings>(metadata = ListDetailPage()) { SettingsPage(backStack, viewModel) }     } }
weather/src/main/java/com/vayunmathur/weather/ui/AddLocationPage.kt
diff --git a/weather/src/main/java/com/vayunmathur/weather/ui/AddLocationPage.kt b/weather/src/main/java/com/vayunmathur/weather/ui/AddLocationPage.ktdeleted file mode 100644index 707d47517d..0000000000--- a/weather/src/main/java/com/vayunmathur/weather/ui/AddLocationPage.kt+++ /dev/null@@ -1,187 +0,0 @@-package com.vayunmathur.weather.ui--import android.Manifest-import android.widget.Toast-import androidx.activity.compose.rememberLauncherForActivityResult-import androidx.activity.result.contract.ActivityResultContracts-import androidx.compose.foundation.clickable-import androidx.compose.foundation.layout.Arrangement-import androidx.compose.foundation.layout.Box-import androidx.compose.foundation.layout.Column-import androidx.compose.foundation.layout.PaddingValues-import androidx.compose.foundation.layout.Spacer-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.lazy.LazyColumn-import androidx.compose.foundation.lazy.items-import androidx.compose.material3.Button-import androidx.compose.material3.CircularProgressIndicator-import androidx.compose.material3.ExperimentalMaterial3Api-import androidx.compose.material3.HorizontalDivider-import androidx.compose.material3.ListItem-import androidx.compose.material3.MaterialTheme-import androidx.compose.material3.Scaffold-import androidx.compose.material3.Text-import androidx.compose.material3.TopAppBar-import androidx.compose.runtime.LaunchedEffect-import androidx.compose.runtime.Composable-import androidx.compose.runtime.getValue-import androidx.compose.runtime.mutableStateOf-import androidx.compose.runtime.remember-import androidx.compose.runtime.setValue-import androidx.compose.runtime.rememberCoroutineScope-import androidx.compose.runtime.snapshotFlow-import androidx.compose.ui.Alignment-import androidx.compose.ui.Modifier-import androidx.compose.ui.platform.LocalContext-import androidx.compose.ui.unit.dp-import com.vayunmathur.library.ui.CommonSearchBar-import com.vayunmathur.library.ui.IconNavigation-import com.vayunmathur.library.util.NavBackStack-import com.vayunmathur.weather.Route-import com.vayunmathur.weather.network.GeocodingResult-import com.vayunmathur.weather.network.WeatherApi-import com.vayunmathur.weather.util.LocationProvider-import com.vayunmathur.weather.util.WeatherViewModel-import kotlinx.coroutines.delay-import kotlinx.coroutines.flow.debounce-import kotlinx.coroutines.flow.distinctUntilChanged-import kotlinx.coroutines.flow.flatMapLatest-import kotlinx.coroutines.flow.flow-import kotlinx.coroutines.launch--/** Search by city name OR pull from the device's current location. */-@OptIn(ExperimentalMaterial3Api::class, kotlinx.coroutines.ExperimentalCoroutinesApi::class,-    kotlinx.coroutines.FlowPreview::class)-@Composable-fun AddLocationPage(backStack: NavBackStack<Route>, viewModel: WeatherViewModel) {-    val context = LocalContext.current-    val scope = rememberCoroutineScope()--    var query by remember { mutableStateOf("") }-    var results by remember { mutableStateOf<List<GeocodingResult>>(emptyList()) }-    var searching by remember { mutableStateOf(false) }--    LaunchedEffect(Unit) {-        snapshotFlow { query }-            .debounce(300)-            .distinctUntilChanged()-            .flatMapLatest { q ->-                flow {-                    if (q.isBlank()) {-                        emit(emptyList<GeocodingResult>())-                    } else {-                        searching = true-                        val res = runCatching { WeatherApi.geocode(q).results }.getOrDefault(emptyList())-                        searching = false-                        emit(res)-                    }-                }-            }-            .collect { results = it }-    }--    val permissionLauncher = rememberLauncherForActivityResult(-        ActivityResultContracts.RequestMultiplePermissions()-    ) { granted ->-        if (granted.values.any { it }) {-            scope.launch { useCurrentLocation(context, viewModel, backStack) }-        } else {-            Toast.makeText(context, "Location permission denied", Toast.LENGTH_SHORT).show()-        }-    }--    Scaffold(-        topBar = {-            TopAppBar(-                title = { Text("Add location") },-                navigationIcon = { IconNavigation(backStack) },-            )-        },-    ) { padding ->-        Column(modifier = Modifier.fillMaxSize().padding(padding)) {-            Button(-                onClick = {-                    if (LocationProvider.hasPermission(context)) {-                        scope.launch { useCurrentLocation(context, viewModel, backStack) }-                    } else {-                        permissionLauncher.launch(-                            arrayOf(-                                Manifest.permission.ACCESS_FINE_LOCATION,-                                Manifest.permission.ACCESS_COARSE_LOCATION,-                            )-                        )-                    }-                },-                modifier = Modifier.fillMaxWidth().padding(16.dp),-            ) { Text("Use current location") }--            HorizontalDivider()--            CommonSearchBar(-                value = query,-                onValueChange = { query = it },-                placeholder = "Search city",-            )--            Box(modifier = Modifier.fillMaxSize()) {-                if (searching && results.isEmpty()) {-                    CircularProgressIndicator(modifier = Modifier.align(Alignment.Center))-                } else if (query.isNotBlank() && results.isEmpty()) {-                    Text(-                        "No matches",-                        color = MaterialTheme.colorScheme.onSurfaceVariant,-                        modifier = Modifier.align(Alignment.Center),-                    )-                } else {-                    LazyColumn(modifier = Modifier.fillMaxSize()) {-                        items(results, key = { it.id }) { r ->-                            ListItem(-                                headlineContent = { Text(r.name) },-                                supportingContent = {-                                    val parts = listOfNotNull(r.admin1, r.country).filter { it.isNotBlank() }-                                    if (parts.isNotEmpty()) Text(parts.joinToString(", "))-                                },-                                modifier = Modifier.clickable {-                                    viewModel.addLocation(-                                        name = r.name,-                                        country = r.country.orEmpty(),-                                        latitude = r.latitude,-                                        longitude = r.longitude,-                                    )-                                    backStack.pop()-                                },-                            )-                        }-                    }-                }-            }-        }-    }-}--private suspend fun useCurrentLocation(-    context: android.content.Context,-    viewModel: WeatherViewModel,-    backStack: NavBackStack<Route>,-) {-    val loc = LocationProvider.currentLocation(context)-    if (loc == null) {-        Toast.makeText(context, "Couldn't determine location", Toast.LENGTH_SHORT).show()-        return-    }-    // Best-effort name via reverse geocoding via Open-Meteo (matches the nearest place).-    val name = runCatching {-        WeatherApi.geocode(-            // Approximate reverse: search for the lat,lon string isn't supported by /search.-            // Just use a placeholder; the user can rename later. We'll fill from any nearby-            // result if the user has typed something previously — but for "use current-            // location" the simplest UX is a fixed label.-            query = "",-        ).results.firstOrNull()?.name-    }.getOrNull() ?: "Current location"-    viewModel.setCurrentLocation(name = name, latitude = loc.latitude, longitude = loc.longitude)-    backStack.pop()-}
weather/src/main/java/com/vayunmathur/weather/ui/HomePage.kt
diff --git a/weather/src/main/java/com/vayunmathur/weather/ui/HomePage.kt b/weather/src/main/java/com/vayunmathur/weather/ui/HomePage.ktindex ffec520342..53f33f7bce 100644--- a/weather/src/main/java/com/vayunmathur/weather/ui/HomePage.kt+++ b/weather/src/main/java/com/vayunmathur/weather/ui/HomePage.kt@@ -1,59 +1,65 @@ package com.vayunmathur.weather.ui +import androidx.activity.compose.BackHandler import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column-import androidx.compose.foundation.layout.PaddingValues-import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.fillMaxSize-import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding-import androidx.compose.foundation.layout.size-import androidx.compose.foundation.lazy.LazyColumn-import androidx.compose.foundation.pager.HorizontalPager-import androidx.compose.foundation.pager.rememberPagerState-import androidx.compose.foundation.shape.CircleShape+import androidx.compose.foundation.rememberScrollState+import androidx.compose.foundation.verticalScroll import androidx.compose.material3.Button import androidx.compose.material3.CircularProgressIndicator+import androidx.compose.material3.DrawerValue import androidx.compose.material3.ExperimentalMaterial3Api-import androidx.compose.material3.IconButton import androidx.compose.material3.MaterialTheme+import androidx.compose.material3.ModalDrawerSheet+import androidx.compose.material3.ModalNavigationDrawer import androidx.compose.material3.Scaffold-import androidx.compose.material3.Surface import androidx.compose.material3.Text import androidx.compose.material3.TopAppBar+import androidx.compose.material3.rememberDrawerState import androidx.compose.runtime.Composable+import androidx.compose.runtime.CompositionLocalProvider import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.collectAsState import androidx.compose.runtime.getValue+import androidx.compose.runtime.rememberCoroutineScope+import androidx.compose.runtime.mutableStateOf+import androidx.compose.runtime.remember+import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier-import androidx.compose.ui.draw.clip-import androidx.compose.ui.text.font.FontWeight+import androidx.compose.ui.graphics.Color+import androidx.compose.ui.platform.LocalLayoutDirection+import androidx.compose.ui.res.painterResource+import androidx.compose.ui.unit.LayoutDirection import androidx.compose.ui.unit.dp-import com.vayunmathur.library.ui.IconAdd-import com.vayunmathur.library.ui.IconSettings+import com.vayunmathur.library.R as LibraryR import com.vayunmathur.library.util.NavBackStack import com.vayunmathur.weather.Route import com.vayunmathur.weather.data.SavedLocation-import com.vayunmathur.weather.ui.components.CurrentHero-import com.vayunmathur.weather.ui.components.DailyList-import com.vayunmathur.weather.ui.components.HourlyStrip-import com.vayunmathur.weather.ui.components.PrecipChart-import com.vayunmathur.weather.ui.components.SunriseSunsetCard-import com.vayunmathur.weather.ui.components.WeatherBlocksGrid+import com.vayunmathur.weather.ui.components.CreditsBottomSection+import com.vayunmathur.weather.ui.components.CurrentWeatherCard+import com.vayunmathur.weather.ui.components.DailyCard+import com.vayunmathur.weather.ui.components.HourlyCard+import com.vayunmathur.weather.ui.components.MainSearchBar+import com.vayunmathur.weather.ui.components.SummaryCard+import com.vayunmathur.weather.ui.components.WeatherBlocks import com.vayunmathur.weather.util.WeatherViewModel+import kotlinx.coroutines.launch import kotlin.time.Instant  /**- * Pixel-Weather-inspired home page rendered against the standard Material- * surface (no condition tinting). Layout follows the Health app's rhythm:- *   - Top app bar with the location name centered- *   - Hero block (no card) with the current temp + condition + Hi/Lo pill- *   - A stack of sectioned cards: HOURLY → DETAILS → PRECIPITATION → SUN → 7-DAY+ * Port of WeatherMaster's `MainScreen` + `MainScreenScaffold`:  *- * Horizontal pager swipes between saved locations; small dot indicators in- * the top app bar show which page you're on.+ * - Wraps the main content in a `DismissibleNavigationDrawer` whose+ *   `drawerContent` is [LocationsScreen].+ * - The drawer is opened by the hamburger in [MainSearchBar].+ * - Below the search bar, the vertical scroll renders, in order:+ *   `CurrentWeatherCard` → `SummaryCard` → `HourlyCard` → `DailyCard` →+ *   `WeatherBlocks` → `CreditsBottomSection`. 16 dp horizontal padding,+ *   24 dp top, 14 dp spacing between cards.  */ @OptIn(ExperimentalMaterial3Api::class) @Composable@@ -61,69 +67,67 @@ fun HomePage(backStack: NavBackStack<Route>, viewModel: WeatherViewModel) {     val locations by viewModel.savedLocations.collectAsState()      if (locations.isEmpty()) {-        EmptyHome(onAddLocation = { backStack.add(Route.AddLocation) })+        EmptyHome(+            viewModel = viewModel,+            onAddLocation = { backStack.add(Route.SearchLocation) },+        )         return     } -    val pagerState = rememberPagerState(initialPage = 0) { locations.size }-    val current = locations.getOrNull(pagerState.currentPage)--    Scaffold(-        topBar = {-            TopAppBar(-                title = {-                    Column(horizontalAlignment = Alignment.CenterHorizontally) {-                        Text(-                            text = current?.name.orEmpty(),-                            style = MaterialTheme.typography.titleLarge,-                            fontWeight = FontWeight.SemiBold,-                        )-                        if (locations.size > 1) {-                            Row(-                                horizontalArrangement = Arrangement.spacedBy(6.dp),-                                verticalAlignment = Alignment.CenterVertically,-                                modifier = Modifier.padding(top = 4.dp),-                            ) {-                                LocationDots(locations.size, pagerState.currentPage)-                            }-                        }-                    }-                },-                actions = {-                    IconButton(onClick = { backStack.add(Route.Locations) }) { IconAdd() }-                    IconButton(onClick = { backStack.add(Route.Settings) }) { IconSettings() }-                },-            )-        },-    ) { padding ->-        HorizontalPager(-            state = pagerState,-            modifier = Modifier.fillMaxSize().padding(padding),-        ) { pageIndex ->-            LocationPage(viewModel = viewModel, location = locations[pageIndex])-        }-    }-}+    // Track which location is "active" — we don't have a flag on the+    // entity itself, so default to the first row and let the user pick+    // others from the drawer.+    var activeLocationId by remember { mutableStateOf(locations.first().id) }+    val activeLocation = locations.firstOrNull { it.id == activeLocationId } ?: locations.first() -@Composable-private fun LocationDots(count: Int, selectedIndex: Int) {-    Row(horizontalArrangement = Arrangement.spacedBy(6.dp)) {-        repeat(count) { i ->-            val selected = i == selectedIndex-            Surface(-                modifier = Modifier-                    .size(if (selected) 7.dp else 5.dp)-                    .clip(CircleShape),-                color = if (selected) MaterialTheme.colorScheme.onSurface-                else MaterialTheme.colorScheme.outlineVariant,-                content = {},+    val drawerState = rememberDrawerState(DrawerValue.Closed)+    val scope = rememberCoroutineScope()+    val closeDrawer = { scope.launch { drawerState.close() } }++    BackHandler(enabled = drawerState.isOpen) { closeDrawer() }++    ModalNavigationDrawer(+        drawerState = drawerState,+        drawerContent = {+            ModalDrawerSheet(+                drawerContainerColor = MaterialTheme.colorScheme.surfaceContainer,+            ) {+                LocationsScreen(+                    backStack = backStack,+                    viewModel = viewModel,+                    activeLocation = activeLocation,+                    onLocationSelect = { picked ->+                        activeLocationId = picked.id+                        closeDrawer()+                    },+                    onClose = { closeDrawer() },+                )+            }+        },+    ) {+        Scaffold(+            containerColor = MaterialTheme.colorScheme.surfaceContainerHigh,+        ) { paddingValues ->+            LocationPage(+                backStack = backStack,+                viewModel = viewModel,+                location = activeLocation,+                drawerState = drawerState,+                paddingValues = paddingValues,             )         }     } } +@OptIn(ExperimentalMaterial3Api::class) @Composable-private fun LocationPage(viewModel: WeatherViewModel, location: SavedLocation) {+private fun LocationPage(+    backStack: NavBackStack<Route>,+    viewModel: WeatherViewModel,+    location: SavedLocation,+    drawerState: androidx.compose.material3.DrawerState,+    paddingValues: androidx.compose.foundation.layout.PaddingValues,+) {     val forecasts by viewModel.forecasts.collectAsState()     val tempUnit by viewModel.tempUnit.collectAsState()     val windUnit by viewModel.windUnit.collectAsState()@@ -132,37 +136,48 @@ private fun LocationPage(viewModel: WeatherViewModel, location: SavedLocation) {      val state = forecasts[location.id]     val forecast = state?.forecast+    val scrollState = rememberScrollState()++    Column(modifier = Modifier.fillMaxSize().verticalScroll(scrollState)) {+        MainSearchBar(+            paddingValues = paddingValues,+            drawerState = drawerState,+            activeLocation = location,+            backStack = backStack,+        ) -    if (forecast == null) {-        Box(modifier = Modifier.fillMaxSize(), contentAlignment = Alignment.Center) {-            if (state?.error != null) {-                Text(state.error, color = MaterialTheme.colorScheme.error)-            } else {-                CircularProgressIndicator()+        if (forecast == null) {+            Box(modifier = Modifier.fillMaxSize().padding(top = 64.dp), contentAlignment = Alignment.TopCenter) {+                if (state?.error != null) {+                    Text(state.error, color = MaterialTheme.colorScheme.error)+                } else {+                    CircularProgressIndicator()+                }             }+            return         }-        return-    } -    val current = forecast.current-    val daily = forecast.daily-    val sunriseEpoch = daily?.sunrise?.firstOrNull()?.let { parseLocalIsoToEpochSec(it, forecast.utcOffsetSeconds) }-    val sunsetEpoch = daily?.sunset?.firstOrNull()?.let { parseLocalIsoToEpochSec(it, forecast.utcOffsetSeconds) }+        val current = forecast.current+        val daily = forecast.daily+        val sunriseEpoch = daily?.sunrise?.firstOrNull()?.let { parseLocalIsoToEpochSec(it, forecast.utcOffsetSeconds) }+        val sunsetEpoch = daily?.sunset?.firstOrNull()?.let { parseLocalIsoToEpochSec(it, forecast.utcOffsetSeconds) } -    LazyColumn(-        modifier = Modifier.fillMaxSize(),-        contentPadding = PaddingValues(bottom = 24.dp, top = 8.dp),-        verticalArrangement = Arrangement.spacedBy(12.dp),-    ) {         if (current != null) {-            item { CurrentHero(location, current, daily, tempUnit) }-        }-        if (forecast.hourly != null) {-            item { HourlyStrip(forecast.hourly, tempUnit) }+            CurrentWeatherCard(current = current, today = daily, tempUnit = tempUnit)         }-        if (current != null) {-            item {-                WeatherBlocksGrid(+        Column(+            modifier = Modifier.padding(start = 16.dp, end = 16.dp, top = 24.dp),+            verticalArrangement = Arrangement.spacedBy(14.dp),+        ) {+            SummaryCard(forecast = forecast, tempUnit = tempUnit)+            if (forecast.hourly != null) {+                HourlyCard(hourly = forecast.hourly, tempUnit = tempUnit)+            }+            if (daily != null) {+                DailyCard(daily = daily, tempUnit = tempUnit)+            }+            if (current != null) {+                WeatherBlocks(                     current = current,                     today = daily,                     air = state.airQuality?.current,@@ -170,25 +185,68 @@ private fun LocationPage(viewModel: WeatherViewModel, location: SavedLocation) {                     sunsetEpochSec = sunsetEpoch,                     tempUnit = tempUnit,                     windUnit = windUnit,-                    viewModel = viewModel,                 )             }-        }-        if (forecast.hourly != null) {-            item { PrecipChart(forecast.hourly) }-        }-        if (daily != null) {-            item { DailyList(daily, tempUnit) }+            CreditsBottomSection()         }     } }  @OptIn(ExperimentalMaterial3Api::class) @Composable-private fun EmptyHome(onAddLocation: () -> Unit) {-    Scaffold(-        topBar = { TopAppBar(title = { Text("Weather") }) },-    ) { padding ->+private fun EmptyHome(viewModel: WeatherViewModel, onAddLocation: () -> Unit) {+    val context = androidx.compose.ui.platform.LocalContext.current+    val scope = rememberCoroutineScope()+    var requesting by remember { mutableStateOf(false) }++    val permissionLauncher = androidx.activity.compose.rememberLauncherForActivityResult(+        androidx.activity.result.contract.ActivityResultContracts.RequestMultiplePermissions(),+    ) { granted ->+        if (granted.values.any { it }) {+            requesting = true+            scope.launch {+                val loc = com.vayunmathur.weather.util.LocationProvider.currentLocation(context)+                if (loc != null) {+                    viewModel.setCurrentLocation(+                        name = "Current location",+                        latitude = loc.latitude,+                        longitude = loc.longitude,+                    )+                } else {+                    android.widget.Toast.makeText(context, "Couldn't determine location", android.widget.Toast.LENGTH_SHORT).show()+                }+                requesting = false+            }+        } else {+            android.widget.Toast.makeText(context, "Location permission denied", android.widget.Toast.LENGTH_SHORT).show()+        }+    }+    val onUseCurrent = {+        if (com.vayunmathur.weather.util.LocationProvider.hasPermission(context)) {+            requesting = true+            scope.launch {+                val loc = com.vayunmathur.weather.util.LocationProvider.currentLocation(context)+                if (loc != null) {+                    viewModel.setCurrentLocation(+                        name = "Current location",+                        latitude = loc.latitude,+                        longitude = loc.longitude,+                    )+                }+                requesting = false+            }+            Unit+        } else {+            permissionLauncher.launch(+                arrayOf(+                    android.Manifest.permission.ACCESS_FINE_LOCATION,+                    android.Manifest.permission.ACCESS_COARSE_LOCATION,+                ),+            )+        }+    }++    Scaffold(topBar = { TopAppBar(title = { Text("Weather") }) }) { padding ->         Box(modifier = Modifier.fillMaxSize().padding(padding), contentAlignment = Alignment.Center) {             Column(horizontalAlignment = Alignment.CenterHorizontally) {                 Text("No locations yet", style = MaterialTheme.typography.titleMedium)@@ -199,15 +257,28 @@ private fun EmptyHome(onAddLocation: () -> Unit) {                     modifier = Modifier.padding(horizontal = 32.dp, vertical = 8.dp),                 )                 Button(onClick = onAddLocation) { Text("Add a location") }+                androidx.compose.foundation.layout.Spacer(Modifier.padding(top = 8.dp))+                androidx.compose.material3.OutlinedButton(+                    onClick = { onUseCurrent() },+                    enabled = !requesting,+                ) {+                    if (requesting) {+                        CircularProgressIndicator(+                            modifier = Modifier.padding(end = 8.dp).then(Modifier),+                            strokeWidth = 2.dp,+                        )+                    }+                    Text(if (requesting) "Locating…" else "Use current location")+                }             }         }     } }  /**- * Open-Meteo returns ISO local-time strings (no offset) when timezone=auto is- * requested. Combine with the response's `utc_offset_seconds` to produce an- * actual epoch.+ * Open-Meteo returns ISO local-time strings (no offset) when timezone=auto+ * is requested. Combine with the response's `utc_offset_seconds` to+ * produce an actual epoch.  */ private fun parseLocalIsoToEpochSec(iso: String, utcOffsetSec: Int): Long? {     val padded = if (iso.length == 16) "$iso:00" else iso
weather/src/main/java/com/vayunmathur/weather/ui/LocationListPage.kt
diff --git a/weather/src/main/java/com/vayunmathur/weather/ui/LocationListPage.kt b/weather/src/main/java/com/vayunmathur/weather/ui/LocationListPage.ktdeleted file mode 100644index 7b4d447f0c..0000000000--- a/weather/src/main/java/com/vayunmathur/weather/ui/LocationListPage.kt+++ /dev/null@@ -1,228 +0,0 @@-package com.vayunmathur.weather.ui--import androidx.compose.foundation.background-import androidx.compose.foundation.clickable-import androidx.compose.foundation.layout.Arrangement-import androidx.compose.foundation.layout.Box-import androidx.compose.foundation.layout.Column-import androidx.compose.foundation.layout.PaddingValues-import androidx.compose.foundation.layout.Row-import androidx.compose.foundation.layout.Spacer-import androidx.compose.foundation.layout.fillMaxSize-import androidx.compose.foundation.layout.fillMaxWidth-import androidx.compose.foundation.layout.padding-import androidx.compose.foundation.layout.size-import androidx.compose.foundation.layout.width-import androidx.compose.foundation.lazy.LazyColumn-import androidx.compose.foundation.lazy.items-import androidx.compose.foundation.shape.CircleShape-import androidx.compose.foundation.shape.RoundedCornerShape-import androidx.compose.material3.ExperimentalMaterial3Api-import androidx.compose.material3.FloatingActionButton-import androidx.compose.material3.Icon-import androidx.compose.material3.IconButton-import androidx.compose.material3.MaterialTheme-import androidx.compose.material3.Scaffold-import androidx.compose.material3.Surface-import androidx.compose.material3.Text-import androidx.compose.material3.TopAppBar-import androidx.compose.runtime.Composable-import androidx.compose.runtime.LaunchedEffect-import androidx.compose.runtime.collectAsState-import androidx.compose.runtime.getValue-import androidx.compose.ui.Alignment-import androidx.compose.ui.Modifier-import androidx.compose.ui.draw.clip-import androidx.compose.ui.res.painterResource-import androidx.compose.ui.text.font.FontWeight-import androidx.compose.ui.unit.dp-import com.vayunmathur.library.ui.IconAdd-import com.vayunmathur.library.ui.IconDelete-import com.vayunmathur.library.ui.IconNavigation-import com.vayunmathur.library.util.NavBackStack-import com.vayunmathur.weather.R-import com.vayunmathur.weather.Route-import com.vayunmathur.weather.data.SavedLocation-import com.vayunmathur.weather.util.TemperatureUnit-import com.vayunmathur.weather.util.WeatherViewModel-import com.vayunmathur.weather.util.formatTemperatureCompact-import com.vayunmathur.weather.util.weatherConditionForCode--/**- * Manage saved locations — pill-shaped cards mirroring the Pixel Weather- * screen. Current device row gets a "Current location" section header with- * a target icon; user-added rows go under "Saved locations" with a pin icon.- */-@OptIn(ExperimentalMaterial3Api::class)-@Composable-fun LocationListPage(backStack: NavBackStack<Route>, viewModel: WeatherViewModel) {-    val locations by viewModel.savedLocations.collectAsState()-    val (currentDevice, saved) = locations.partition { it.isCurrent }--    LaunchedEffect(locations) {-        locations.forEach { viewModel.ensureForecast(it) }-    }--    Scaffold(-        topBar = {-            TopAppBar(-                title = { Text("Weather") },-                navigationIcon = { IconNavigation(backStack) },-            )-        },-        floatingActionButton = {-            FloatingActionButton(-                onClick = { backStack.add(Route.AddLocation) },-                containerColor = MaterialTheme.colorScheme.primaryContainer,-                contentColor = MaterialTheme.colorScheme.onPrimaryContainer,-                shape = RoundedCornerShape(20.dp),-            ) { IconAdd() }-        },-    ) { padding ->-        if (locations.isEmpty()) {-            Box(modifier = Modifier.fillMaxSize().padding(padding), contentAlignment = Alignment.Center) {-                Text(-                    "No locations yet. Tap + to add one.",-                    color = MaterialTheme.colorScheme.onSurfaceVariant,-                )-            }-            return@Scaffold-        }-        LazyColumn(-            modifier = Modifier.fillMaxSize().padding(padding),-            contentPadding = PaddingValues(vertical = 8.dp),-            verticalArrangement = Arrangement.spacedBy(8.dp),-        ) {-            if (currentDevice.isNotEmpty()) {-                item {-                    SmallSectionLabel(-                        text = "Current location",-                        iconRes = R.drawable.outline_my_location_24,-                    )-                }-                items(currentDevice, key = { it.id }) { loc ->-                    LocationPillCard(loc, viewModel) { viewModel.deleteLocation(loc) }-                }-            }-            if (saved.isNotEmpty()) {-                item {-                    SmallSectionLabel(-                        text = "Saved locations",-                        iconRes = R.drawable.outline_location_on_24,-                    )-                }-                items(saved, key = { it.id }) { loc ->-                    LocationPillCard(loc, viewModel) { viewModel.deleteLocation(loc) }-                }-            }-        }-    }-}--@Composable-private fun SmallSectionLabel(text: String, iconRes: Int) {-    Row(-        modifier = Modifier.fillMaxWidth().padding(horizontal = 24.dp, vertical = 4.dp),-        verticalAlignment = Alignment.CenterVertically,-    ) {-        Icon(-            painter = painterResource(iconRes),-            contentDescription = null,-            modifier = Modifier.size(16.dp),-            tint = MaterialTheme.colorScheme.onSurfaceVariant,-        )-        Spacer(Modifier.width(8.dp))-        Text(-            text,-            style = MaterialTheme.typography.bodyMedium,-            color = MaterialTheme.colorScheme.onSurfaceVariant,-        )-    }-}--/**- * Pill-shaped card with a circular condition glyph, location name, condition- * + hi/lo subtitle, and big temperature on the right. Long-press could- * delete; for v1 we just expose a trailing delete button.- */-@Composable-private fun LocationPillCard(-    location: SavedLocation,-    viewModel: WeatherViewModel,-    onDelete: () -> Unit,-) {-    val forecasts by viewModel.forecasts.collectAsState()-    val tempUnit by viewModel.tempUnit.collectAsState()-    val state = forecasts[location.id]-    val current = state?.forecast?.current-    val daily = state?.forecast?.daily-    val condition = current?.weatherCode?.let { weatherConditionForCode(it) }--    Surface(-        modifier = Modifier-            .fillMaxWidth()-            .padding(horizontal = 16.dp)-            .clip(RoundedCornerShape(28.dp))-            .clickable { /* tap → could navigate to that page; for now just no-op */ },-        shape = RoundedCornerShape(28.dp),-        color = MaterialTheme.colorScheme.surfaceContainer,-    ) {-        Row(-            modifier = Modifier.fillMaxWidth().padding(horizontal = 12.dp, vertical = 10.dp),-            verticalAlignment = Alignment.CenterVertically,-        ) {-            Box(-                modifier = Modifier-                    .size(48.dp)-                    .clip(CircleShape)-                    .background(MaterialTheme.colorScheme.onSurface.copy(alpha = 0.10f)),-                contentAlignment = Alignment.Center,-            ) {-                if (condition != null) {-                    Icon(-                        painter = painterResource(condition.iconRes(current?.isDay == 1)),-                        contentDescription = condition.label,-                        modifier = Modifier.size(24.dp),-                        tint = MaterialTheme.colorScheme.onSurface,-                    )-                }-            }-            Spacer(Modifier.width(12.dp))-            Column(modifier = Modifier.weight(1f)) {-                Text(-                    location.name,-                    style = MaterialTheme.typography.titleMedium,-                    fontWeight = FontWeight.Medium,-                )-                if (condition != null) {-                    Text(-                        condition.label,-                        style = MaterialTheme.typography.bodySmall,-                        color = MaterialTheme.colorScheme.onSurfaceVariant,-                    )-                }-                if (daily != null) {-                    val hi = daily.temperatureMax.firstOrNull()-                    val lo = daily.temperatureMin.firstOrNull()-                    if (hi != null && lo != null) {-                        Text(-                            "${formatTemperatureCompact(hi, tempUnit)}  ${formatTemperatureCompact(lo, tempUnit)}",-                            style = MaterialTheme.typography.bodySmall,-                            color = MaterialTheme.colorScheme.onSurfaceVariant,-                        )-                    }-                }-            }-            if (current != null) {-                Text(-                    formatTemperatureCompact(current.temperature, tempUnit),-                    style = MaterialTheme.typography.headlineMedium,-                    fontWeight = FontWeight.Light,-                )-            }-            IconButton(onClick = onDelete, modifier = Modifier.size(40.dp)) {-                IconDelete()-            }-        }-    }-}
weather/src/main/java/com/vayunmathur/weather/ui/LocationsScreen.kt
diff --git a/weather/src/main/java/com/vayunmathur/weather/ui/LocationsScreen.kt b/weather/src/main/java/com/vayunmathur/weather/ui/LocationsScreen.ktnew file mode 100644index 0000000000..965141b5d2--- /dev/null+++ b/weather/src/main/java/com/vayunmathur/weather/ui/LocationsScreen.kt@@ -0,0 +1,373 @@+package com.vayunmathur.weather.ui++import android.Manifest+import android.widget.Toast+import androidx.activity.compose.rememberLauncherForActivityResult+import androidx.activity.result.contract.ActivityResultContracts+import androidx.compose.foundation.clickable+import androidx.compose.foundation.layout.Arrangement+import androidx.compose.foundation.layout.Box+import androidx.compose.foundation.layout.Column+import androidx.compose.foundation.layout.PaddingValues+import androidx.compose.foundation.layout.Spacer+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.padding+import androidx.compose.foundation.layout.width+import androidx.compose.foundation.lazy.LazyColumn+import androidx.compose.foundation.lazy.items+import androidx.compose.material3.Button+import androidx.compose.material3.CircularProgressIndicator+import androidx.compose.material3.ExperimentalMaterial3Api+import androidx.compose.material3.Icon+import androidx.compose.material3.IconButton+import androidx.compose.material3.ListItem+import androidx.compose.material3.ListItemDefaults+import androidx.compose.material3.MaterialTheme+import androidx.compose.material3.ModalBottomSheet+import androidx.compose.material3.Scaffold+import androidx.compose.material3.Text+import androidx.compose.material3.TopAppBar+import androidx.compose.material3.TopAppBarDefaults+import androidx.compose.material3.rememberModalBottomSheetState+import androidx.compose.runtime.Composable+import androidx.compose.runtime.LaunchedEffect+import androidx.compose.runtime.collectAsState+import androidx.compose.runtime.getValue+import androidx.compose.runtime.mutableStateOf+import androidx.compose.runtime.remember+import androidx.compose.runtime.rememberCoroutineScope+import androidx.compose.runtime.setValue+import androidx.compose.runtime.snapshotFlow+import androidx.compose.ui.Alignment+import androidx.compose.ui.Modifier+import androidx.compose.ui.platform.LocalContext+import androidx.compose.ui.res.painterResource+import androidx.compose.ui.unit.dp+import com.vayunmathur.library.R as LibraryR+import com.vayunmathur.library.util.NavBackStack+import com.vayunmathur.weather.R+import com.vayunmathur.weather.Route+import com.vayunmathur.weather.data.SavedLocation+import com.vayunmathur.weather.network.GeocodingResult+import com.vayunmathur.weather.network.WeatherApi+import com.vayunmathur.weather.ui.components.LocationItem+import com.vayunmathur.weather.ui.components.UseDeviceLocationCard+import com.vayunmathur.weather.util.LocationProvider+import com.vayunmathur.weather.util.WeatherViewModel+import kotlinx.coroutines.flow.debounce+import kotlinx.coroutines.flow.distinctUntilChanged+import kotlinx.coroutines.flow.flatMapLatest+import kotlinx.coroutines.flow.flow+import kotlinx.coroutines.launch++/**+ * Locations drawer content. Renders inside [HomePage]'s+ * `DismissibleNavigationDrawer`. Scaffold with a back/close top bar,+ * a scrollable list of [LocationItem]s, and a full-width "Search location"+ * Button pinned to the bottom (in the Scaffold's `bottomBar` slot). The+ * search button opens a [SearchLocationDialog] for picking a city by name.+ */+@OptIn(+    ExperimentalMaterial3Api::class,+    kotlinx.coroutines.ExperimentalCoroutinesApi::class,+    kotlinx.coroutines.FlowPreview::class,+)+@Composable+fun LocationsScreen(+    backStack: NavBackStack<Route>,+    viewModel: WeatherViewModel,+    activeLocation: SavedLocation?,+    onLocationSelect: (SavedLocation) -> Unit,+    onClose: () -> Unit,+) {+    val locations by viewModel.savedLocations.collectAsState()+    val forecasts by viewModel.forecasts.collectAsState()++    var longPressedLocation: SavedLocation? by remember { mutableStateOf(null) }+    val sheetState = rememberModalBottomSheetState(skipPartiallyExpanded = true)+    val scope = rememberCoroutineScope()+    val context = LocalContext.current++    var deviceLocationLoading by remember { mutableStateOf(false) }++    val permissionLauncher = rememberLauncherForActivityResult(+        ActivityResultContracts.RequestMultiplePermissions(),+    ) { granted ->+        if (granted.values.any { it }) {+            deviceLocationLoading = true+            scope.launch {+                val loc = LocationProvider.currentLocation(context)+                if (loc != null) {+                    viewModel.setCurrentLocation(name = "Current location", latitude = loc.latitude, longitude = loc.longitude)+                } else {+                    Toast.makeText(context, "Couldn't determine location", Toast.LENGTH_SHORT).show()+                }+                deviceLocationLoading = false+            }+        } else {+            Toast.makeText(context, "Location permission denied", Toast.LENGTH_SHORT).show()+        }+    }+    val onAddCurrentLocation = {+        if (LocationProvider.hasPermission(context)) {+            deviceLocationLoading = true+            scope.launch {+                val loc = LocationProvider.currentLocation(context)+                if (loc != null) {+                    viewModel.setCurrentLocation(name = "Current location", latitude = loc.latitude, longitude = loc.longitude)+                }+                deviceLocationLoading = false+            }+            Unit+        } else {+            permissionLauncher.launch(+                arrayOf(Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION),+            )+        }+    }++    Scaffold(+        containerColor = MaterialTheme.colorScheme.surfaceContainer,+        topBar = {+            TopAppBar(+                colors = TopAppBarDefaults.topAppBarColors(+                    containerColor = MaterialTheme.colorScheme.surfaceContainer,+                ),+                title = {+                    Text(+                        "Locations",+                        color = MaterialTheme.colorScheme.onSurface,+                        style = MaterialTheme.typography.titleLarge,+                    )+                },+                navigationIcon = {+                    IconButton(onClick = onClose) {+                        Icon(+                            painter = painterResource(LibraryR.drawable.arrow_back_24px),+                            contentDescription = "Close",+                            tint = MaterialTheme.colorScheme.onSurface,+                        )+                    }+                },+            )+        },+        bottomBar = {+            Button(+                onClick = { backStack.add(Route.SearchLocation) },+                modifier = Modifier+                    .fillMaxWidth()+                    .padding(horizontal = 16.dp, vertical = 12.dp),+            ) {+                Icon(+                    painter = painterResource(LibraryR.drawable.outline_search_24),+                    contentDescription = null,+                )+                Spacer(Modifier.width(8.dp))+                Text("Search location")+            }+        },+    ) { paddingValues ->+        Box(+            modifier = Modifier+                .fillMaxSize()+                .padding(top = paddingValues.calculateTopPadding(), bottom = paddingValues.calculateBottomPadding()),+        ) {+            LazyColumn(+                modifier = Modifier.padding(horizontal = 16.dp),+                verticalArrangement = Arrangement.spacedBy(8.dp),+                contentPadding = PaddingValues(top = 8.dp, bottom = 16.dp),+            ) {+                val showDeviceLocationCard = locations.none { it.isCurrent }+                if (showDeviceLocationCard) {+                    item {+                        UseDeviceLocationCard(+                            onClick = { if (!deviceLocationLoading) onAddCurrentLocation() },+                            isLoading = deviceLocationLoading,+                        )+                        Spacer(Modifier.height(8.dp))+                    }+                }+                items(locations, key = { it.id }) { loc ->+                    val state = forecasts[loc.id]+                    val description = state?.fetchedAtEpochMs+                        ?.takeIf { it > 0L }+                        ?.let { "Last updated ${formatAgo(it)}" }+                        ?: "No data yet"+                    LocationItem(+                        location = loc,+                        description = description,+                        currentWeatherCode = state?.forecast?.current?.weatherCode,+                        isDay = (state?.forecast?.current?.isDay ?: 1) == 1,+                        isSelected = loc.id == activeLocation?.id,+                        onClick = { onLocationSelect(loc) },+                        onLongClick = { longPressedLocation = loc },+                    )+                }+            }+        }+    }++    val sheetLocation = longPressedLocation+    if (sheetLocation != null) {+        ModalBottomSheet(+            onDismissRequest = { longPressedLocation = null },+            sheetState = sheetState,+            containerColor = MaterialTheme.colorScheme.surfaceContainer,+        ) {+            Column(modifier = Modifier.padding(bottom = 16.dp)) {+                Text(+                    text = sheetLocation.name,+                    modifier = Modifier.padding(horizontal = 24.dp, vertical = 12.dp),+                    style = MaterialTheme.typography.titleMedium,+                    color = MaterialTheme.colorScheme.onSurface,+                )+                ListItem(+                    colors = ListItemDefaults.colors(containerColor = MaterialTheme.colorScheme.surfaceContainer),+                    leadingContent = {+                        Icon(+                            painter = painterResource(LibraryR.drawable.delete_24px),+                            contentDescription = null,+                            tint = MaterialTheme.colorScheme.onSurface,+                        )+                    },+                    headlineContent = { Text("Delete", color = MaterialTheme.colorScheme.onSurface) },+                    modifier = Modifier.padding(horizontal = 8.dp),+                )+                Spacer(Modifier.height(4.dp))+                androidx.compose.material3.TextButton(+                    onClick = {+                        viewModel.deleteLocation(sheetLocation)+                        longPressedLocation = null+                    },+                    modifier = Modifier.padding(start = 16.dp),+                ) { Text("Confirm delete") }+            }+        }+    }+}++/** Format a "X ago" delta from now to the given epoch ms. */+private fun formatAgo(epochMs: Long): String {+    val deltaSec = ((System.currentTimeMillis() - epochMs) / 1000L).coerceAtLeast(0L)+    return when {+        deltaSec < 60 -> "just now"+        deltaSec < 3600 -> "${deltaSec / 60}m ago"+        deltaSec < 86_400 -> "${deltaSec / 3600}h ago"+        else -> "${deltaSec / 86_400}d ago"+    }+}++/**+ * Search-location screen registered as a `DialogPage()` route entry.+ * Hosted by Navigation3's `DialogSceneStrategy` so it renders as a system+ * dialog instead of a full page. Picking a result inserts the location+ * and pops the back stack.+ */+@OptIn(+    ExperimentalMaterial3Api::class,+    kotlinx.coroutines.ExperimentalCoroutinesApi::class,+    kotlinx.coroutines.FlowPreview::class,+)+@Composable+fun SearchLocationPage(backStack: NavBackStack<Route>, viewModel: WeatherViewModel) {+    var query by remember { mutableStateOf("") }+    var results by remember { mutableStateOf<List<GeocodingResult>>(emptyList()) }+    var searching by remember { mutableStateOf(false) }++    LaunchedEffect(Unit) {+        snapshotFlow { query }+            .debounce(300)+            .distinctUntilChanged()+            .flatMapLatest { q ->+                flow {+                    if (q.isBlank()) {+                        emit(emptyList<GeocodingResult>())+                    } else {+                        searching = true+                        val res = runCatching { WeatherApi.geocode(q).results }.getOrDefault(emptyList())+                        searching = false+                        emit(res)+                    }+                }+            }+            .collect { results = it }+    }++    androidx.compose.material3.Surface(+        shape = MaterialTheme.shapes.extraLarge,+        color = MaterialTheme.colorScheme.surfaceContainer,+        tonalElevation = 0.dp,+    ) {+        Column(+            modifier = Modifier+                .padding(16.dp)+                .heightIn(min = 220.dp, max = 480.dp),+        ) {+            Text(+                "Search location",+                style = MaterialTheme.typography.titleMedium,+                color = MaterialTheme.colorScheme.onSurface,+            )+            Spacer(Modifier.height(12.dp))+            androidx.compose.material3.OutlinedTextField(+                value = query,+                onValueChange = { query = it },+                placeholder = { Text("City name") },+                leadingIcon = {+                    Icon(+                        painter = painterResource(LibraryR.drawable.outline_search_24),+                        contentDescription = null,+                    )+                },+                singleLine = true,+                modifier = Modifier.fillMaxWidth(),+            )+            Spacer(Modifier.height(8.dp))+            Box(modifier = Modifier.fillMaxWidth().heightIn(min = 80.dp, max = 320.dp)) {+                when {+                    searching && results.isEmpty() -> {+                        CircularProgressIndicator(modifier = Modifier.align(Alignment.Center))+                    }+                    query.isNotBlank() && results.isEmpty() && !searching -> {+                        Text(+                            "No matches",+                            color = MaterialTheme.colorScheme.onSurfaceVariant,+                            modifier = Modifier.align(Alignment.Center),+                        )+                    }+                    else -> {+                        LazyColumn(modifier = Modifier.fillMaxSize()) {+                            items(results, key = { it.id }) { r ->+                                ListItem(+                                    colors = ListItemDefaults.colors(+                                        containerColor = MaterialTheme.colorScheme.surfaceContainer,+                                    ),+                                    headlineContent = { Text(r.name) },+                                    supportingContent = {+                                        val parts = listOfNotNull(r.admin1, r.country).filter { it.isNotBlank() }+                                        if (parts.isNotEmpty()) Text(parts.joinToString(", "))+                                    },+                                    modifier = Modifier+                                        .fillMaxWidth()+                                        .padding(vertical = 2.dp)+                                        .clickable {+                                            viewModel.addLocation(+                                                name = r.name,+                                                country = r.country.orEmpty(),+                                                latitude = r.latitude,+                                                longitude = r.longitude,+                                            )+                                            backStack.pop()+                                        },+                                )+                            }+                        }+                    }+                }+            }+        }+    }+}
weather/src/main/java/com/vayunmathur/weather/ui/WeatherTheme.kt
diff --git a/weather/src/main/java/com/vayunmathur/weather/ui/WeatherTheme.kt b/weather/src/main/java/com/vayunmathur/weather/ui/WeatherTheme.ktdeleted file mode 100644index aefd0a4acd..0000000000--- a/weather/src/main/java/com/vayunmathur/weather/ui/WeatherTheme.kt+++ /dev/null@@ -1,41 +0,0 @@-package com.vayunmathur.weather.ui--import androidx.compose.material3.ExperimentalMaterial3Api-import androidx.compose.material3.ExperimentalMaterial3ExpressiveApi-import androidx.compose.material3.MaterialExpressiveTheme-import androidx.compose.material3.MotionScheme-import androidx.compose.foundation.isSystemInDarkTheme-import androidx.compose.runtime.Composable-import androidx.compose.ui.graphics.Color-import com.materialkolor.PaletteStyle-import com.materialkolor.dynamiccolor.ColorSpec-import com.materialkolor.rememberDynamicColorScheme--/**- * Theme mirrors WeatherMaster's `WeatherMasterTheme`: a Material 3 Expressive- * theme whose color scheme is generated from a single seed color via- * `materialkolor`. WeatherMaster's default seed is `#2196f3` (Material- * Blue 500) with the user's pick of palette style — we use the same seed- * but force [PaletteStyle.TonalSpot], which is the more muted Material You- * default (vs WeatherMaster's user-selectable Vibrant/Expressive- * variants).- */-@OptIn(ExperimentalMaterial3Api::class, ExperimentalMaterial3ExpressiveApi::class)-@Composable-fun WeatherTheme(-    darkTheme: Boolean = isSystemInDarkTheme(),-    content: @Composable () -> Unit,-) {-    val colorScheme = rememberDynamicColorScheme(-        seedColor = Color(0xFF2196F3),-        isDark = darkTheme,-        specVersion = ColorSpec.SpecVersion.SPEC_2025,-        style = PaletteStyle.TonalSpot,-    )--    MaterialExpressiveTheme(-        colorScheme = colorScheme,-        motionScheme = MotionScheme.expressive(),-        content = content,-    )-}
weather/src/main/java/com/vayunmathur/weather/ui/components/AirQualityTile.kt
diff --git a/weather/src/main/java/com/vayunmathur/weather/ui/components/AirQualityTile.kt b/weather/src/main/java/com/vayunmathur/weather/ui/components/AirQualityTile.ktdeleted file mode 100644index c62972731b..0000000000--- a/weather/src/main/java/com/vayunmathur/weather/ui/components/AirQualityTile.kt+++ /dev/null@@ -1,49 +0,0 @@-package com.vayunmathur.weather.ui.components--import androidx.compose.foundation.layout.offset-import androidx.compose.material3.ExperimentalMaterial3ExpressiveApi-import androidx.compose.material3.MaterialShapes-import androidx.compose.material3.MaterialTheme-import androidx.compose.material3.Text-import androidx.compose.material3.toShape-import androidx.compose.runtime.Composable-import androidx.compose.ui.Alignment-import androidx.compose.ui.Modifier-import androidx.compose.ui.unit.dp-import com.vayunmathur.weather.R--@OptIn(ExperimentalMaterial3ExpressiveApi::class)-@Composable-fun AirQualityBlock(aqi: Int?, modifier: Modifier = Modifier) {-    val v = aqi ?: 0-    val label = when {-        aqi == null -> "—"-        v <= 50 -> "Good"-        v <= 100 -> "Moderate"-        v <= 150 -> "Sensitive"-        v <= 200 -> "Unhealthy"-        v <= 300 -> "Very unhealthy"-        else -> "Hazardous"-    }-    WeatherBlock(-        title = "Air quality",-        iconRes = R.drawable.outline_air_24,-        modifier = modifier,-        shape = MaterialShapes.Cookie12Sided.toShape(),-        containerColor = MaterialTheme.colorScheme.secondaryContainer,-        contentColor = MaterialTheme.colorScheme.onSecondaryContainer,-    ) {-        Text(-            aqi?.toString() ?: "—",-            style = MaterialTheme.typography.displayMedium,-            color = MaterialTheme.colorScheme.onSecondaryContainer,-            modifier = Modifier.align(Alignment.Center).offset(y = 4.dp),-        )-        Text(-            label,-            style = MaterialTheme.typography.bodyMedium,-            color = MaterialTheme.colorScheme.onSecondaryContainer.copy(alpha = 0.75f),-            modifier = Modifier.align(Alignment.BottomCenter).offset(y = (-20).dp),-        )-    }-}
weather/src/main/java/com/vayunmathur/weather/ui/components/CardsHeader.kt
diff --git a/weather/src/main/java/com/vayunmathur/weather/ui/components/CardsHeader.kt b/weather/src/main/java/com/vayunmathur/weather/ui/components/CardsHeader.ktnew file mode 100644index 0000000000..5fc5f417ff--- /dev/null+++ b/weather/src/main/java/com/vayunmathur/weather/ui/components/CardsHeader.kt@@ -0,0 +1,42 @@+package com.vayunmathur.weather.ui.components++import androidx.compose.foundation.layout.Arrangement+import androidx.compose.foundation.layout.Row+import androidx.compose.foundation.layout.padding+import androidx.compose.foundation.layout.size+import androidx.compose.material3.Icon+import androidx.compose.material3.MaterialTheme+import androidx.compose.material3.Text+import androidx.compose.runtime.Composable+import androidx.compose.ui.Alignment+import androidx.compose.ui.Modifier+import androidx.compose.ui.res.painterResource+import androidx.compose.ui.text.font.FontWeight+import androidx.compose.ui.unit.dp++/**+ * Section header rendered inside Summary / Hourly / Daily cards. Direct+ * port of WeatherMaster's `CardsHeader` — small leading icon + bold+ * `titleMedium` text, both in `MaterialTheme.colorScheme.secondary`.+ */+@Composable+fun CardsHeader(text: String, iconRes: Int) {+    Row(+        horizontalArrangement = Arrangement.spacedBy(5.dp, alignment = Alignment.CenterHorizontally),+        verticalAlignment = Alignment.CenterVertically,+        modifier = Modifier.padding(top = 16.dp, start = 16.dp, end = 16.dp),+    ) {+        Icon(+            painter = painterResource(iconRes),+            contentDescription = null,+            tint = MaterialTheme.colorScheme.secondary,+            modifier = Modifier.size(20.dp),+        )+        Text(+            text = text,+            style = MaterialTheme.typography.titleMedium,+            fontWeight = FontWeight.Bold,+            color = MaterialTheme.colorScheme.secondary,+        )+    }+}
weather/src/main/java/com/vayunmathur/weather/ui/components/CreditsBottomSection.kt
diff --git a/weather/src/main/java/com/vayunmathur/weather/ui/components/CreditsBottomSection.kt b/weather/src/main/java/com/vayunmathur/weather/ui/components/CreditsBottomSection.ktnew file mode 100644index 0000000000..24f19d15c7--- /dev/null+++ b/weather/src/main/java/com/vayunmathur/weather/ui/components/CreditsBottomSection.kt@@ -0,0 +1,38 @@+package com.vayunmathur.weather.ui.components++import androidx.compose.foundation.layout.WindowInsets+import androidx.compose.foundation.layout.asPaddingValues+import androidx.compose.foundation.layout.fillMaxWidth+import androidx.compose.foundation.layout.height+import androidx.compose.foundation.layout.padding+import androidx.compose.foundation.layout.systemBars+import androidx.compose.material3.MaterialTheme+import androidx.compose.material3.Text+import androidx.compose.runtime.Composable+import androidx.compose.ui.Modifier+import androidx.compose.ui.text.font.FontWeight+import androidx.compose.ui.text.style.TextAlign+import androidx.compose.ui.text.style.TextDecoration+import androidx.compose.ui.unit.dp++/**+ * Mirrors WeatherMaster's `CreditsBottomSection`: a single centered,+ * bold-underlined line attributing the data source, with a trailing system+ * insets spacer so the credit sits above the gesture bar.+ */+@Composable+fun CreditsBottomSection() {+    val bottomInset = WindowInsets.systemBars.asPaddingValues().calculateBottomPadding()+    Text(+        text = "Open-Meteo and more",+        modifier = Modifier+            .fillMaxWidth()+            .padding(top = 4.dp),+        style = MaterialTheme.typography.bodyLarge,+        fontWeight = FontWeight.Bold,+        textDecoration = TextDecoration.Underline,+        color = MaterialTheme.colorScheme.onSurface,+        textAlign = TextAlign.Center,+    )+    androidx.compose.foundation.layout.Spacer(Modifier.height(bottomInset))+}
weather/src/main/java/com/vayunmathur/weather/ui/components/CurrentWeatherCard.kt
diff --git a/weather/src/main/java/com/vayunmathur/weather/ui/components/CurrentHero.kt b/weather/src/main/java/com/vayunmathur/weather/ui/components/CurrentWeatherCard.ktsimilarity index 80%rename from weather/src/main/java/com/vayunmathur/weather/ui/components/CurrentHero.ktrename to weather/src/main/java/com/vayunmathur/weather/ui/components/CurrentWeatherCard.ktindex c6523a1736..46956b6127 100644--- a/weather/src/main/java/com/vayunmathur/weather/ui/components/CurrentHero.kt+++ b/weather/src/main/java/com/vayunmathur/weather/ui/components/CurrentWeatherCard.kt@@ -9,17 +9,14 @@ import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.width-import androidx.compose.material3.Icon import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier-import androidx.compose.ui.res.painterResource import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp-import com.vayunmathur.weather.data.SavedLocation import com.vayunmathur.weather.network.Current import com.vayunmathur.weather.network.Daily import com.vayunmathur.weather.util.TemperatureUnit@@ -27,17 +24,13 @@ import com.vayunmathur.weather.util.formatTemperatureCompact import com.vayunmathur.weather.util.weatherConditionForCode  /**- * Hero — direct port of WeatherMaster's `PixelStyleCurrentWeatherCard`:- * icon + condition label in a row, 136sp primary-color bold temperature,- * "Feels like" titleLarge, then a single "Max X° Min Y°" row.+ * Direct port of WeatherMaster's `PixelStyleCurrentWeatherCard`. Centered+ * column: 32 dp condition icon + `titleLarge Medium` condition label, then+ * 136 sp bold `primary`-colored temperature, then `titleLarge Medium`+ * feels-like, then a "Max X° Min Y°" row.  */ @Composable-fun CurrentHero(-    location: SavedLocation,-    current: Current,-    today: Daily?,-    tempUnit: TemperatureUnit,-) {+fun CurrentWeatherCard(current: Current, today: Daily?, tempUnit: TemperatureUnit) {     val condition = weatherConditionForCode(current.weatherCode)     val high = today?.temperatureMax?.firstOrNull()     val low = today?.temperatureMin?.firstOrNull()@@ -49,10 +42,9 @@ fun CurrentHero(         horizontalAlignment = Alignment.CenterHorizontally,     ) {         Row(verticalAlignment = Alignment.CenterVertically) {-            Icon(-                painter = painterResource(condition.iconRes(current.isDay == 1)),-                contentDescription = condition.label,-                modifier = Modifier.size(32.dp),+            WeatherIconBox(+                iconRes = condition.iconRes(current.isDay == 1),+                size = 32.dp,                 tint = MaterialTheme.colorScheme.onSurface,             )             Spacer(Modifier.width(6.dp))@@ -83,7 +75,7 @@ fun CurrentHero(                 verticalAlignment = Alignment.CenterVertically,             ) {                 Text(-                    text = "Max ${formatTemperatureCompact(high, tempUnit)} Min ${formatTemperatureCompact(low, tempUnit)}",+                    text = "Max ${formatTemperatureCompact(high, tempUnit)}  Min ${formatTemperatureCompact(low, tempUnit)}",                     color = MaterialTheme.colorScheme.onSurfaceVariant,                     style = MaterialTheme.typography.titleLarge,                 )
weather/src/main/java/com/vayunmathur/weather/ui/components/DailyCard.kt
diff --git a/weather/src/main/java/com/vayunmathur/weather/ui/components/DailyCard.kt b/weather/src/main/java/com/vayunmathur/weather/ui/components/DailyCard.ktnew file mode 100644index 0000000000..fc6805c22d--- /dev/null+++ b/weather/src/main/java/com/vayunmathur/weather/ui/components/DailyCard.kt@@ -0,0 +1,126 @@+package com.vayunmathur.weather.ui.components++import androidx.compose.foundation.layout.Arrangement+import androidx.compose.foundation.layout.Column+import androidx.compose.foundation.layout.Spacer+import androidx.compose.foundation.layout.fillMaxWidth+import androidx.compose.foundation.layout.height+import androidx.compose.foundation.layout.padding+import androidx.compose.foundation.layout.width+import androidx.compose.foundation.lazy.LazyRow+import androidx.compose.foundation.shape.CircleShape+import androidx.compose.material3.MaterialTheme+import androidx.compose.material3.Surface+import androidx.compose.material3.Text+import androidx.compose.runtime.Composable+import androidx.compose.ui.Alignment+import androidx.compose.ui.Modifier+import androidx.compose.ui.unit.dp+import com.vayunmathur.weather.R+import com.vayunmathur.weather.network.Daily+import com.vayunmathur.weather.util.TemperatureUnit+import com.vayunmathur.weather.util.formatTemperatureCompact+import com.vayunmathur.weather.util.weatherConditionForCode+import kotlinx.datetime.LocalDate++/**+ * Direct port of WeatherMaster's `DailyCard`. `Surface(extraLarge, surface,+ * shadowElevation = 2.dp)` containing [CardsHeader] + a `LazyRow` of+ * 210 dp × 65 dp pill `DailyItem`s with 6 dp spacing. Each item shows+ * max/min temps on top, weather icon + precip% + weekday on the bottom.+ */+@Composable+fun DailyCard(daily: Daily, tempUnit: TemperatureUnit) {+    if (daily.time.isEmpty()) return++    Surface(+        color = MaterialTheme.colorScheme.surface,+        shape = MaterialTheme.shapes.extraLarge,+        shadowElevation = 2.dp,+    ) {+        Column(modifier = Modifier.fillMaxWidth().padding(bottom = 16.dp)) {+            CardsHeader(text = "Daily forecast", iconRes = R.drawable.outline_calendar_24)+            Spacer(Modifier.height(14.dp))+            LazyRow(horizontalArrangement = Arrangement.spacedBy(6.dp)) {+                items(daily.time.size, key = { "${daily.time[it]}_$it" }) { index ->+                    val date = daily.time.getOrNull(index)+                    val hi = daily.temperatureMax.getOrNull(index) ?: 0.0+                    val lo = daily.temperatureMin.getOrNull(index) ?: 0.0+                    val code = daily.weatherCode.getOrNull(index) ?: 0+                    val precip = daily.precipitationProbabilityMax.getOrNull(index) ?: 0++                    if (index == 0) Spacer(Modifier.width(16.dp))++                    DailyItem(+                        weekday = if (index == 0) "Today" else dayLabel(date),+                        maxTemp = hi,+                        minTemp = lo,+                        iconRes = weatherConditionForCode(code).iconRes(true),+                        precipitationProbability = precip,+                        tempUnit = tempUnit,+                    )++                    if (index == daily.time.size - 1) Spacer(Modifier.width(16.dp))+                }+            }+        }+    }+}++@Composable+private fun DailyItem(+    weekday: String,+    maxTemp: Double,+    minTemp: Double,+    iconRes: Int,+    precipitationProbability: Int,+    tempUnit: TemperatureUnit,+) {+    Surface(+        color = MaterialTheme.colorScheme.surfaceContainer,+        shape = CircleShape,+    ) {+        Column(+            modifier = Modifier+                .height(210.dp)+                .width(65.dp)+                .padding(vertical = 24.dp),+            horizontalAlignment = Alignment.CenterHorizontally,+            verticalArrangement = Arrangement.SpaceBetween,+        ) {+            Column(horizontalAlignment = Alignment.CenterHorizontally) {+                Text(+                    formatTemperatureCompact(maxTemp, tempUnit),+                    style = MaterialTheme.typography.bodyLarge,+                    color = MaterialTheme.colorScheme.onSurface,+                )+                Text(+                    formatTemperatureCompact(minTemp, tempUnit),+                    style = MaterialTheme.typography.bodyLarge,+                    color = MaterialTheme.colorScheme.onSurfaceVariant,+                )+            }+            Column(horizontalAlignment = Alignment.CenterHorizontally) {+                WeatherIconBox(iconRes = iconRes, size = 38.dp)+                Spacer(Modifier.height(8.dp))+                Text(+                    "${precipitationProbability}%",+                    color = MaterialTheme.colorScheme.primary,+                    style = MaterialTheme.typography.bodyMedium,+                )+                Spacer(Modifier.height(4.dp))+                Text(+                    weekday,+                    color = MaterialTheme.colorScheme.onSurface,+                    style = MaterialTheme.typography.bodyLarge,+                )+            }+        }+    }+}++private fun dayLabel(dateStr: String?): String {+    if (dateStr == null) return "-"+    val date = runCatching { LocalDate.parse(dateStr) }.getOrNull() ?: return dateStr+    return date.dayOfWeek.name.take(3).lowercase().replaceFirstChar { it.uppercase() }+}
weather/src/main/java/com/vayunmathur/weather/ui/components/DailyList.kt
diff --git a/weather/src/main/java/com/vayunmathur/weather/ui/components/DailyList.kt b/weather/src/main/java/com/vayunmathur/weather/ui/components/DailyList.ktdeleted file mode 100644index 592c1e3c1d..0000000000--- a/weather/src/main/java/com/vayunmathur/weather/ui/components/DailyList.kt+++ /dev/null@@ -1,155 +0,0 @@-package com.vayunmathur.weather.ui.components--import androidx.compose.foundation.Canvas-import androidx.compose.foundation.background-import androidx.compose.foundation.layout.Arrangement-import androidx.compose.foundation.layout.Box-import androidx.compose.foundation.layout.PaddingValues-import androidx.compose.foundation.layout.Row-import androidx.compose.foundation.layout.Spacer-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.width-import androidx.compose.foundation.shape.CircleShape-import androidx.compose.material3.Icon-import androidx.compose.material3.MaterialTheme-import androidx.compose.material3.Text-import androidx.compose.runtime.Composable-import androidx.compose.ui.Alignment-import androidx.compose.ui.Modifier-import androidx.compose.ui.draw.clip-import androidx.compose.ui.geometry.CornerRadius-import androidx.compose.ui.geometry.Offset-import androidx.compose.ui.geometry.Size-import androidx.compose.ui.res.painterResource-import androidx.compose.ui.text.font.FontWeight-import androidx.compose.ui.unit.dp-import com.vayunmathur.weather.network.Daily-import com.vayunmathur.weather.util.TemperatureUnit-import com.vayunmathur.weather.util.formatTemperatureCompact-import com.vayunmathur.weather.util.weatherConditionForCode-import kotlinx.datetime.LocalDate--/**- * 7-day forecast list inside a [WeatherSection]. Each row mirrors Health's- * `HealthRow` rhythm: 36dp circular tinted icon badge, label column, range- * bar in the middle, hi/lo on the right. Inset hairline dividers between- * rows.- */-@Composable-fun DailyList(daily: Daily, tempUnit: TemperatureUnit) {-    if (daily.time.isEmpty()) return--    val weekLow = daily.temperatureMin.minOrNull() ?: 0.0-    val weekHigh = daily.temperatureMax.maxOrNull() ?: 0.0-    val span = (weekHigh - weekLow).takeIf { it > 0 } ?: 1.0--    WeatherSection(-        title = "7-day forecast",-        leadingIconRes = com.vayunmathur.weather.R.drawable.outline_calendar_24,-        surfacePadding = PaddingValues(vertical = 4.dp),-    ) {-        daily.time.forEachIndexed { i, dateStr ->-            val code = daily.weatherCode.getOrNull(i) ?: 0-            val hi = daily.temperatureMax.getOrNull(i) ?: 0.0-            val lo = daily.temperatureMin.getOrNull(i) ?: 0.0-            DailyRow(-                label = if (i == 0) "Today" else dayLabel(dateStr),-                weatherCode = code,-                lo = lo,-                hi = hi,-                weekLow = weekLow,-                span = span,-                tempUnit = tempUnit,-            )-            if (i < daily.time.size - 1) WeatherSectionDivider(insetStart = 60.dp)-        }-    }-}--@Composable-private fun DailyRow(-    label: String,-    weatherCode: Int,-    lo: Double,-    hi: Double,-    weekLow: Double,-    span: Double,-    tempUnit: TemperatureUnit,-) {-    val condition = weatherConditionForCode(weatherCode)-    val accent = MaterialTheme.colorScheme.onSurface-    val trackColor = MaterialTheme.colorScheme.surfaceContainerHighest-    val barColor = MaterialTheme.colorScheme.onSurface--    Row(-        modifier = Modifier.fillMaxWidth().padding(horizontal = 16.dp, vertical = 10.dp),-        verticalAlignment = Alignment.CenterVertically,-    ) {-        Box(-            modifier = Modifier-                .size(36.dp)-                .clip(CircleShape)-                .background(accent.copy(alpha = 0.10f)),-            contentAlignment = Alignment.Center,-        ) {-            Icon(-                painter = painterResource(condition.iconRes(true)),-                contentDescription = condition.label,-                tint = accent,-                modifier = Modifier.size(20.dp),-            )-        }-        Spacer(Modifier.width(12.dp))-        Text(-            label,-            modifier = Modifier.width(56.dp),-            style = MaterialTheme.typography.bodyLarge,-            fontWeight = FontWeight.Medium,-        )-        Text(-            formatTemperatureCompact(lo, tempUnit),-            style = MaterialTheme.typography.bodyMedium,-            color = MaterialTheme.colorScheme.onSurfaceVariant,-            modifier = Modifier.width(36.dp),-        )-        Canvas(-            modifier = Modifier-                .weight(1f)-                .height(6.dp)-                .padding(horizontal = 4.dp),-        ) {-            val w = size.width-            val h = size.height-            drawRoundRect(-                color = trackColor,-                size = Size(w, h),-                cornerRadius = CornerRadius(h / 2),-            )-            val startFrac = ((lo - weekLow) / span).toFloat().coerceIn(0f, 1f)-            val endFrac = ((hi - weekLow) / span).toFloat().coerceIn(0f, 1f)-            val left = w * startFrac-            val widthF = (w * (endFrac - startFrac)).coerceAtLeast(h)-            drawRoundRect(-                color = barColor,-                topLeft = Offset(left, 0f),-                size = Size(widthF, h),-                cornerRadius = CornerRadius(h / 2),-            )-        }-        Text(-            formatTemperatureCompact(hi, tempUnit),-            style = MaterialTheme.typography.bodyMedium,-            color = MaterialTheme.colorScheme.onSurface,-            fontWeight = FontWeight.Medium,-            modifier = Modifier.width(36.dp),-        )-    }-}--private fun dayLabel(dateStr: String): String {-    val date = runCatching { LocalDate.parse(dateStr) }.getOrNull() ?: return dateStr-    return date.dayOfWeek.name.take(3).lowercase().replaceFirstChar { it.uppercase() }-}
weather/src/main/java/com/vayunmathur/weather/ui/components/HourlyCard.kt
diff --git a/weather/src/main/java/com/vayunmathur/weather/ui/components/HourlyCard.kt b/weather/src/main/java/com/vayunmathur/weather/ui/components/HourlyCard.ktnew file mode 100644index 0000000000..33da7b1d87--- /dev/null+++ b/weather/src/main/java/com/vayunmathur/weather/ui/components/HourlyCard.kt@@ -0,0 +1,162 @@+package com.vayunmathur.weather.ui.components++import androidx.compose.foundation.layout.Arrangement+import androidx.compose.foundation.layout.Box+import androidx.compose.foundation.layout.Column+import androidx.compose.foundation.layout.Spacer+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.width+import androidx.compose.foundation.lazy.LazyRow+import androidx.compose.material3.ExperimentalMaterial3ExpressiveApi+import androidx.compose.material3.MaterialShapes+import androidx.compose.material3.MaterialTheme+import androidx.compose.material3.Surface+import androidx.compose.material3.Text+import androidx.compose.material3.toShape+import androidx.compose.runtime.Composable+import androidx.compose.runtime.remember+import androidx.compose.ui.Alignment+import androidx.compose.ui.Modifier+import androidx.compose.ui.draw.alpha+import androidx.compose.ui.graphics.Color+import androidx.compose.ui.unit.dp+import com.vayunmathur.weather.R+import com.vayunmathur.weather.network.Hourly+import com.vayunmathur.weather.util.TemperatureUnit+import com.vayunmathur.weather.util.formatTemperatureCompact+import com.vayunmathur.weather.util.weatherConditionForCode+import kotlinx.datetime.TimeZone+import kotlinx.datetime.toLocalDateTime+import kotlin.time.Instant++/**+ * Direct port of WeatherMaster's `HourlyCard`. `Surface(shape = extraLarge,+ * color = surface, shadowElevation = 2.dp)`, [CardsHeader] at top, then a+ * `LazyRow` of 120 dp × 45 dp items. First (current-hour) item shows its+ * temperature inside a `MaterialShapes.Cookie4Sided` pill filled with+ * `primary`.+ */+@Composable+fun HourlyCard(hourly: Hourly, tempUnit: TemperatureUnit) {+    val nowSec = System.currentTimeMillis() / 1000+    val cells = remember(hourly) {+        hourly.time.indices+            .mapNotNull { i ->+                val ts = parseIsoToEpochSec(hourly.time.getOrNull(i)) ?: return@mapNotNull null+                if (ts < nowSec - 3600) return@mapNotNull null+                HourCell(+                    epochSec = ts,+                    temperature = hourly.temperature.getOrNull(i) ?: 0.0,+                    weatherCode = hourly.weatherCode.getOrNull(i) ?: 0,+                    precip = hourly.precipitationProbability.getOrNull(i) ?: 0,+                    isDay = (hourly.isDay.getOrNull(i) ?: 1) == 1,+                )+            }+            .take(24)+    }+    if (cells.isEmpty()) return++    Surface(+        color = MaterialTheme.colorScheme.surface,+        shape = MaterialTheme.shapes.extraLarge,+        shadowElevation = 2.dp,+    ) {+        Column(modifier = Modifier.fillMaxWidth().padding(bottom = 16.dp)) {+            CardsHeader(text = "Hourly forecast", iconRes = R.drawable.outline_schedule_24)+            LazyRow {+                items(cells.size, key = { "${cells[it].epochSec}_$it" }) { index ->+                    val cell = cells[index]+                    if (index == 0) Spacer(Modifier.width(10.dp))+                    HourlyItem(+                        time = if (index == 0) "Now" else formatHour(cell.epochSec),+                        precipitationProbability = cell.precip,+                        temperature = cell.temperature,+                        isNow = index == 0,+                        iconRes = weatherConditionForCode(cell.weatherCode).iconRes(cell.isDay),+                        tempUnit = tempUnit,+                    )+                    if (index == cells.size - 1) Spacer(Modifier.width(10.dp))+                }+            }+        }+    }+}++@Composable+private fun HourlyItem(+    time: String,+    precipitationProbability: Int,+    temperature: Double,+    isNow: Boolean,+    iconRes: Int,+    tempUnit: TemperatureUnit,+) {+    Column(+        modifier = Modifier.height(120.dp).width(45.dp),+        verticalArrangement = Arrangement.Bottom,+        horizontalAlignment = Alignment.CenterHorizontally,+    ) {+        Spacer(Modifier.height(5.dp))+        TempWithShape(temperature = temperature, tempUnit = tempUnit, isNow = isNow)+        Spacer(Modifier.height(2.dp))+        Text(+            "${precipitationProbability}%",+            color = MaterialTheme.colorScheme.primary,+            style = MaterialTheme.typography.labelMedium,+            modifier = Modifier+                .padding(bottom = 3.dp)+                .alpha(if (precipitationProbability > 0) 1f else 0f),+        )+        WeatherIconBox(iconRes = iconRes, size = 28.dp)+        Spacer(Modifier.height(3.dp))+        Text(+            time,+            color = MaterialTheme.colorScheme.onSurfaceVariant,+            style = MaterialTheme.typography.labelLarge,+        )+    }+}++@OptIn(ExperimentalMaterial3ExpressiveApi::class)+@Composable+private fun TempWithShape(temperature: Double, tempUnit: TemperatureUnit, isNow: Boolean) {+    Surface(+        shape = MaterialShapes.Cookie4Sided.toShape(),+        modifier = Modifier.size(36.dp),+        color = if (isNow) MaterialTheme.colorScheme.primary else Color.Transparent,+    ) {+        Box(modifier = Modifier.fillMaxSize(), contentAlignment = Alignment.Center) {+            Text(+                formatTemperatureCompact(temperature, tempUnit),+                color = if (isNow) MaterialTheme.colorScheme.onPrimary else MaterialTheme.colorScheme.onSurface,+                style = MaterialTheme.typography.titleMedium,+            )+        }+    }+}++private data class HourCell(+    val epochSec: Long,+    val temperature: Double,+    val weatherCode: Int,+    val precip: Int,+    val isDay: Boolean,+)++private fun parseIsoToEpochSec(iso: String?): Long? {+    if (iso == null) return null+    return runCatching { Instant.parse("$iso:00Z").epochSeconds }.getOrNull()+        ?: runCatching { Instant.parse(iso).epochSeconds }.getOrNull()+}++private fun formatHour(epochSec: Long): String {+    val ldt = Instant.fromEpochSeconds(epochSec).toLocalDateTime(TimeZone.currentSystemDefault())+    val h = ldt.hour+    val ampm = if (h < 12) "AM" else "PM"+    val display = if (h % 12 == 0) 12 else h % 12+    return "$display $ampm"+}
weather/src/main/java/com/vayunmathur/weather/ui/components/HourlyStrip.kt
diff --git a/weather/src/main/java/com/vayunmathur/weather/ui/components/HourlyStrip.kt b/weather/src/main/java/com/vayunmathur/weather/ui/components/HourlyStrip.ktdeleted file mode 100644index 974d1aac64..0000000000--- a/weather/src/main/java/com/vayunmathur/weather/ui/components/HourlyStrip.kt+++ /dev/null@@ -1,142 +0,0 @@-package com.vayunmathur.weather.ui.components--import androidx.compose.foundation.background-import androidx.compose.foundation.layout.Arrangement-import androidx.compose.foundation.layout.Column-import androidx.compose.foundation.layout.PaddingValues-import androidx.compose.foundation.layout.Spacer-import androidx.compose.foundation.layout.height-import androidx.compose.foundation.layout.padding-import androidx.compose.foundation.layout.size-import androidx.compose.foundation.layout.width-import androidx.compose.foundation.lazy.LazyRow-import androidx.compose.foundation.shape.RoundedCornerShape-import androidx.compose.material3.Icon-import androidx.compose.material3.MaterialTheme-import androidx.compose.material3.Text-import androidx.compose.runtime.Composable-import androidx.compose.runtime.remember-import androidx.compose.ui.Alignment-import androidx.compose.ui.Modifier-import androidx.compose.ui.draw.clip-import androidx.compose.ui.graphics.Color-import androidx.compose.ui.res.painterResource-import androidx.compose.ui.text.font.FontWeight-import androidx.compose.ui.unit.dp-import com.vayunmathur.weather.network.Hourly-import com.vayunmathur.weather.util.TemperatureUnit-import com.vayunmathur.weather.util.formatTemperatureCompact-import com.vayunmathur.weather.util.weatherConditionForCode-import kotlinx.datetime.toLocalDateTime-import kotlin.time.Instant--/**- * 24-hour preview rendered inside a [WeatherSection] card. First cell shows- * "Now" and is filled with `surfaceContainerHighest` so the user's gaze- * lands there first (mirrors Pixel Weather's "now" pill).- */-@Composable-fun HourlyStrip(hourly: Hourly, tempUnit: TemperatureUnit) {-    val now = System.currentTimeMillis() / 1000-    val cells = remember(hourly) {-        hourly.time.indices-            .mapNotNull { i ->-                val ts = parseIsoToEpochSec(hourly.time.getOrNull(i)) ?: return@mapNotNull null-                if (ts < now - 3600) return@mapNotNull null-                HourlyCell(-                    epochSec = ts,-                    temperature = hourly.temperature.getOrNull(i) ?: 0.0,-                    weatherCode = hourly.weatherCode.getOrNull(i) ?: 0,-                    precip = hourly.precipitationProbability.getOrNull(i) ?: 0,-                    isDay = (hourly.isDay.getOrNull(i) ?: 1) == 1,-                )-            }-            .take(24)-    }-    if (cells.isEmpty()) return--    WeatherSection(-        title = "Hourly forecast",-        leadingIconRes = com.vayunmathur.weather.R.drawable.outline_schedule_24,-        surfacePadding = PaddingValues(vertical = 8.dp),-    ) {-        LazyRow(-            contentPadding = PaddingValues(horizontal = 8.dp),-            horizontalArrangement = Arrangement.spacedBy(0.dp),-        ) {-            itemsIndexed(cells) { index, cell ->-                HourlyCellView(cell, tempUnit, highlightAsNow = index == 0)-            }-        }-    }-}--@Composable-private fun HourlyCellView(cell: HourlyCell, tempUnit: TemperatureUnit, highlightAsNow: Boolean) {-    val condition = weatherConditionForCode(cell.weatherCode)-    val label = if (highlightAsNow) "Now" else formatHour(cell.epochSec)-    val timeColor = if (highlightAsNow) MaterialTheme.colorScheme.primary-                    else MaterialTheme.colorScheme.primary.copy(alpha = 0.75f)-    Column(-        modifier = Modifier-            .padding(horizontal = 4.dp, vertical = 8.dp)-            .width(60.dp),-        horizontalAlignment = Alignment.CenterHorizontally,-        verticalArrangement = Arrangement.spacedBy(8.dp),-    ) {-        // Pixel order: temp on top, condition icon, precip %, then time.-        Text(-            formatTemperatureCompact(cell.temperature, tempUnit),-            style = MaterialTheme.typography.titleMedium,-            color = MaterialTheme.colorScheme.onSurface,-            fontWeight = FontWeight.Medium,-        )-        Icon(-            painter = painterResource(condition.iconRes(cell.isDay)),-            contentDescription = condition.label,-            modifier = Modifier.size(28.dp),-            tint = MaterialTheme.colorScheme.onSurface,-        )-        Text(-            text = if (cell.precip >= 10) "${cell.precip}%" else "",-            style = MaterialTheme.typography.labelSmall,-            color = MaterialTheme.colorScheme.primary,-        )-        Text(-            label,-            style = MaterialTheme.typography.labelMedium,-            color = timeColor,-            fontWeight = if (highlightAsNow) FontWeight.SemiBold else FontWeight.Normal,-        )-    }-}--private data class HourlyCell(-    val epochSec: Long,-    val temperature: Double,-    val weatherCode: Int,-    val precip: Int,-    val isDay: Boolean,-)--private fun parseIsoToEpochSec(iso: String?): Long? {-    if (iso == null) return null-    return runCatching { Instant.parse("$iso:00Z").epochSeconds }.getOrNull()-        ?: runCatching { Instant.parse(iso).epochSeconds }.getOrNull()-}--private fun formatHour(epochSec: Long): String {-    val ldt = Instant.fromEpochSeconds(epochSec)-        .toLocalDateTime(kotlinx.datetime.TimeZone.currentSystemDefault())-    val h = ldt.hour-    val ampm = if (h < 12) "AM" else "PM"-    val display = if (h % 12 == 0) 12 else h % 12-    return "$display $ampm"-}--private inline fun <T> androidx.compose.foundation.lazy.LazyListScope.itemsIndexed(-    items: List<T>,-    crossinline content: @Composable (Int, T) -> Unit,-) {-    items(items.size) { content(it, items[it]) }-}
weather/src/main/java/com/vayunmathur/weather/ui/components/HumidityTile.kt
diff --git a/weather/src/main/java/com/vayunmathur/weather/ui/components/HumidityTile.kt b/weather/src/main/java/com/vayunmathur/weather/ui/components/HumidityTile.ktdeleted file mode 100644index 849cfd4bbc..0000000000--- a/weather/src/main/java/com/vayunmathur/weather/ui/components/HumidityTile.kt+++ /dev/null@@ -1,46 +0,0 @@-package com.vayunmathur.weather.ui.components--import androidx.compose.foundation.layout.offset-import androidx.compose.material3.ExperimentalMaterial3ExpressiveApi-import androidx.compose.material3.MaterialShapes-import androidx.compose.material3.MaterialTheme-import androidx.compose.material3.Text-import androidx.compose.material3.toShape-import androidx.compose.runtime.Composable-import androidx.compose.ui.Alignment-import androidx.compose.ui.Modifier-import androidx.compose.ui.unit.dp-import com.vayunmathur.weather.R-import com.vayunmathur.weather.util.TemperatureUnit-import com.vayunmathur.weather.util.formatTemperatureCompact--@OptIn(ExperimentalMaterial3ExpressiveApi::class)-@Composable-fun HumidityBlock(-    relativeHumidity: Int,-    dewPointCelsius: Double,-    tempUnit: TemperatureUnit,-    modifier: Modifier = Modifier,-) {-    WeatherBlock(-        title = "Humidity",-        iconRes = R.drawable.outline_drizzle_24,-        modifier = modifier,-        shape = MaterialShapes.Cookie12Sided.toShape(),-        containerColor = MaterialTheme.colorScheme.surfaceContainerHigh,-        contentColor = MaterialTheme.colorScheme.onSurface,-    ) {-        Text(-            "$relativeHumidity%",-            style = MaterialTheme.typography.displayMedium,-            color = MaterialTheme.colorScheme.onSurface,-            modifier = Modifier.align(Alignment.Center).offset(y = 4.dp),-        )-        Text(-            "Dew point ${formatTemperatureCompact(dewPointCelsius, tempUnit)}",-            style = MaterialTheme.typography.bodyMedium,-            color = MaterialTheme.colorScheme.onSurfaceVariant,-            modifier = Modifier.align(Alignment.BottomCenter).offset(y = (-20).dp),-        )-    }-}
weather/src/main/java/com/vayunmathur/weather/ui/components/LocationItem.kt
diff --git a/weather/src/main/java/com/vayunmathur/weather/ui/components/LocationItem.kt b/weather/src/main/java/com/vayunmathur/weather/ui/components/LocationItem.ktnew file mode 100644index 0000000000..498763c85d--- /dev/null+++ b/weather/src/main/java/com/vayunmathur/weather/ui/components/LocationItem.kt@@ -0,0 +1,99 @@+package com.vayunmathur.weather.ui.components++import androidx.compose.foundation.ExperimentalFoundationApi+import androidx.compose.foundation.background+import androidx.compose.foundation.combinedClickable+import androidx.compose.foundation.layout.Box+import androidx.compose.foundation.layout.size+import androidx.compose.foundation.shape.CircleShape+import androidx.compose.foundation.shape.RoundedCornerShape+import androidx.compose.material3.ExperimentalMaterial3Api+import androidx.compose.material3.Icon+import androidx.compose.material3.ListItem+import androidx.compose.material3.ListItemDefaults+import androidx.compose.material3.MaterialTheme+import androidx.compose.material3.Surface+import androidx.compose.material3.Text+import androidx.compose.runtime.Composable+import androidx.compose.ui.Alignment+import androidx.compose.ui.Modifier+import androidx.compose.ui.draw.clip+import androidx.compose.ui.res.painterResource+import androidx.compose.ui.unit.dp+import com.vayunmathur.weather.R+import com.vayunmathur.weather.data.SavedLocation+import com.vayunmathur.weather.util.WeatherCondition+import com.vayunmathur.weather.util.weatherConditionForCode++/**+ * Direct port of WeatherMaster's `LocationItem`. Pill or extraLarge+ * `Surface` (selected = extraLarge + primaryContainer; otherwise =+ * CircleShape + surfaceBright). `combinedClickable` on the surface for+ * tap (select) + long-press (open delete sheet). Leading: 52 dp+ * `surfaceContainer` circle with a weather icon. Trailing: small device+ * marker icon when this row is the device-location row.+ */+@OptIn(ExperimentalMaterial3Api::class, ExperimentalFoundationApi::class)+@Composable+fun LocationItem(+    location: SavedLocation,+    description: String,+    currentWeatherCode: Int?,+    isDay: Boolean,+    isSelected: Boolean,+    onClick: () -> Unit,+    onLongClick: () -> Unit,+) {+    val containerColor =+        if (isSelected) MaterialTheme.colorScheme.primaryContainer+        else MaterialTheme.colorScheme.surfaceBright+    val contentColor =+        if (isSelected) MaterialTheme.colorScheme.onPrimaryContainer+        else MaterialTheme.colorScheme.onSurface+    val shape = if (isSelected) RoundedCornerShape(28.dp) else CircleShape++    val condition = currentWeatherCode?.let { weatherConditionForCode(it) } ?: WeatherCondition.Unknown++    Surface(+        modifier = Modifier+            .clip(shape)+            .combinedClickable(onClick = onClick, onLongClick = onLongClick),+        shape = shape,+        color = containerColor,+    ) {+        ListItem(+            colors = ListItemDefaults.colors(containerColor = containerColor),+            leadingContent = {+                Box(+                    modifier = Modifier+                        .size(52.dp)+                        .background(MaterialTheme.colorScheme.surfaceContainer, shape = CircleShape),+                    contentAlignment = Alignment.Center,+                ) {+                    WeatherIconBox(+                        iconRes = condition.iconRes(isDay),+                        size = 34.dp,+                        tint = contentColor,+                    )+                }+            },+            headlineContent = { Text(location.name, color = contentColor) },+            supportingContent = {+                Text(+                    description,+                    color = if (isSelected) MaterialTheme.colorScheme.onPrimaryContainer.copy(alpha = 0.8f)+                    else MaterialTheme.colorScheme.onSurfaceVariant,+                )+            },+            trailingContent = {+                if (location.isCurrent) {+                    Icon(+                        painter = painterResource(R.drawable.outline_my_location_24),+                        contentDescription = "Current device location",+                        tint = contentColor,+                    )+                }+            },+        )+    }+}
weather/src/main/java/com/vayunmathur/weather/ui/components/MainSearchBar.kt
diff --git a/weather/src/main/java/com/vayunmathur/weather/ui/components/MainSearchBar.kt b/weather/src/main/java/com/vayunmathur/weather/ui/components/MainSearchBar.ktnew file mode 100644index 0000000000..aba06ecfa3--- /dev/null+++ b/weather/src/main/java/com/vayunmathur/weather/ui/components/MainSearchBar.kt@@ -0,0 +1,114 @@+package com.vayunmathur.weather.ui.components++import androidx.compose.foundation.clickable+import androidx.compose.foundation.layout.PaddingValues+import androidx.compose.foundation.layout.Row+import androidx.compose.foundation.layout.Spacer+import androidx.compose.foundation.layout.fillMaxWidth+import androidx.compose.foundation.layout.height+import androidx.compose.foundation.layout.padding+import androidx.compose.foundation.layout.width+import androidx.compose.foundation.shape.CircleShape+import androidx.compose.material3.DrawerState+import androidx.compose.material3.ExperimentalMaterial3Api+import androidx.compose.material3.Icon+import androidx.compose.material3.IconButton+import androidx.compose.material3.MaterialTheme+import androidx.compose.material3.Surface+import androidx.compose.material3.Text+import androidx.compose.runtime.Composable+import androidx.compose.runtime.rememberCoroutineScope+import androidx.compose.ui.Alignment+import androidx.compose.ui.Modifier+import androidx.compose.ui.res.painterResource+import androidx.compose.ui.text.style.TextOverflow+import androidx.compose.ui.unit.dp+import com.vayunmathur.library.R as LibraryR+import com.vayunmathur.library.util.NavBackStack+import com.vayunmathur.weather.R+import com.vayunmathur.weather.Route+import com.vayunmathur.weather.data.SavedLocation+import kotlinx.coroutines.launch++/**+ * Direct port of WeatherMaster's `MainSearchBar` — a 56 dp `CircleShape`+ * pill `Surface` with a hamburger icon, the active location's name in the+ * middle, and a settings icon at the right. The whole surface is also+ * clickable to toggle the drawer (matching WeatherMaster's+ * tap-anywhere-to-open behavior).+ */+@OptIn(ExperimentalMaterial3Api::class)+@Composable+fun MainSearchBar(+    paddingValues: PaddingValues,+    drawerState: DrawerState,+    activeLocation: SavedLocation?,+    backStack: NavBackStack<Route>,+) {+    val scope = rememberCoroutineScope()+    val toggleDrawer = {+        scope.launch {+            drawerState.apply { if (isClosed) open() else close() }+        }+        Unit+    }+    val locationText = activeLocation?.let { loc ->+        buildString {+            append(loc.name)+            if (loc.country.isNotBlank()) {+                append(", "); append(loc.country)+            }+        }+    } ?: "••••"++    Surface(+        color = getSearchBarColor(),+        shape = CircleShape,+        shadowElevation = 1.dp,+        modifier = Modifier+            .padding(+                top = paddingValues.calculateTopPadding() + 8.dp,+                start = 16.dp,+                end = 16.dp,+            )+            .fillMaxWidth()+            .clickable { toggleDrawer() },+    ) {+        Row(+            modifier = Modifier+                .height(56.dp)+                .fillMaxWidth()+                .padding(horizontal = 4.dp),+            verticalAlignment = Alignment.CenterVertically,+        ) {+            IconButton(onClick = { toggleDrawer() }) {+                Icon(+                    painter = painterResource(LibraryR.drawable.baseline_menu_24),+                    contentDescription = "Show locations menu",+                    tint = MaterialTheme.colorScheme.onSurfaceVariant,+                )+            }+            Spacer(Modifier.width(4.dp))+            Text(+                text = locationText,+                color = MaterialTheme.colorScheme.onSurfaceVariant,+                style = MaterialTheme.typography.bodyLarge,+                modifier = Modifier.weight(1f),+                maxLines = 1,+                overflow = TextOverflow.Ellipsis,+            )+            Spacer(Modifier.width(4.dp))+            IconButton(onClick = { backStack.add(Route.Settings) }) {+                Icon(+                    painter = painterResource(LibraryR.drawable.settings_24px),+                    contentDescription = "Settings",+                    tint = MaterialTheme.colorScheme.onSurfaceVariant,+                )+            }+        }+    }+}++@Composable+private fun getSearchBarColor() =+    MaterialTheme.colorScheme.surface.copy(alpha = 0.4f)
weather/src/main/java/com/vayunmathur/weather/ui/components/MetricBlobGrid.kt
diff --git a/weather/src/main/java/com/vayunmathur/weather/ui/components/MetricBlobGrid.kt b/weather/src/main/java/com/vayunmathur/weather/ui/components/MetricBlobGrid.ktdeleted file mode 100644index 7eebe8b688..0000000000--- a/weather/src/main/java/com/vayunmathur/weather/ui/components/MetricBlobGrid.kt+++ /dev/null@@ -1,110 +0,0 @@-package com.vayunmathur.weather.ui.components--import androidx.compose.foundation.layout.Arrangement-import androidx.compose.foundation.layout.Box-import androidx.compose.foundation.layout.PaddingValues-import androidx.compose.foundation.layout.fillMaxSize-import androidx.compose.foundation.layout.fillMaxWidth-import androidx.compose.foundation.layout.heightIn-import androidx.compose.foundation.layout.padding-import androidx.compose.foundation.lazy.grid.GridCells-import androidx.compose.foundation.lazy.grid.LazyVerticalGrid-import androidx.compose.foundation.lazy.grid.items-import androidx.compose.foundation.lazy.grid.rememberLazyGridState-import androidx.compose.runtime.Composable-import androidx.compose.runtime.LaunchedEffect-import androidx.compose.runtime.collectAsState-import androidx.compose.runtime.getValue-import androidx.compose.runtime.mutableStateListOf-import androidx.compose.runtime.remember-import androidx.compose.ui.Modifier-import androidx.compose.ui.unit.dp-import com.vayunmathur.weather.network.AirQualityCurrent-import com.vayunmathur.weather.network.Current-import com.vayunmathur.weather.network.Daily-import com.vayunmathur.weather.util.TemperatureUnit-import com.vayunmathur.weather.util.WeatherTile-import com.vayunmathur.weather.util.WeatherViewModel-import com.vayunmathur.weather.util.WindUnit-import sh.calvin.reorderable.DragGestureDetector-import sh.calvin.reorderable.ReorderableItem-import sh.calvin.reorderable.rememberReorderableLazyGridState--/**- * Adaptive grid of WeatherMaster-style cookie blocks, draggable via- * `sh.calvin.reorderable` long-press. Mirrors WeatherMaster's `WeatherBlocks`- * layout: `GridCells.Adaptive(140.dp)`, 14dp spacing, `userScrollEnabled = false`,- * `heightIn(max = 1500.dp)` so the grid plays nicely inside the parent- * vertical `LazyColumn`.- */-@Composable-fun WeatherBlocksGrid(-    current: Current,-    today: Daily?,-    air: AirQualityCurrent?,-    sunriseEpochSec: Long?,-    sunsetEpochSec: Long?,-    tempUnit: TemperatureUnit,-    windUnit: WindUnit,-    viewModel: WeatherViewModel,-    modifier: Modifier = Modifier,-) {-    val savedOrder by viewModel.tileOrder.collectAsState()-    val items = remember(savedOrder) { mutableStateListOf<WeatherTile>().apply { addAll(savedOrder) } }-    LaunchedEffect(savedOrder) {-        if (items.toList() != savedOrder) {-            items.clear(); items.addAll(savedOrder)-        }-    }--    val gridState = rememberLazyGridState()-    val reorderableState = rememberReorderableLazyGridState(gridState) { from, to ->-        items.add(to.index, items.removeAt(from.index))-        viewModel.setTileOrder(items.toList())-    }--    LazyVerticalGrid(-        state = gridState,-        columns = GridCells.Adaptive(minSize = 140.dp),-        modifier = modifier-            .fillMaxWidth()-            .padding(horizontal = 24.dp)-            .heightIn(max = 1500.dp),-        horizontalArrangement = Arrangement.spacedBy(16.dp),-        verticalArrangement = Arrangement.spacedBy(16.dp),-        contentPadding = PaddingValues(bottom = 8.dp),-        userScrollEnabled = false,-    ) {-        items(items = items, key = { it.name }) { tile ->-            ReorderableItem(reorderableState, key = tile.name) {-                Box(-                    modifier = Modifier-                        .fillMaxWidth()-                        .draggableHandle(dragGestureDetector = DragGestureDetector.LongPress),-                ) {-                    when (tile) {-                        WeatherTile.AirQuality -> AirQualityBlock(aqi = air?.usAqi)-                        WeatherTile.Sun -> SunBlock(-                            sunriseEpochSec = sunriseEpochSec,-                            sunsetEpochSec = sunsetEpochSec,-                        )-                        WeatherTile.Visibility -> VisibilityBlock(visibilityMeters = current.visibility)-                        WeatherTile.Pressure -> PressureBlock(pressureHpa = current.pressureMsl)-                        WeatherTile.Humidity -> HumidityBlock(-                            relativeHumidity = current.relativeHumidity,-                            dewPointCelsius = current.dewPoint,-                            tempUnit = tempUnit,-                        )-                        WeatherTile.Pollen -> PollenBlock(air = air)-                        WeatherTile.UV -> UVBlock(uvIndex = today?.uvIndexMax?.firstOrNull())-                        WeatherTile.Wind -> WindBlock(-                            speedKph = current.windSpeed,-                            directionDeg = current.windDirection,-                            unit = windUnit,-                        )-                    }-                }-            }-        }-    }-}
weather/src/main/java/com/vayunmathur/weather/ui/components/PollenTile.kt
diff --git a/weather/src/main/java/com/vayunmathur/weather/ui/components/PollenTile.kt b/weather/src/main/java/com/vayunmathur/weather/ui/components/PollenTile.ktdeleted file mode 100644index 42bde942a6..0000000000--- a/weather/src/main/java/com/vayunmathur/weather/ui/components/PollenTile.kt+++ /dev/null@@ -1,62 +0,0 @@-package com.vayunmathur.weather.ui.components--import androidx.compose.foundation.layout.offset-import androidx.compose.material3.ExperimentalMaterial3ExpressiveApi-import androidx.compose.material3.MaterialShapes-import androidx.compose.material3.MaterialTheme-import androidx.compose.material3.Text-import androidx.compose.material3.toShape-import androidx.compose.runtime.Composable-import androidx.compose.ui.Alignment-import androidx.compose.ui.Modifier-import androidx.compose.ui.unit.dp-import com.vayunmathur.weather.R-import com.vayunmathur.weather.network.AirQualityCurrent--@OptIn(ExperimentalMaterial3ExpressiveApi::class)-@Composable-fun PollenBlock(air: AirQualityCurrent?, modifier: Modifier = Modifier) {-    val worst = listOfNotNull(-        air?.grassPollen,-        air?.alderPollen,-        air?.birchPollen,-        air?.olivePollen,-        air?.ragweedPollen,-        air?.mugwortPollen,-    ).maxOrNull() ?: 0.0-    val level = when {-        worst <= 0.0 -> 0-        worst < 10 -> 1-        worst < 50 -> 2-        worst < 200 -> 3-        else -> 4-    }-    val label = when (level) {-        0 -> "None"-        1 -> "Low"-        2 -> "Medium"-        3 -> "High"-        else -> "Severe"-    }-    WeatherBlock(-        title = "Pollen",-        iconRes = R.drawable.outline_grass_24,-        modifier = modifier,-        shape = MaterialShapes.Cookie12Sided.toShape(),-        containerColor = MaterialTheme.colorScheme.errorContainer,-        contentColor = MaterialTheme.colorScheme.onErrorContainer,-    ) {-        Text(-            "$level/4",-            style = MaterialTheme.typography.displayMedium,-            color = MaterialTheme.colorScheme.onErrorContainer,-            modifier = Modifier.align(Alignment.Center).offset(y = 4.dp),-        )-        Text(-            label,-            style = MaterialTheme.typography.bodyMedium,-            color = MaterialTheme.colorScheme.onErrorContainer.copy(alpha = 0.75f),-            modifier = Modifier.align(Alignment.BottomCenter).offset(y = (-20).dp),-        )-    }-}
weather/src/main/java/com/vayunmathur/weather/ui/components/PrecipChart.kt
diff --git a/weather/src/main/java/com/vayunmathur/weather/ui/components/PrecipChart.kt b/weather/src/main/java/com/vayunmathur/weather/ui/components/PrecipChart.ktdeleted file mode 100644index 59cc488812..0000000000--- a/weather/src/main/java/com/vayunmathur/weather/ui/components/PrecipChart.kt+++ /dev/null@@ -1,88 +0,0 @@-package com.vayunmathur.weather.ui.components--import androidx.compose.foundation.Canvas-import androidx.compose.foundation.layout.Arrangement-import androidx.compose.foundation.layout.PaddingValues-import androidx.compose.foundation.layout.Row-import androidx.compose.foundation.layout.fillMaxWidth-import androidx.compose.foundation.layout.height-import androidx.compose.foundation.layout.padding-import androidx.compose.material3.MaterialTheme-import androidx.compose.material3.Text-import androidx.compose.runtime.Composable-import androidx.compose.ui.Modifier-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.weather.network.Hourly-import kotlin.time.Instant--/**- * 24-hour precipitation-probability bars inside a [WeatherSection]. Bars get- * more opaque as the chance climbs so a quick glance shows the rainy- * stretch.- */-@Composable-fun PrecipChart(hourly: Hourly) {-    if (hourly.precipitationProbability.isEmpty()) return-    val nowSec = System.currentTimeMillis() / 1000-    val pairs: List<Int> = hourly.time-        .withIndex()-        .mapNotNull { (i, t) ->-            val ts = runCatching { Instant.parse("$t:00Z").epochSeconds }.getOrNull()-                ?: runCatching { Instant.parse(t).epochSeconds }.getOrNull()-                ?: return@mapNotNull null-            if (ts < nowSec - 3600) null else hourly.precipitationProbability.getOrNull(i)-        }-        .filterNotNull()-        .take(24)-    if (pairs.isEmpty() || pairs.max() == 0) return--    val barColor = MaterialTheme.colorScheme.onSurface-    val trackColor = MaterialTheme.colorScheme.surfaceContainerHighest--    WeatherSection(title = "Precipitation", surfacePadding = PaddingValues(16.dp)) {-        Text(-            "Max ${pairs.max()}% in the next 24 hours",-            style = MaterialTheme.typography.bodyMedium,-            color = MaterialTheme.colorScheme.onSurface,-        )-        Canvas(-            modifier = Modifier-                .fillMaxWidth()-                .height(72.dp)-                .padding(top = 12.dp),-        ) {-            val w = size.width-            val h = size.height-            val n = pairs.size-            val barW = w / n-            drawRoundRect(-                color = trackColor,-                topLeft = Offset(0f, h - 2.dp.toPx()),-                size = Size(w, 2.dp.toPx()),-                cornerRadius = CornerRadius(1.dp.toPx()),-            )-            pairs.forEachIndexed { i, p ->-                val frac = p / 100f-                val barH = h * frac-                val alpha = (0.30f + 0.65f * frac).coerceAtMost(1f)-                drawRoundRect(-                    color = barColor.copy(alpha = alpha),-                    topLeft = Offset(i * barW + barW * 0.20f, h - barH),-                    size = Size(barW * 0.6f, barH),-                    cornerRadius = CornerRadius(2.dp.toPx()),-                )-            }-        }-        Row(-            modifier = Modifier.fillMaxWidth().padding(top = 6.dp),-            horizontalArrangement = Arrangement.SpaceBetween,-        ) {-            Text("NOW", style = MaterialTheme.typography.labelSmall, color = MaterialTheme.colorScheme.onSurfaceVariant)-            Text("12H", style = MaterialTheme.typography.labelSmall, color = MaterialTheme.colorScheme.onSurfaceVariant)-            Text("24H", style = MaterialTheme.typography.labelSmall, color = MaterialTheme.colorScheme.onSurfaceVariant)-        }-    }-}
weather/src/main/java/com/vayunmathur/weather/ui/components/PressureTile.kt
diff --git a/weather/src/main/java/com/vayunmathur/weather/ui/components/PressureTile.kt b/weather/src/main/java/com/vayunmathur/weather/ui/components/PressureTile.ktdeleted file mode 100644index 79622e811b..0000000000--- a/weather/src/main/java/com/vayunmathur/weather/ui/components/PressureTile.kt+++ /dev/null@@ -1,39 +0,0 @@-package com.vayunmathur.weather.ui.components--import androidx.compose.foundation.layout.offset-import androidx.compose.foundation.shape.CircleShape-import androidx.compose.material3.ExperimentalMaterial3ExpressiveApi-import androidx.compose.material3.MaterialTheme-import androidx.compose.material3.Text-import androidx.compose.runtime.Composable-import androidx.compose.ui.Alignment-import androidx.compose.ui.Modifier-import androidx.compose.ui.unit.dp-import com.vayunmathur.weather.R--@OptIn(ExperimentalMaterial3ExpressiveApi::class)-@Composable-fun PressureBlock(pressureHpa: Double, modifier: Modifier = Modifier) {-    val inHg = pressureHpa * 0.02953-    WeatherBlock(-        title = "Pressure",-        iconRes = R.drawable.outline_pressure_24,-        modifier = modifier,-        shape = CircleShape,-        containerColor = MaterialTheme.colorScheme.surfaceContainerHigh,-        contentColor = MaterialTheme.colorScheme.onSurface,-    ) {-        Text(-            String.format("%.2f", inHg),-            style = MaterialTheme.typography.displaySmall,-            color = MaterialTheme.colorScheme.onSurface,-            modifier = Modifier.align(Alignment.Center).offset(y = 4.dp),-        )-        Text(-            "inHg",-            style = MaterialTheme.typography.bodyMedium,-            color = MaterialTheme.colorScheme.onSurfaceVariant,-            modifier = Modifier.align(Alignment.BottomCenter).offset(y = (-20).dp),-        )-    }-}
weather/src/main/java/com/vayunmathur/weather/ui/components/SummaryCard.kt
diff --git a/weather/src/main/java/com/vayunmathur/weather/ui/components/SummaryCard.kt b/weather/src/main/java/com/vayunmathur/weather/ui/components/SummaryCard.ktnew file mode 100644index 0000000000..7738061cde--- /dev/null+++ b/weather/src/main/java/com/vayunmathur/weather/ui/components/SummaryCard.kt@@ -0,0 +1,43 @@+package com.vayunmathur.weather.ui.components++import androidx.compose.foundation.layout.Column+import androidx.compose.foundation.layout.Spacer+import androidx.compose.foundation.layout.fillMaxWidth+import androidx.compose.foundation.layout.height+import androidx.compose.foundation.layout.padding+import androidx.compose.material3.MaterialTheme+import androidx.compose.material3.Surface+import androidx.compose.material3.Text+import androidx.compose.runtime.Composable+import androidx.compose.ui.Modifier+import androidx.compose.ui.unit.dp+import com.vayunmathur.weather.R+import com.vayunmathur.weather.network.ForecastResponse+import com.vayunmathur.weather.util.TemperatureUnit+import com.vayunmathur.weather.util.computeDaySummary++/**+ * Port of WeatherMaster's `SummaryCard`. `Surface(shape = extraLarge,+ * color = surface, shadowElevation = 2.dp)` containing a [CardsHeader] and+ * a body Text generated by [computeDaySummary].+ */+@Composable+fun SummaryCard(forecast: ForecastResponse, tempUnit: TemperatureUnit) {+    val summary = computeDaySummary(forecast, tempUnit)+    Surface(+        color = MaterialTheme.colorScheme.surface,+        shape = MaterialTheme.shapes.extraLarge,+        shadowElevation = 2.dp,+    ) {+        Column(modifier = Modifier.fillMaxWidth().padding(bottom = 16.dp)) {+            CardsHeader(text = "Summary", iconRes = R.drawable.outline_calendar_24)+            Spacer(Modifier.height(8.dp))+            Text(+                text = summary,+                modifier = Modifier.padding(horizontal = 16.dp),+                style = MaterialTheme.typography.bodyMedium,+                color = MaterialTheme.colorScheme.onSurface,+            )+        }+    }+}
weather/src/main/java/com/vayunmathur/weather/ui/components/SunTile.kt
diff --git a/weather/src/main/java/com/vayunmathur/weather/ui/components/SunTile.kt b/weather/src/main/java/com/vayunmathur/weather/ui/components/SunTile.ktdeleted file mode 100644index 97142018e8..0000000000--- a/weather/src/main/java/com/vayunmathur/weather/ui/components/SunTile.kt+++ /dev/null@@ -1,55 +0,0 @@-package com.vayunmathur.weather.ui.components--import androidx.compose.foundation.layout.offset-import androidx.compose.material3.ExperimentalMaterial3ExpressiveApi-import androidx.compose.material3.MaterialShapes-import androidx.compose.material3.MaterialTheme-import androidx.compose.material3.Text-import androidx.compose.material3.toShape-import androidx.compose.runtime.Composable-import androidx.compose.ui.Alignment-import androidx.compose.ui.Modifier-import androidx.compose.ui.unit.dp-import com.vayunmathur.weather.R-import kotlinx.datetime.TimeZone-import kotlinx.datetime.toLocalDateTime-import kotlin.time.Instant--@OptIn(ExperimentalMaterial3ExpressiveApi::class)-@Composable-fun SunBlock(sunriseEpochSec: Long?, sunsetEpochSec: Long?, modifier: Modifier = Modifier) {-    val sunrise = sunriseEpochSec?.let { formatTime(it) } ?: "—"-    val sunset = sunsetEpochSec?.let { formatTime(it) } ?: "—"-    WeatherBlock(-        title = "Sun",-        iconRes = R.drawable.outline_clear_day_24,-        modifier = modifier,-        shape = MaterialShapes.Cookie12Sided.toShape(),-        containerColor = MaterialTheme.colorScheme.primaryContainer,-        contentColor = MaterialTheme.colorScheme.onPrimaryContainer,-    ) {-        Text(-            sunrise,-            style = MaterialTheme.typography.titleLarge,-            color = MaterialTheme.colorScheme.onPrimaryContainer,-            modifier = Modifier.align(Alignment.Center).offset(y = (-12).dp),-        )-        Text(-            "Sets $sunset",-            style = MaterialTheme.typography.bodyMedium,-            color = MaterialTheme.colorScheme.onPrimaryContainer.copy(alpha = 0.75f),-            modifier = Modifier.align(Alignment.BottomCenter).offset(y = (-20).dp),-        )-    }-}--private fun formatTime(epochSec: Long): String {-    val ldt = Instant.fromEpochSeconds(epochSec)-        .toLocalDateTime(TimeZone.currentSystemDefault())-    val h = ldt.hour-    val m = ldt.minute-    val display = if (h % 12 == 0) 12 else h % 12-    val ampm = if (h < 12) "AM" else "PM"-    val mm = m.toString().padStart(2, '0')-    return "$display:$mm $ampm"-}
weather/src/main/java/com/vayunmathur/weather/ui/components/SunriseSunsetCard.kt
diff --git a/weather/src/main/java/com/vayunmathur/weather/ui/components/SunriseSunsetCard.kt b/weather/src/main/java/com/vayunmathur/weather/ui/components/SunriseSunsetCard.ktdeleted file mode 100644index 9957bab92e..0000000000--- a/weather/src/main/java/com/vayunmathur/weather/ui/components/SunriseSunsetCard.kt+++ /dev/null@@ -1,139 +0,0 @@-package com.vayunmathur.weather.ui.components--import androidx.compose.foundation.Canvas-import androidx.compose.foundation.layout.Arrangement-import androidx.compose.foundation.layout.Box-import androidx.compose.foundation.layout.Column-import androidx.compose.foundation.layout.PaddingValues-import androidx.compose.foundation.layout.Row-import androidx.compose.foundation.layout.fillMaxWidth-import androidx.compose.foundation.layout.height-import androidx.compose.foundation.layout.padding-import androidx.compose.material3.MaterialTheme-import androidx.compose.material3.Text-import androidx.compose.runtime.Composable-import androidx.compose.ui.Alignment-import androidx.compose.ui.Modifier-import androidx.compose.ui.geometry.Offset-import androidx.compose.ui.graphics.Path-import androidx.compose.ui.graphics.PathEffect-import androidx.compose.ui.graphics.drawscope.Stroke-import androidx.compose.ui.text.font.FontWeight-import androidx.compose.ui.unit.dp-import androidx.compose.ui.unit.sp-import kotlinx.datetime.TimeZone-import kotlinx.datetime.toLocalDateTime-import kotlin.math.cos-import kotlin.math.sin-import kotlin.time.Instant--/**- * Sun arc card — dashed full arc track, solid arc + dot up to the current- * moment, sunrise/sunset labels underneath. Sits inside a [WeatherSection].- */-@Composable-fun SunriseSunsetCard(sunriseEpochSec: Long?, sunsetEpochSec: Long?) {-    if (sunriseEpochSec == null || sunsetEpochSec == null || sunsetEpochSec <= sunriseEpochSec) return-    val nowSec = System.currentTimeMillis() / 1000-    val frac = ((nowSec - sunriseEpochSec).toDouble() / (sunsetEpochSec - sunriseEpochSec))-        .coerceIn(0.0, 1.0)-    val isDay = nowSec in sunriseEpochSec..sunsetEpochSec--    val arcColor = MaterialTheme.colorScheme.onSurface-    val trackColor = MaterialTheme.colorScheme.outlineVariant-    val sunColor = MaterialTheme.colorScheme.onSurface--    WeatherSection(title = "Sun", surfacePadding = PaddingValues(16.dp)) {-        Box(modifier = Modifier.fillMaxWidth().height(110.dp)) {-            Canvas(modifier = Modifier.fillMaxWidth().height(110.dp)) {-                val w = size.width-                val h = size.height-                val trackPath = Path().apply {-                    moveTo(0f, h)-                    for (deg in 180..360) {-                        val theta = Math.toRadians(deg.toDouble())-                        val x = (w / 2 + (w / 2) * cos(theta)).toFloat()-                        val y = (h + h * sin(theta)).toFloat()-                        lineTo(x, y)-                    }-                }-                drawPath(-                    trackPath,-                    color = trackColor,-                    style = Stroke(-                        width = 1.5.dp.toPx(),-                        pathEffect = PathEffect.dashPathEffect(floatArrayOf(8f, 8f)),-                    ),-                )-                val activePath = Path().apply {-                    moveTo(0f, h)-                    val endDeg = 180 + 180 * frac-                    var d = 180.0-                    while (d <= endDeg) {-                        val theta = Math.toRadians(d)-                        val x = (w / 2 + (w / 2) * cos(theta)).toFloat()-                        val y = (h + h * sin(theta)).toFloat()-                        lineTo(x, y)-                        d += 1.0-                    }-                }-                drawPath(-                    activePath,-                    color = if (isDay) arcColor else trackColor,-                    style = Stroke(width = 2.5.dp.toPx()),-                )-                val theta = Math.toRadians(180 + 180 * frac)-                val sunX = (w / 2 + (w / 2) * cos(theta)).toFloat()-                val sunY = (h + h * sin(theta)).toFloat()-                drawCircle(-                    color = if (isDay) sunColor else trackColor,-                    radius = 7.dp.toPx(),-                    center = Offset(sunX, sunY),-                )-            }-        }-        Row(-            modifier = Modifier.fillMaxWidth().padding(top = 12.dp),-            horizontalArrangement = Arrangement.SpaceBetween,-        ) {-            Column(verticalArrangement = Arrangement.spacedBy(2.dp)) {-                Text(-                    "SUNRISE",-                    style = MaterialTheme.typography.labelSmall.copy(letterSpacing = 1.sp),-                    color = MaterialTheme.colorScheme.onSurfaceVariant,-                )-                Text(-                    formatTime(sunriseEpochSec),-                    style = MaterialTheme.typography.titleMedium,-                    fontWeight = FontWeight.Medium,-                )-            }-            Column(-                verticalArrangement = Arrangement.spacedBy(2.dp),-                horizontalAlignment = Alignment.End,-            ) {-                Text(-                    "SUNSET",-                    style = MaterialTheme.typography.labelSmall.copy(letterSpacing = 1.sp),-                    color = MaterialTheme.colorScheme.onSurfaceVariant,-                )-                Text(-                    formatTime(sunsetEpochSec),-                    style = MaterialTheme.typography.titleMedium,-                    fontWeight = FontWeight.Medium,-                )-            }-        }-    }-}--private fun formatTime(epochSec: Long): String {-    val ldt = Instant.fromEpochSeconds(epochSec)-        .toLocalDateTime(TimeZone.currentSystemDefault())-    val h = ldt.hour-    val m = ldt.minute-    val display = if (h % 12 == 0) 12 else h % 12-    val ampm = if (h < 12) "AM" else "PM"-    val mm = m.toString().padStart(2, '0')-    return "$display:$mm $ampm"-}
weather/src/main/java/com/vayunmathur/weather/ui/components/UVTile.kt
diff --git a/weather/src/main/java/com/vayunmathur/weather/ui/components/UVTile.kt b/weather/src/main/java/com/vayunmathur/weather/ui/components/UVTile.ktdeleted file mode 100644index 7d9f4203ba..0000000000--- a/weather/src/main/java/com/vayunmathur/weather/ui/components/UVTile.kt+++ /dev/null@@ -1,48 +0,0 @@-package com.vayunmathur.weather.ui.components--import androidx.compose.foundation.layout.offset-import androidx.compose.material3.ExperimentalMaterial3ExpressiveApi-import androidx.compose.material3.MaterialShapes-import androidx.compose.material3.MaterialTheme-import androidx.compose.material3.Text-import androidx.compose.material3.toShape-import androidx.compose.runtime.Composable-import androidx.compose.ui.Alignment-import androidx.compose.ui.Modifier-import androidx.compose.ui.unit.dp-import com.vayunmathur.weather.R--@OptIn(ExperimentalMaterial3ExpressiveApi::class)-@Composable-fun UVBlock(uvIndex: Double?, modifier: Modifier = Modifier) {-    val v = uvIndex?.let { it.toInt() }-    val label = when {-        v == null -> "—"-        v < 3 -> "Low"-        v < 6 -> "Moderate"-        v < 8 -> "High"-        v < 11 -> "Very high"-        else -> "Extreme"-    }-    WeatherBlock(-        title = "UV index",-        iconRes = R.drawable.outline_clear_day_24,-        modifier = modifier,-        shape = MaterialShapes.Sunny.toShape(),-        containerColor = MaterialTheme.colorScheme.tertiaryContainer,-        contentColor = MaterialTheme.colorScheme.onTertiaryContainer,-    ) {-        Text(-            v?.toString() ?: "—",-            style = MaterialTheme.typography.displayMedium,-            color = MaterialTheme.colorScheme.onTertiaryContainer,-            modifier = Modifier.align(Alignment.Center).offset(y = 4.dp),-        )-        Text(-            label,-            style = MaterialTheme.typography.bodyMedium,-            color = MaterialTheme.colorScheme.onTertiaryContainer.copy(alpha = 0.75f),-            modifier = Modifier.align(Alignment.BottomCenter).offset(y = (-20).dp),-        )-    }-}
weather/src/main/java/com/vayunmathur/weather/ui/components/UseDeviceLocationCard.kt
diff --git a/weather/src/main/java/com/vayunmathur/weather/ui/components/UseDeviceLocationCard.kt b/weather/src/main/java/com/vayunmathur/weather/ui/components/UseDeviceLocationCard.kt

Diff truncated.