astronomy: fix all lint findings
- Commit
924c2e3afc448d782217b45af6436fbbba9da55d- Author
- Vayun Mathur <[email protected]>
- When
- 2026-11-17 04:58 UTC (19 days ago)
- Parents
bb21c03
Fix every lint warning reported for the astronomy module's own sources by :astronomy:lintDev, now 0 errors / 0 warnings for astronomy/** (remaining report entries are transitive library findings owned by other clusters). OneComposablePerFile: SearchScreen, SettingsScreen and SkyMapScreen moved out of their *Page.kt files into own files named as the composable; the private BoxScope.HistoryScrubber helper SkyMapScreen uses became internal, as did the Float.format helper that moved with SettingsScreen. UnusedResources: deleted the verified-unused search_1 and show_below_horizon_all_sky strings from the default locale and all six locale files (no code or dynamic getIdentifier lookup references them). NotificationPermission: added POST_NOTIFICATIONS to the manifest — the app posts notifications via the shared MaNotifications helper. No @SuppressLint added; no lint config or baseline changed. Verified: ./gradlew :astronomy:lintDev (0 own-module errors/warnings) and :astronomy:testDevUnitTest green.
Diff
astronomy/src/main/AndroidManifest.xml
diff --git a/astronomy/src/main/AndroidManifest.xml b/astronomy/src/main/AndroidManifest.xmlindex a89c31e951..b23193bc60 100644--- a/astronomy/src/main/AndroidManifest.xml+++ b/astronomy/src/main/AndroidManifest.xml@@ -5,6 +5,7 @@ <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android:name="android.permission.CAMERA" />+ <uses-permission android:name="android.permission.POST_NOTIFICATIONS" /> <uses-feature android:name="android.hardware.camera" android:required="false" /> <uses-feature android:name="android.hardware.camera.autofocus" android:required="false" />
astronomy/src/main/java/com/vayunmathur/astronomy/ui/SearchPage.kt
diff --git a/astronomy/src/main/java/com/vayunmathur/astronomy/ui/SearchPage.kt b/astronomy/src/main/java/com/vayunmathur/astronomy/ui/SearchPage.ktindex e3219ac024..3acee22400 100644--- a/astronomy/src/main/java/com/vayunmathur/astronomy/ui/SearchPage.kt+++ b/astronomy/src/main/java/com/vayunmathur/astronomy/ui/SearchPage.kt@@ -39,54 +39,3 @@ fun SearchPage(backStack: NavBackStack<Route>, viewModel: AstronomyViewModel) { SearchScreen(backStack = backStack, actions = viewModel) } -/**- * The catalog search screen, with no dependency on the ViewModel so it can be rendered- * from a `@Preview` — see `src/screenshotTest`, which is where the store listing images- * come from.- */-@Composable-fun SearchScreen(- backStack: NavBackStack<Route>,- actions: SearchActions,- /**- * Seed for the screen's own UI-only state (what is typed in the box). The app always- * takes the default; a preview sets it to capture a screen with results on it.- */- initialQuery: String = "",-) {- var query by remember { mutableStateOf(initialQuery) }- var results by remember { mutableStateOf(actions.search(initialQuery)) }-- // Letterbox the single results column on expanded windows; the sky map- // itself stays full-bleed by design.- DesktopMaxWidthContainer {- Column(Modifier.fillMaxSize().statusBarsPadding().padding(top = 56.dp).padding(12.dp)) {- OutlinedTextField(value = query, onValueChange = { query = it; results = actions.search(it) }, label = { Text(stringResource(R.string.search_stars_planets_messier)) }, modifier = Modifier.fillMaxWidth())- Spacer(Modifier.height(8.dp))- LazyColumn(verticalArrangement = Arrangement.spacedBy(4.dp)) {- items(results) { r ->- ListItem(- headlineContent = { Text(r.title) },- supportingContent = { Text(r.subtitle) },- trailingContent = { IconChevronRight() },- modifier = Modifier.clickable {- if (!r.id.startsWith("CONST_")) {- actions.selectObject(r.id)- // Drop the search page from the stack so back from the- // detail page returns straight to the sky map.- backStack.pop()- backStack.add(Route.ObjectDetail(r.id))- }- }- )- HorizontalDivider()- }- }- }-- TopAppBarOverlay(- modifier = Modifier.align(Alignment.TopCenter),- onNavigateBack = { backStack.pop() },- )- }-}
astronomy/src/main/java/com/vayunmathur/astronomy/ui/SearchScreen.kt
diff --git a/astronomy/src/main/java/com/vayunmathur/astronomy/ui/SearchScreen.kt b/astronomy/src/main/java/com/vayunmathur/astronomy/ui/SearchScreen.ktnew file mode 100644index 0000000000..7c687b374d--- /dev/null+++ b/astronomy/src/main/java/com/vayunmathur/astronomy/ui/SearchScreen.kt@@ -0,0 +1,85 @@+package com.vayunmathur.astronomy.ui+import androidx.compose.foundation.clickable+import androidx.compose.foundation.layout.Arrangement+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.statusBarsPadding+import androidx.compose.foundation.lazy.LazyColumn+import androidx.compose.foundation.lazy.items+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.ui.Alignment+import androidx.compose.ui.Modifier+import androidx.compose.ui.unit.dp+import com.vayunmathur.astronomy.R+import com.vayunmathur.astronomy.Route+import com.vayunmathur.astronomy.platform.AstronomyViewModel+import com.vayunmathur.astronomy.platform.SearchActions+import com.vayunmathur.library.ui.DesktopMaxWidthContainer+import com.vayunmathur.library.ui.HorizontalDivider+import com.vayunmathur.library.ui.IconChevronRight+import com.vayunmathur.library.ui.ListItem+import com.vayunmathur.library.ui.OutlinedTextField+import com.vayunmathur.library.ui.Text+import com.vayunmathur.library.ui.TopAppBarOverlay+import com.vayunmathur.library.util.NavBackStack+import androidx.compose.ui.res.stringResource++/**+ * The catalog search screen, with no dependency on the ViewModel so it can be rendered+ * from a `@Preview` — see `src/screenshotTest`, which is where the store listing images+ * come from.+ */+@Composable+fun SearchScreen(+ backStack: NavBackStack<Route>,+ actions: SearchActions,+ /**+ * Seed for the screen's own UI-only state (what is typed in the box). The app always+ * takes the default; a preview sets it to capture a screen with results on it.+ */+ initialQuery: String = "",+) {+ var query by remember { mutableStateOf(initialQuery) }+ var results by remember { mutableStateOf(actions.search(initialQuery)) }++ // Letterbox the single results column on expanded windows; the sky map+ // itself stays full-bleed by design.+ DesktopMaxWidthContainer {+ Column(Modifier.fillMaxSize().statusBarsPadding().padding(top = 56.dp).padding(12.dp)) {+ OutlinedTextField(value = query, onValueChange = { query = it; results = actions.search(it) }, label = { Text(stringResource(R.string.search_stars_planets_messier)) }, modifier = Modifier.fillMaxWidth())+ Spacer(Modifier.height(8.dp))+ LazyColumn(verticalArrangement = Arrangement.spacedBy(4.dp)) {+ items(results) { r ->+ ListItem(+ headlineContent = { Text(r.title) },+ supportingContent = { Text(r.subtitle) },+ trailingContent = { IconChevronRight() },+ modifier = Modifier.clickable {+ if (!r.id.startsWith("CONST_")) {+ actions.selectObject(r.id)+ // Drop the search page from the stack so back from the+ // detail page returns straight to the sky map.+ backStack.pop()+ backStack.add(Route.ObjectDetail(r.id))+ }+ }+ )+ HorizontalDivider()+ }+ }+ }++ TopAppBarOverlay(+ modifier = Modifier.align(Alignment.TopCenter),+ onNavigateBack = { backStack.pop() },+ )+ }+}
astronomy/src/main/java/com/vayunmathur/astronomy/ui/SettingsPage.kt
diff --git a/astronomy/src/main/java/com/vayunmathur/astronomy/ui/SettingsPage.kt b/astronomy/src/main/java/com/vayunmathur/astronomy/ui/SettingsPage.ktindex a8243222fd..4b78ffcd6c 100644--- a/astronomy/src/main/java/com/vayunmathur/astronomy/ui/SettingsPage.kt+++ b/astronomy/src/main/java/com/vayunmathur/astronomy/ui/SettingsPage.kt@@ -73,80 +73,4 @@ fun SettingsPage(backStack: NavBackStack<Route>, viewModel: AstronomyViewModel) ) } -/**- * The settings screen, with no dependency on the ViewModel so it can be rendered from a- * `@Preview` — see `src/screenshotTest`, which is where the store listing images come from.- */-@Composable-fun SettingsScreen(backStack: NavBackStack<Route>, state: SettingsUiState, actions: SettingsActions) {- var latText by remember(state.latDeg) { mutableStateOf(state.latDeg?.toString() ?: "") }- var lonText by remember(state.lonDeg) { mutableStateOf(state.lonDeg?.toString() ?: "") }-- val offLabel = stringResource(R.string.off)- val linesLabel = stringResource(R.string.lines_only)- val linesArtLabel = stringResource(R.string.lines_art)-- AppScaffold(title = stringResource(R.string.settings), onNavigateBack = { backStack.pop() }, scrollBehavior = appBarScrollBehavior()) { padding ->- // Letterboxed on expanded windows so the form keeps a readable measure.- DesktopMaxWidthContainer(Modifier.padding(padding)) {- Column(Modifier.fillMaxSize().verticalScroll(rememberScrollState())) {- SettingsSection(title = stringResource(R.string.display)) {- SettingsSelectRow(- title = stringResource(R.string.constellations),- selected = state.constellationMode,- options = listOf(ConstellationMode.OFF, ConstellationMode.LINES, ConstellationMode.LINES_AND_ART),- label = {- when (it) {- ConstellationMode.OFF -> offLabel- ConstellationMode.LINES -> linesLabel- ConstellationMode.LINES_AND_ART -> linesArtLabel- }- },- onSelect = { actions.setShowConstellations(it) },- )- SettingsSwitchRow(title = stringResource(R.string.coordinate_grid_whole_sphere), checked = state.showGrid, onCheckedChange = { actions.setShowGrid(it) })- SettingsSwitchRow(title = stringResource(R.string.show_deep_sky), checked = state.showDeepSky, onCheckedChange = { actions.setShowDeepSky(it) })- SettingsSwitchRow(title = stringResource(R.string.planets_sun_moon), checked = state.showPlanets, onCheckedChange = { actions.setShowPlanets(it) })- // No below-horizon switch here: the sky deliberately- // always renders the full sphere (see ViewModel /- // projection comments), and the old switch changed- // nothing on the sky — it only persisted a flag.- SettingsSwitchRow(title = stringResource(R.string.night_mode), checked = state.nightMode, onCheckedChange = { actions.setNightMode(it) })- }-- SettingsDivider()-- Column(Modifier.padding(horizontal = 16.dp, vertical = 8.dp), verticalArrangement = Arrangement.spacedBy(8.dp)) {- Text(stringResource(R.string.magnitude_limit, state.magLimit.format(1)), style = MaterialTheme.typography.bodyMedium)- Slider(value = state.magLimit, onValueChange = { actions.setMagLimit(it) }, valueRange = 1f..7f)-- Text(stringResource(R.string.fov, state.fovDeg.toInt()), style = MaterialTheme.typography.bodyMedium)- Slider(value = state.fovDeg, onValueChange = { actions.setFov(it) }, valueRange = 10f..120f)- }-- SettingsDivider()-- SettingsSection(title = stringResource(R.string.location)) {- Column(Modifier.padding(horizontal = 16.dp, vertical = 8.dp), verticalArrangement = Arrangement.spacedBy(8.dp)) {- OutlinedTextField(value = latText, onValueChange = { latText = it }, label = { Text(stringResource(R.string.latitude_deg)) }, keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.DecimalSigned), modifier = Modifier.fillMaxWidth())- OutlinedTextField(value = lonText, onValueChange = { lonText = it }, label = { Text(stringResource(R.string.longitude_deg)) }, keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.DecimalSigned), modifier = Modifier.fillMaxWidth())- Button(onClick = {- val lat = latText.toDoubleOrNull(); val lon = lonText.toDoubleOrNull()- if (lat != null && lon != null) actions.setManualLocation(lat, lon)- }) { Text(stringResource(R.string.save_location)) }- Button(onClick = { actions.refreshLocation() }) { Text(stringResource(R.string.use_current_location)) }- }- }-- SettingsDivider()-- Column(Modifier.padding(horizontal = 16.dp, vertical = 8.dp), verticalArrangement = Arrangement.spacedBy(8.dp)) {- Text(stringResource(R.string.notes_true_north_correction_via_geomagne), style = MaterialTheme.typography.labelSmall)- Text(stringResource(R.string.catalog_stars_constellations_dso, state.starCount, state.constellationCount, state.deepSkyCount), style = MaterialTheme.typography.labelSmall)- }- }- }- }-} -private fun Float.format(d: Int): String = "%.${d}f".format(this)
astronomy/src/main/java/com/vayunmathur/astronomy/ui/SettingsScreen.kt
diff --git a/astronomy/src/main/java/com/vayunmathur/astronomy/ui/SettingsScreen.kt b/astronomy/src/main/java/com/vayunmathur/astronomy/ui/SettingsScreen.ktnew file mode 100644index 0000000000..d244206dc0--- /dev/null+++ b/astronomy/src/main/java/com/vayunmathur/astronomy/ui/SettingsScreen.kt@@ -0,0 +1,116 @@+package com.vayunmathur.astronomy.ui+import androidx.compose.foundation.layout.Arrangement+import androidx.compose.foundation.layout.Column+import androidx.compose.foundation.layout.fillMaxSize+import androidx.compose.foundation.layout.fillMaxWidth+import androidx.compose.foundation.layout.padding+import androidx.compose.foundation.rememberScrollState+import androidx.compose.foundation.verticalScroll+import androidx.compose.runtime.Composable+import androidx.compose.runtime.collectAsState+import androidx.compose.runtime.getValue+import androidx.compose.runtime.mutableStateOf+import androidx.compose.runtime.remember+import androidx.compose.runtime.setValue+import androidx.compose.ui.Modifier+import androidx.compose.foundation.text.KeyboardOptions+import androidx.compose.ui.text.input.KeyboardType+import androidx.compose.ui.unit.dp+import com.vayunmathur.astronomy.R+import com.vayunmathur.astronomy.Route+import com.vayunmathur.astronomy.platform.AstronomyViewModel+import com.vayunmathur.astronomy.platform.ConstellationMode+import com.vayunmathur.astronomy.platform.SettingsActions+import com.vayunmathur.astronomy.platform.SettingsUiState+import com.vayunmathur.library.ui.AppScaffold+import com.vayunmathur.library.ui.Button+import com.vayunmathur.library.ui.DesktopMaxWidthContainer+import com.vayunmathur.library.ui.MaterialTheme+import com.vayunmathur.library.ui.OutlinedTextField+import com.vayunmathur.library.ui.SettingsDivider+import com.vayunmathur.library.ui.SettingsSection+import com.vayunmathur.library.ui.SettingsSelectRow+import com.vayunmathur.library.ui.SettingsSwitchRow+import com.vayunmathur.library.ui.Slider+import com.vayunmathur.library.ui.Text+import com.vayunmathur.library.ui.appBarScrollBehavior+import com.vayunmathur.library.util.NavBackStack+import androidx.compose.ui.res.stringResource++/**+ * The settings screen, with no dependency on the ViewModel so it can be rendered from a+ * `@Preview` — see `src/screenshotTest`, which is where the store listing images come from.+ */+@Composable+fun SettingsScreen(backStack: NavBackStack<Route>, state: SettingsUiState, actions: SettingsActions) {+ var latText by remember(state.latDeg) { mutableStateOf(state.latDeg?.toString() ?: "") }+ var lonText by remember(state.lonDeg) { mutableStateOf(state.lonDeg?.toString() ?: "") }++ val offLabel = stringResource(R.string.off)+ val linesLabel = stringResource(R.string.lines_only)+ val linesArtLabel = stringResource(R.string.lines_art)++ AppScaffold(title = stringResource(R.string.settings), onNavigateBack = { backStack.pop() }, scrollBehavior = appBarScrollBehavior()) { padding ->+ // Letterboxed on expanded windows so the form keeps a readable measure.+ DesktopMaxWidthContainer(Modifier.padding(padding)) {+ Column(Modifier.fillMaxSize().verticalScroll(rememberScrollState())) {+ SettingsSection(title = stringResource(R.string.display)) {+ SettingsSelectRow(+ title = stringResource(R.string.constellations),+ selected = state.constellationMode,+ options = listOf(ConstellationMode.OFF, ConstellationMode.LINES, ConstellationMode.LINES_AND_ART),+ label = {+ when (it) {+ ConstellationMode.OFF -> offLabel+ ConstellationMode.LINES -> linesLabel+ ConstellationMode.LINES_AND_ART -> linesArtLabel+ }+ },+ onSelect = { actions.setShowConstellations(it) },+ )+ SettingsSwitchRow(title = stringResource(R.string.coordinate_grid_whole_sphere), checked = state.showGrid, onCheckedChange = { actions.setShowGrid(it) })+ SettingsSwitchRow(title = stringResource(R.string.show_deep_sky), checked = state.showDeepSky, onCheckedChange = { actions.setShowDeepSky(it) })+ SettingsSwitchRow(title = stringResource(R.string.planets_sun_moon), checked = state.showPlanets, onCheckedChange = { actions.setShowPlanets(it) })+ // No below-horizon switch here: the sky deliberately+ // always renders the full sphere (see ViewModel /+ // projection comments), and the old switch changed+ // nothing on the sky — it only persisted a flag.+ SettingsSwitchRow(title = stringResource(R.string.night_mode), checked = state.nightMode, onCheckedChange = { actions.setNightMode(it) })+ }++ SettingsDivider()++ Column(Modifier.padding(horizontal = 16.dp, vertical = 8.dp), verticalArrangement = Arrangement.spacedBy(8.dp)) {+ Text(stringResource(R.string.magnitude_limit, state.magLimit.format(1)), style = MaterialTheme.typography.bodyMedium)+ Slider(value = state.magLimit, onValueChange = { actions.setMagLimit(it) }, valueRange = 1f..7f)++ Text(stringResource(R.string.fov, state.fovDeg.toInt()), style = MaterialTheme.typography.bodyMedium)+ Slider(value = state.fovDeg, onValueChange = { actions.setFov(it) }, valueRange = 10f..120f)+ }++ SettingsDivider()++ SettingsSection(title = stringResource(R.string.location)) {+ Column(Modifier.padding(horizontal = 16.dp, vertical = 8.dp), verticalArrangement = Arrangement.spacedBy(8.dp)) {+ OutlinedTextField(value = latText, onValueChange = { latText = it }, label = { Text(stringResource(R.string.latitude_deg)) }, keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.DecimalSigned), modifier = Modifier.fillMaxWidth())+ OutlinedTextField(value = lonText, onValueChange = { lonText = it }, label = { Text(stringResource(R.string.longitude_deg)) }, keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.DecimalSigned), modifier = Modifier.fillMaxWidth())+ Button(onClick = {+ val lat = latText.toDoubleOrNull(); val lon = lonText.toDoubleOrNull()+ if (lat != null && lon != null) actions.setManualLocation(lat, lon)+ }) { Text(stringResource(R.string.save_location)) }+ Button(onClick = { actions.refreshLocation() }) { Text(stringResource(R.string.use_current_location)) }+ }+ }++ SettingsDivider()++ Column(Modifier.padding(horizontal = 16.dp, vertical = 8.dp), verticalArrangement = Arrangement.spacedBy(8.dp)) {+ Text(stringResource(R.string.notes_true_north_correction_via_geomagne), style = MaterialTheme.typography.labelSmall)+ Text(stringResource(R.string.catalog_stars_constellations_dso, state.starCount, state.constellationCount, state.deepSkyCount), style = MaterialTheme.typography.labelSmall)+ }+ }+ }+ }+}++private fun Float.format(d: Int): String = "%.${d}f".format(this)
astronomy/src/main/java/com/vayunmathur/astronomy/ui/SkyMapPage.kt
diff --git a/astronomy/src/main/java/com/vayunmathur/astronomy/ui/SkyMapPage.kt b/astronomy/src/main/java/com/vayunmathur/astronomy/ui/SkyMapPage.ktindex e4a73ebb6c..5577d77dcf 100644--- a/astronomy/src/main/java/com/vayunmathur/astronomy/ui/SkyMapPage.kt+++ b/astronomy/src/main/java/com/vayunmathur/astronomy/ui/SkyMapPage.kt@@ -102,93 +102,6 @@ fun SkyMapPage(backStack: NavBackStack<Route>, viewModel: AstronomyViewModel) { ) } -/**- * The sky map, with no dependency on the ViewModel so it can be rendered from a- * `@Preview` — see `src/screenshotTest`, which is where the store listing images come from.- */-@Composable-fun SkyMapScreen(- backStack: NavBackStack<Route>,- state: SkyMapUiState,- actions: SkyMapActions,- /**- * Seed for the screen's own UI-only state (whether the camera AR overlay is up). The- * app always takes the default; a preview can set it to capture that mode directly.- */- initialCameraOn: Boolean = false,-) {- var screenW by remember { mutableFloatStateOf(1080f) }- var screenH by remember { mutableFloatStateOf(1920f) }- // Camera feed replaces the sky background in place (AR overlay) instead of a- // separate page.- var cameraOn by remember { mutableStateOf(initialCameraOn) }-- val viewState = remember(state.centerAzRad, state.centerAltRad, state.rotationRad, state.fovDeg, screenW, screenH) {- ViewState(state.centerAzRad, state.centerAltRad, state.fovDeg, screenW, screenH, state.rotationRad)- }-- Box(- Modifier.fillMaxSize()- .onSizeChanged { sz -> screenW = sz.width.toFloat(); screenH = sz.height.toFloat() }- ) {- if (cameraOn) {- CameraBackground(Modifier.fillMaxSize()) { cameraOn = false }- }-- SkyCanvas(- visibleSky = state.visibleSky,- viewState = viewState,- showConstellationLines = state.constellationMode != ConstellationMode.OFF,- showConstellationArt = state.constellationMode == ConstellationMode.LINES_AND_ART,- showGrid = state.showGrid,- showDeepSky = state.showDeepSky,- showPlanets = state.showPlanets,- transparentBackground = cameraOn,- trajectory = state.trajectory,- selectedId = state.selectedObjectId,- onPan = { _, _ -> /* disabled – always tracks phone */ },- onZoom = { actions.setFov(it) },- onTap = { _ -> },- onObjectTap = { id -> actions.selectObject(id) },- onObjectOpen = { id -> actions.selectObject(id); backStack.add(Route.ObjectDetail(id)) },- modifier = Modifier.fillMaxSize()- )-- HistoryScrubber(backStack, state, actions)-- if (state.nightMode) {- Box(Modifier.fillMaxSize().background(androidx.compose.ui.graphics.Color(0x44FF0000)))- }-- CompassCalibrationBanner(- accuracy = state.accuracy,- modifier = Modifier- .align(Alignment.TopCenter)- .padding(top = 72.dp, start = 16.dp, end = 16.dp),- )-- TopAppBarOverlay(- modifier = Modifier.align(Alignment.TopCenter),- actions = listOf(- OverlayAction(- icon = { IconSearch() },- contentDescription = "Search",- onClick = { backStack.add(Route.Search) },- ),- OverlayAction(- icon = { if (cameraOn) IconCameraOff() else IconCamera() },- contentDescription = "Camera",- onClick = { cameraOn = !cameraOn },- ),- OverlayAction(- icon = { IconSettings() },- contentDescription = "Settings",- onClick = { backStack.add(Route.Settings) },- ),- ),- )- }-} /** * Bottom-center time picker sharing its look/behaviour with FindFamily's history@@ -198,7 +111,7 @@ fun SkyMapScreen( */ @OptIn(ExperimentalTime::class) @Composable-private fun BoxScope.HistoryScrubber(+internal fun BoxScope.HistoryScrubber( backStack: NavBackStack<Route>, state: SkyMapUiState, actions: SkyMapActions,
astronomy/src/main/java/com/vayunmathur/astronomy/ui/SkyMapScreen.kt
diff --git a/astronomy/src/main/java/com/vayunmathur/astronomy/ui/SkyMapScreen.kt b/astronomy/src/main/java/com/vayunmathur/astronomy/ui/SkyMapScreen.ktnew file mode 100644index 0000000000..656ccc853a--- /dev/null+++ b/astronomy/src/main/java/com/vayunmathur/astronomy/ui/SkyMapScreen.kt@@ -0,0 +1,131 @@+package com.vayunmathur.astronomy.ui+import android.hardware.SensorManager+import androidx.compose.foundation.background+import androidx.compose.foundation.layout.Box+import androidx.compose.foundation.layout.BoxScope+import androidx.compose.foundation.layout.fillMaxSize+import androidx.compose.foundation.layout.padding+import androidx.compose.runtime.Composable+import androidx.compose.runtime.LaunchedEffect+import androidx.compose.runtime.collectAsState+import androidx.compose.runtime.getValue+import androidx.compose.runtime.mutableFloatStateOf+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.layout.onSizeChanged+import androidx.compose.ui.unit.dp+import com.vayunmathur.astronomy.Route+import com.vayunmathur.astronomy.domain.projection.ViewState+import com.vayunmathur.astronomy.platform.AstronomyViewModel+import com.vayunmathur.astronomy.platform.ConstellationMode+import com.vayunmathur.astronomy.platform.SkyMapActions+import com.vayunmathur.astronomy.platform.SkyMapUiState+import com.vayunmathur.astronomy.platform.resolveViewCenter+import com.vayunmathur.astronomy.platform.resolveViewRotation+import com.vayunmathur.astronomy.ui.components.CameraBackground+import com.vayunmathur.library.ui.CompassCalibrationBanner+import com.vayunmathur.library.ui.HistoryScrubberCard+import com.vayunmathur.library.ui.HistoryStep+import com.vayunmathur.library.ui.IconCamera+import com.vayunmathur.library.ui.IconCameraOff+import com.vayunmathur.library.ui.IconSearch+import com.vayunmathur.library.ui.IconSettings+import com.vayunmathur.library.ui.OverlayAction+import com.vayunmathur.library.ui.TopAppBarOverlay+import com.vayunmathur.library.ui.rememberHistoryScrubberState+import com.vayunmathur.library.util.NavBackStack+import com.vayunmathur.library.util.ResultEffect+import kotlinx.datetime.LocalDate+import kotlinx.datetime.TimeZone+import kotlin.time.ExperimentalTime++/**+ * The sky map, with no dependency on the ViewModel so it can be rendered from a+ * `@Preview` — see `src/screenshotTest`, which is where the store listing images come from.+ */+@Composable+fun SkyMapScreen(+ backStack: NavBackStack<Route>,+ state: SkyMapUiState,+ actions: SkyMapActions,+ /**+ * Seed for the screen's own UI-only state (whether the camera AR overlay is up). The+ * app always takes the default; a preview can set it to capture that mode directly.+ */+ initialCameraOn: Boolean = false,+) {+ var screenW by remember { mutableFloatStateOf(1080f) }+ var screenH by remember { mutableFloatStateOf(1920f) }+ // Camera feed replaces the sky background in place (AR overlay) instead of a+ // separate page.+ var cameraOn by remember { mutableStateOf(initialCameraOn) }++ val viewState = remember(state.centerAzRad, state.centerAltRad, state.rotationRad, state.fovDeg, screenW, screenH) {+ ViewState(state.centerAzRad, state.centerAltRad, state.fovDeg, screenW, screenH, state.rotationRad)+ }++ Box(+ Modifier.fillMaxSize()+ .onSizeChanged { sz -> screenW = sz.width.toFloat(); screenH = sz.height.toFloat() }+ ) {+ if (cameraOn) {+ CameraBackground(Modifier.fillMaxSize()) { cameraOn = false }+ }++ SkyCanvas(+ visibleSky = state.visibleSky,+ viewState = viewState,+ showConstellationLines = state.constellationMode != ConstellationMode.OFF,+ showConstellationArt = state.constellationMode == ConstellationMode.LINES_AND_ART,+ showGrid = state.showGrid,+ showDeepSky = state.showDeepSky,+ showPlanets = state.showPlanets,+ transparentBackground = cameraOn,+ trajectory = state.trajectory,+ selectedId = state.selectedObjectId,+ onPan = { _, _ -> /* disabled – always tracks phone */ },+ onZoom = { actions.setFov(it) },+ onTap = { _ -> },+ onObjectTap = { id -> actions.selectObject(id) },+ onObjectOpen = { id -> actions.selectObject(id); backStack.add(Route.ObjectDetail(id)) },+ modifier = Modifier.fillMaxSize()+ )++ HistoryScrubber(backStack, state, actions)++ if (state.nightMode) {+ Box(Modifier.fillMaxSize().background(androidx.compose.ui.graphics.Color(0x44FF0000)))+ }++ CompassCalibrationBanner(+ accuracy = state.accuracy,+ modifier = Modifier+ .align(Alignment.TopCenter)+ .padding(top = 72.dp, start = 16.dp, end = 16.dp),+ )++ TopAppBarOverlay(+ modifier = Modifier.align(Alignment.TopCenter),+ actions = listOf(+ OverlayAction(+ icon = { IconSearch() },+ contentDescription = "Search",+ onClick = { backStack.add(Route.Search) },+ ),+ OverlayAction(+ icon = { if (cameraOn) IconCameraOff() else IconCamera() },+ contentDescription = "Camera",+ onClick = { cameraOn = !cameraOn },+ ),+ OverlayAction(+ icon = { IconSettings() },+ contentDescription = "Settings",+ onClick = { backStack.add(Route.Settings) },+ ),+ ),+ )+ }+}
astronomy/src/main/res/values-ar/strings.xml
diff --git a/astronomy/src/main/res/values-ar/strings.xml b/astronomy/src/main/res/values-ar/strings.xmlindex 98d8de2531..1af89b8671 100644--- a/astronomy/src/main/res/values-ar/strings.xml+++ b/astronomy/src/main/res/values-ar/strings.xml@@ -5,7 +5,6 @@ <string name="app_name">الفلك</string> <string name="night_mode">الوضع الليلي (أحمر)</string> <string name="calculating">جارٍ الحساب…</string>- <string name="search_1">البحث</string> <string name="save_location">حفظ الموقع</string> <string name="off">غير مفعّل</string> <string name="location">الموقع</string>
astronomy/src/main/res/values-az/strings.xml
diff --git a/astronomy/src/main/res/values-az/strings.xml b/astronomy/src/main/res/values-az/strings.xmlindex 6b460ec1d3..bcc1e74b1f 100644--- a/astronomy/src/main/res/values-az/strings.xml+++ b/astronomy/src/main/res/values-az/strings.xml@@ -16,7 +16,6 @@ <string name="rise_1">Çıxış: <xliff:g id="time" example="18:45">%1$s</xliff:g></string> <string name="set_1">Təyin et: <xliff:g id="time" example="04:12">%1$s</xliff:g> ?:</string> <string name="ra_h_h">RA h: <xliff:g id="hours" example="5.5">%1$s</xliff:g>h</string>- <string name="search_1">Axtarış</string> <string name="search_stars_planets_messier">Ulduzlar, planetlər və Messye obyektləri üzrə axtarış</string> <string name="settings">Parametrlər</string> <string name="magnitude_limit">Maqnituda həddi: <xliff:g id="limit" example="4.5">%1$s</xliff:g></string>@@ -27,7 +26,6 @@ <string name="display">Ekran</string> <string name="constellations">Bürclər</string> <string name="lines_only">Yalnız xətlər</string>- <string name="show_below_horizon_all_sky">Üfüqdən aşağıda göstər (bütün səma)</string> <string name="notes_true_north_correction_via_geomagne">Qeydlər: Geomaqnit meyli vasitəsilə əsl şimala düzəliş. AR, CameraX və fırlanma vektoru sintezindən istifadə edir.</string> <string name="lines_art">Xətlər və incəsənət</string> <string name="location">Yerləşmə</string>
astronomy/src/main/res/values-et/strings.xml
diff --git a/astronomy/src/main/res/values-et/strings.xml b/astronomy/src/main/res/values-et/strings.xmlindex 58607c7714..ed6ba4ac6b 100644--- a/astronomy/src/main/res/values-et/strings.xml+++ b/astronomy/src/main/res/values-et/strings.xml@@ -23,7 +23,6 @@ <string name="ra_dec">RA: <xliff:g id="ra" example="5.5">%1$s</xliff:g>° Dec: <xliff:g id="dec" example="-8.2">%2$s</xliff:g>°</string> <string name="rise_1">Tõus: <xliff:g id="time" example="18:45">%1$s</xliff:g> ?:</string> <string name="set_1">Loojang: <xliff:g id="time" example="04:12">%1$s</xliff:g> ?:</string>- <string name="search_1">Otsi</string> <string name="search_stars_planets_messier">Otsi tähti, planeete ja Messier\' kataloogist</string> <string name="constellations">Tähekogud</string> <string name="planet_jupiter">Jupiter</string>@@ -40,7 +39,6 @@ <string name="never_rises_at_this_location">Selles asukohas ei tõuse iialgi</string> <string name="off">Pole kasutusel</string> <string name="lines_only">Vaid jooned</string>- <string name="show_below_horizon_all_sky">Näita taevast ka horisondi all (kogu taevast)</string> <string name="lines_art">Jooned + graafika</string> <string name="notes_true_north_correction_via_geomagne">Märkus: Tegeliku põhjasuuna korrigeerimine geomagneetilise deklinatsiooni abil. AR kasutab CameraX-i ja pöördevektori ühendamist.</string> <string name="catalog_stars_constellations_dso">Kataloog: <xliff:g id="star_count" example="5000">%1$s</xliff:g> tähte, <xliff:g id="constellation_count" example="88">%2$s</xliff:g> tähekogu, <xliff:g id="dso_count" example="110">%3$s</xliff:g> Messier\' kataloogi objekti.</string>
astronomy/src/main/res/values-fr/strings.xml
diff --git a/astronomy/src/main/res/values-fr/strings.xml b/astronomy/src/main/res/values-fr/strings.xmlindex 114097f0b9..c09355552d 100644--- a/astronomy/src/main/res/values-fr/strings.xml+++ b/astronomy/src/main/res/values-fr/strings.xml@@ -18,7 +18,6 @@ <string name="rise_1">Lever : <xliff:g id="time" example="18:45">%1$s</xliff:g> ?:</string> <string name="set_1">Coucher : <xliff:g id="time" example="04:12">%1$s</xliff:g> ?:</string> <string name="ra_h_h">AD h : <xliff:g id="hours" example="5.5">%1$s</xliff:g> h</string>- <string name="search_1">Rechercher</string> <string name="search_stars_planets_messier">Rechercher des étoiles, des planètes ou des objets Messier</string> <string name="magnitude_limit">Magnitude limite : <xliff:g id="limit" example="4.5">%1$s</xliff:g></string> <string name="longitude_deg">Longitude (°)</string>@@ -26,7 +25,6 @@ <string name="catalog_stars_constellations_dso">Catalogue : <xliff:g id="star_count" example="5000">%1$s</xliff:g> étoiles, <xliff:g id="constellation_count" example="88">%2$s</xliff:g> constellations, <xliff:g id="dso_count" example="110">%3$s</xliff:g> objets du ciel profond.</string> <string name="constellations">Constellations</string> <string name="lines_only">Lignes uniquement</string>- <string name="show_below_horizon_all_sky">Afficher sous l’horizon (ciel entier)</string> <string name="notes_true_north_correction_via_geomagne">Remarques : correction du nord vrai via la déclinaison géomagnétique. La RA utilise CameraX et la fusion du vecteur de rotation.</string> <string name="lines_art">Lignes + illustrations</string> <string name="location">Position</string>
astronomy/src/main/res/values-sv/strings.xml
diff --git a/astronomy/src/main/res/values-sv/strings.xml b/astronomy/src/main/res/values-sv/strings.xmlindex ced4e28571..2439c1b1fb 100644--- a/astronomy/src/main/res/values-sv/strings.xml+++ b/astronomy/src/main/res/values-sv/strings.xml@@ -19,7 +19,6 @@ <string name="rise_1">Uppgång: <xliff:g id="time" example="18:45">%1$s</xliff:g> ?:</string> <string name="set_1">Nedgång: <xliff:g id="time" example="04:12">%1$s</xliff:g> ?:</string> <string name="ra_h_h">RA h: <xliff:g id="hours" example="5.5">%1$s</xliff:g>h</string>- <string name="search_1">Sök</string> <string name="search_stars_planets_messier">Sök stjärnor, planeter, Messier</string> <string name="magnitude_limit">Magnitudgräns: <xliff:g id="limit" example="4.5">%1$s</xliff:g></string> <string name="longitude_deg">Longitudgrader</string>@@ -28,7 +27,6 @@ <string name="off">Av</string> <string name="constellations">Stjärnbilder</string> <string name="lines_only">Endast linjer</string>- <string name="show_below_horizon_all_sky">Visa under horisonten (hela himlen)</string> <string name="notes_true_north_correction_via_geomagne">Obs: Korrigering för geografisk nord via geomagnetisk deklination. AR använder CameraX och sammanslagning av rotationsvektorer.</string> <string name="lines_art">Linjer och illustrationer</string> <string name="location">Plats</string>
astronomy/src/main/res/values-zh-rCN/strings.xml
diff --git a/astronomy/src/main/res/values-zh-rCN/strings.xml b/astronomy/src/main/res/values-zh-rCN/strings.xmlindex 8b9d6b7859..6af5f0ca16 100644--- a/astronomy/src/main/res/values-zh-rCN/strings.xml+++ b/astronomy/src/main/res/values-zh-rCN/strings.xml@@ -20,7 +20,6 @@ <string name="catalog_stars_constellations_dso">星表:<xliff:g id="star_count" example="5000">%1$s</xliff:g> 颗恒星,<xliff:g id="constellation_count" example="88">%2$s</xliff:g> 个星座,<xliff:g id="dso_count" example="110">%3$s</xliff:g> 个深空天体。</string> <string name="planet_sun">太阳</string> <string name="mag">星等:<xliff:g id="magnitude" example="1.5">%1$s</xliff:g></string>- <string name="show_below_horizon_all_sky">显示地平线以下(整个天空)</string> <string name="planet_neptune">海王星</string> <string name="ra_dec">赤经:<xliff:g id="ra" example="5.5">%1$s</xliff:g>° 赤纬:<xliff:g id="dec" example="-8.2">%2$s</xliff:g>°</string> <string name="show_deep_sky">深空(梅西耶天体)</string>@@ -30,7 +29,6 @@ <string name="night_mode">夜间模式(红色)</string> <string name="alt_az">高度角:<xliff:g id="altitude" example="45">%1$s</xliff:g>° 方位角:<xliff:g id="azimuth" example="180">%2$s</xliff:g>°</string> <string name="rise_1">升起:<xliff:g id="time" example="18:45">%1$s</xliff:g> ?:</string>- <string name="search_1">搜索</string> <string name="save_location">保存位置</string> <string name="constellations">星座</string> <string name="coordinate_grid_whole_sphere">坐标网格(整个球体)</string>
astronomy/src/main/res/values/strings.xml
diff --git a/astronomy/src/main/res/values/strings.xml b/astronomy/src/main/res/values/strings.xmlindex 9a6016abdc..894f0e37d4 100644--- a/astronomy/src/main/res/values/strings.xml+++ b/astronomy/src/main/res/values/strings.xml@@ -42,7 +42,6 @@ <!-- SearchPage --> <!-- SearchPage: TopAppBar title. Verb/Noun, action to search -->- <string name="search_1">Search</string> <!-- SearchPage: hint text in search field --> <string name="search_stars_planets_messier">Search stars, planets, Messier</string> @@ -66,7 +65,6 @@ <!-- SettingsPage: dropdown option to show constellation lines only --> <string name="lines_only">Lines only</string> <!-- SettingsPage: toggle to show sky below horizon (full sphere) -->- <string name="show_below_horizon_all_sky">Show below horizon (all sky)</string> <!-- SettingsPage: footer note explaining true north correction and AR implementation --> <string name="notes_true_north_correction_via_geomagne">Notes: True north correction via geomagnetic declination. AR uses CameraX + rotation vector fusion.</string> <!-- SettingsPage: dropdown option to show constellation lines plus artwork -->