Modern Apps git

← Modern-Apps.git

measure: localise all user-facing strings (#655)

Commit
fed4472f6bc0f52b9b91feca492286c2e54fb34c
Author
vayun-mathur <[email protected]>
When
2026-09-07 04:02 UTC (3 months ago)
Parents
645b0f8

Diff

measure/src/main/java/com/vayunmathur/measure/domain/HeldOrientation.kt
diff --git a/measure/src/main/java/com/vayunmathur/measure/domain/HeldOrientation.kt b/measure/src/main/java/com/vayunmathur/measure/domain/HeldOrientation.ktindex 9aaf82c01a..c28152e14f 100644--- a/measure/src/main/java/com/vayunmathur/measure/domain/HeldOrientation.kt+++ b/measure/src/main/java/com/vayunmathur/measure/domain/HeldOrientation.kt@@ -1,10 +1,10 @@ package com.vayunmathur.measure.domain  /** Which device edge is pointing at the ground, derived purely from gravity. */-enum class HeldOrientation(val label: String) {-    Portrait("Portrait"),-    PortraitUpsideDown("Portrait, upside down"),-    LandscapeLeft("Landscape, left edge down"),-    LandscapeRight("Landscape, right edge down"),-    Flat("Flat"),+enum class HeldOrientation {+    Portrait,+    PortraitUpsideDown,+    LandscapeLeft,+    LandscapeRight,+    Flat, }
measure/src/main/java/com/vayunmathur/measure/domain/Units.kt
diff --git a/measure/src/main/java/com/vayunmathur/measure/domain/Units.kt b/measure/src/main/java/com/vayunmathur/measure/domain/Units.ktindex 7ee2040628..841ce52951 100644--- a/measure/src/main/java/com/vayunmathur/measure/domain/Units.kt+++ b/measure/src/main/java/com/vayunmathur/measure/domain/Units.kt@@ -112,13 +112,15 @@ object Units {      */     fun bearingDelta(from: Double, to: Double): Double = ((to - from + 540.0) % 360.0) - 180.0 -    private val CARDINALS = listOf(-        "N", "NNE", "NE", "ENE", "E", "ESE", "SE", "SSE",-        "S", "SSW", "SW", "WSW", "W", "WNW", "NW", "NNW",-    )--    fun cardinal(degrees: Double): String {-        val idx = ((normalizeDegrees(degrees) / 22.5) + 0.5).toInt() % 16-        return CARDINALS[idx]-    }+    /** Number of named compass points on the sixteen-point rose. */+    const val CARDINAL_POINTS = 16++    /**+     * Index into the sixteen-point compass rose, clockwise from north.+     *+     * Returns an index rather than a label because the labels are localised and live in+     * `R.array.compass_cardinals`; this package holds no Android dependencies.+     */+    fun cardinalIndex(degrees: Double): Int =+        ((normalizeDegrees(degrees) / (360.0 / CARDINAL_POINTS)) + 0.5).toInt() % CARDINAL_POINTS }
measure/src/main/java/com/vayunmathur/measure/platform/MeasureViewModel.kt
diff --git a/measure/src/main/java/com/vayunmathur/measure/platform/MeasureViewModel.kt b/measure/src/main/java/com/vayunmathur/measure/platform/MeasureViewModel.ktindex 53da13c150..38cbbf0f07 100644--- a/measure/src/main/java/com/vayunmathur/measure/platform/MeasureViewModel.kt+++ b/measure/src/main/java/com/vayunmathur/measure/platform/MeasureViewModel.kt@@ -5,6 +5,7 @@ import androidx.lifecycle.AndroidViewModel import androidx.lifecycle.viewModelScope import com.vayunmathur.library.sensor.OrientationManager import com.vayunmathur.library.util.DataStoreUtils+import com.vayunmathur.measure.R import com.vayunmathur.measure.data.model.Anchor import com.vayunmathur.measure.data.model.MeasurementKind import com.vayunmathur.measure.data.model.SavedMeasurement@@ -241,7 +242,9 @@ class MeasureViewModel(app: Application) : AndroidViewModel(app),         }         val m = SavedMeasurement(             id = nextMeasurementId++,-            label = label.ifBlank { "Measurement" },+            label = label.ifBlank {+                getApplication<Application>().getString(R.string.saved_default_label)+            },             kind = kind,             value = value,             recordedAtEpochMs = System.currentTimeMillis(),
measure/src/main/java/com/vayunmathur/measure/ui/ArMeasureContent.kt
diff --git a/measure/src/main/java/com/vayunmathur/measure/ui/ArMeasureContent.kt b/measure/src/main/java/com/vayunmathur/measure/ui/ArMeasureContent.ktindex 416d066e98..07e3955634 100644--- a/measure/src/main/java/com/vayunmathur/measure/ui/ArMeasureContent.kt+++ b/measure/src/main/java/com/vayunmathur/measure/ui/ArMeasureContent.kt@@ -19,6 +19,7 @@ import androidx.compose.ui.geometry.Size import androidx.compose.ui.graphics.drawscope.Stroke import androidx.compose.ui.input.pointer.pointerInput import androidx.compose.ui.layout.onSizeChanged+import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import com.vayunmathur.library.ui.AppScaffold import com.vayunmathur.library.ui.IconButton@@ -28,6 +29,7 @@ import com.vayunmathur.library.ui.MaterialTheme import com.vayunmathur.library.ui.OutlinedButton import com.vayunmathur.library.ui.Text import com.vayunmathur.library.ui.appBarScrollBehavior+import com.vayunmathur.measure.R import com.vayunmathur.measure.data.model.TrackingQuality import com.vayunmathur.measure.domain.MeasureNative import com.vayunmathur.measure.domain.Units@@ -46,7 +48,7 @@ fun ArMeasureContent(     bottomBar: @Composable () -> Unit = {}, ) {     AppScaffold(-        title = "Measure",+        title = stringResource(R.string.tool_measure),         actions = { IconButton(onClick = onOpenSettings) { IconSettings() } },         bottomBar = bottomBar,         scrollBehavior = appBarScrollBehavior(),@@ -54,14 +56,11 @@ fun ArMeasureContent(         Box(Modifier.fillMaxSize().padding(padding)) {              if (!MeasureNative.available) {-                UnavailableNotice(-                    "AR measuring needs the native tracking engine, which isn't available " +-                        "on this device."-                )+                UnavailableNotice(stringResource(R.string.ar_unavailable_native))                 return@Box             }             if (!state.cameraPermissionGranted) {-                UnavailableNotice("Camera access is needed to measure in AR.")+                UnavailableNotice(stringResource(R.string.ar_unavailable_camera))                 return@Box             } @@ -97,11 +96,11 @@ fun ArMeasureContent(                     OutlinedButton(                         onClick = { actions.closePolygon() },                         enabled = state.anchors.size >= 3 && !state.polygonClosed,-                    ) { Text("Close shape") }+                    ) { Text(stringResource(R.string.ar_close_shape)) }                     OutlinedButton(                         onClick = { actions.clearAnchors() },                         enabled = state.anchors.isNotEmpty(),-                    ) { Text("Clear") }+                    ) { Text(stringResource(R.string.ar_clear_points)) }                 }             }         }@@ -119,20 +118,21 @@ fun ArMeasureContent( private fun TrackingBanner(quality: TrackingQuality, hasPlane: Boolean) {     val (message, color) = when (quality) {         TrackingQuality.Initialising ->-            "Move the phone sideways and turn it slightly to start tracking" to+            stringResource(R.string.ar_tracking_initialising) to                 MaterialTheme.colorScheme.tertiaryContainer          TrackingQuality.Limited ->-            "Tracking is weak — move slowly and keep texture in view" to+            stringResource(R.string.ar_tracking_limited) to                 MaterialTheme.colorScheme.tertiaryContainer          TrackingQuality.Lost ->-            "Tracking lost — point at a textured surface to recover" to+            stringResource(R.string.ar_tracking_lost) to                 MaterialTheme.colorScheme.errorContainer          TrackingQuality.Good ->-            (if (hasPlane) "Ready — tap to place points" else "Ready — no surface found yet") to-                MaterialTheme.colorScheme.primaryContainer+            stringResource(+                if (hasPlane) R.string.ar_tracking_ready else R.string.ar_tracking_ready_no_surface+            ) to MaterialTheme.colorScheme.primaryContainer     }     Box(         Modifier@@ -162,13 +162,16 @@ private fun ReadoutCard(state: ArMeasureUiState) {             }             state.areaM2?.let {                 Text(-                    "Area ${Units.formatArea(it, state.unitSystem)}",+                    stringResource(R.string.ar_area, Units.formatArea(it, state.unitSystem)),                     style = MaterialTheme.typography.bodyMedium,                 )             }             state.perimeterM?.let {                 Text(-                    "Perimeter ${Units.formatLength(it, state.unitSystem)}",+                    stringResource(+                        R.string.ar_perimeter,+                        Units.formatLength(it, state.unitSystem),+                    ),                     style = MaterialTheme.typography.bodyMedium,                     color = MaterialTheme.colorScheme.onSurfaceVariant,                 )@@ -233,7 +236,10 @@ private fun UnavailableNotice(message: String) {         horizontalAlignment = Alignment.CenterHorizontally,         verticalArrangement = Arrangement.Center,     ) {-        Text("AR measure unavailable", style = MaterialTheme.typography.titleMedium)+        Text(+            stringResource(R.string.ar_unavailable_title),+            style = MaterialTheme.typography.titleMedium,+        )         Text(             message,             style = MaterialTheme.typography.bodyMedium,
measure/src/main/java/com/vayunmathur/measure/ui/CompassContent.kt
diff --git a/measure/src/main/java/com/vayunmathur/measure/ui/CompassContent.kt b/measure/src/main/java/com/vayunmathur/measure/ui/CompassContent.ktindex 82df9338d6..9ba34f3242 100644--- a/measure/src/main/java/com/vayunmathur/measure/ui/CompassContent.kt+++ b/measure/src/main/java/com/vayunmathur/measure/ui/CompassContent.kt@@ -19,6 +19,8 @@ import androidx.compose.ui.graphics.Path import androidx.compose.ui.graphics.drawscope.DrawScope import androidx.compose.ui.graphics.drawscope.Stroke import androidx.compose.ui.graphics.drawscope.rotate+import androidx.compose.ui.res.stringArrayResource+import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.TextMeasurer import androidx.compose.ui.text.TextStyle import androidx.compose.ui.text.rememberTextMeasurer@@ -33,6 +35,7 @@ import com.vayunmathur.library.ui.MaterialTheme import com.vayunmathur.library.ui.OutlinedButton import com.vayunmathur.library.ui.Text import com.vayunmathur.library.ui.appBarScrollBehavior+import com.vayunmathur.measure.R import com.vayunmathur.measure.domain.Units import com.vayunmathur.measure.platform.CompassActions import com.vayunmathur.measure.platform.CompassUiState@@ -51,8 +54,9 @@ fun CompassContent(     } else {         state.azimuthMagDeg     }+    val cardinals = stringArrayResource(R.array.compass_cardinals)     AppScaffold(-        title = "Compass",+        title = stringResource(R.string.tool_compass),         actions = { IconButton(onClick = onOpenSettings) { IconSettings() } },         bottomBar = bottomBar,         scrollBehavior = appBarScrollBehavior(),@@ -63,13 +67,16 @@ fun CompassContent(             verticalArrangement = Arrangement.spacedBy(12.dp),         ) {             Text(-                "${Units.formatBearing(heading)} ${Units.cardinal(heading)}",+                "${Units.formatBearing(heading)} ${cardinals[Units.cardinalIndex(heading)]}",                 style = MaterialTheme.typography.displaySmall,             )             Text(                 // Without a location fix declination is unknown, so "true north" would                 // be a claim the app cannot back up.-                if (state.useTrueNorth && state.hasLocation) "True north" else "Magnetic north",+                stringResource(+                    if (state.useTrueNorth && state.hasLocation) R.string.compass_true_north+                    else R.string.compass_magnetic_north+                ),                 style = MaterialTheme.typography.bodyMedium,                 color = MaterialTheme.colorScheme.onSurfaceVariant,             )@@ -77,6 +84,7 @@ fun CompassContent(             CompassDial(                 headingDeg = heading,                 heldBearingDeg = state.heldBearingDeg,+                cardinals = cardinals,                 // Height-driven so the dial shrinks to fit a landscape window rather                 // than pushing the controls off the bottom.                 modifier = Modifier@@ -88,20 +96,23 @@ fun CompassContent(             CompassCalibrationBanner(state.accuracy)             if (state.tiltWarning) {                 Text(-                    "Hold the phone flat for an accurate bearing",+                    stringResource(R.string.compass_tilt_warning),                     style = MaterialTheme.typography.bodySmall,                     color = MaterialTheme.colorScheme.error,                 )             }             if (state.hasLocation) {                 Text(-                    "Declination ${Units.formatAngle(state.declinationDeg)}",+                    stringResource(+                        R.string.compass_declination,+                        Units.formatAngle(state.declinationDeg),+                    ),                     style = MaterialTheme.typography.bodySmall,                     color = MaterialTheme.colorScheme.onSurfaceVariant,                 )             } else {                 Text(-                    "No location — showing magnetic north only",+                    stringResource(R.string.compass_no_location),                     style = MaterialTheme.typography.bodySmall,                     color = MaterialTheme.colorScheme.onSurfaceVariant,                 )@@ -116,7 +127,12 @@ fun CompassContent(                     onClick = { actions.setUseTrueNorth(!state.useTrueNorth) },                     enabled = state.hasLocation,                 ) {-                    Text(if (state.useTrueNorth) "Show magnetic" else "Show true north")+                    Text(+                        stringResource(+                            if (state.useTrueNorth) R.string.compass_show_magnetic+                            else R.string.compass_show_true_north+                        )+                    )                 }                 OutlinedButton(                     onClick = {@@ -124,7 +140,12 @@ fun CompassContent(                         else actions.clearHeldBearing()                     }                 ) {-                    Text(if (state.heldBearingDeg == null) "Hold bearing" else "Release bearing")+                    Text(+                        stringResource(+                            if (state.heldBearingDeg == null) R.string.compass_hold_bearing+                            else R.string.compass_release_bearing+                        )+                    )                 }             }         }@@ -139,6 +160,7 @@ fun CompassContent( private fun CompassDial(     headingDeg: Double,     heldBearingDeg: Double?,+    cardinals: Array<String>,     modifier: Modifier = Modifier, ) {     val measurer = rememberTextMeasurer()@@ -156,7 +178,7 @@ private fun CompassDial(              rotate(-headingDeg.toFloat(), center) {                 drawTicks(center, radius, onSurface, variant)-                drawCardinals(measurer, center, radius, onSurface, error)+                drawCardinals(measurer, cardinals, center, radius, onSurface, error)                 if (heldBearingDeg != null) {                     drawHeldBearing(center, radius, heldBearingDeg.toFloat(), primary)                 }@@ -192,18 +214,22 @@ private fun DrawScope.drawTicks(center: Offset, radius: Float, major: Color, min  private fun DrawScope.drawCardinals(     measurer: TextMeasurer,+    cardinals: Array<String>,     center: Offset,     radius: Float,     normal: Color,     northColor: Color, ) {-    val labels = listOf(0 to "N", 90 to "E", 180 to "S", 270 to "W")-    for ((deg, label) in labels) {-        val rad = Math.toRadians(deg.toDouble() - 90.0)+    // Only the four quarter points fit on the dial; the intercardinals in the same array+    // are for the numeric readout.+    for (quarter in 0 until 4) {+        val index = quarter * (Units.CARDINAL_POINTS / 4)+        val label = cardinals[index]+        val rad = Math.toRadians(quarter * 90.0 - 90.0)         val r = radius * 0.78f         val style = TextStyle(             fontSize = 20.sp,-            color = if (label == "N") northColor else normal,+            color = if (index == 0) northColor else normal,         )         val layout = measurer.measure(label, style)         drawText(
measure/src/main/java/com/vayunmathur/measure/ui/DiagnosticsContent.kt
diff --git a/measure/src/main/java/com/vayunmathur/measure/ui/DiagnosticsContent.kt b/measure/src/main/java/com/vayunmathur/measure/ui/DiagnosticsContent.ktindex 88e68344f2..c5690d8144 100644--- a/measure/src/main/java/com/vayunmathur/measure/ui/DiagnosticsContent.kt+++ b/measure/src/main/java/com/vayunmathur/measure/ui/DiagnosticsContent.kt@@ -10,6 +10,7 @@ import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.verticalScroll import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier+import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import com.vayunmathur.library.ui.AppScaffold import com.vayunmathur.library.ui.MaterialTheme@@ -18,6 +19,7 @@ import com.vayunmathur.library.ui.SettingsRow import com.vayunmathur.library.ui.SettingsSection import com.vayunmathur.library.ui.Text import com.vayunmathur.library.ui.appBarScrollBehavior+import com.vayunmathur.measure.R import com.vayunmathur.measure.platform.DiagnosticsActions import com.vayunmathur.measure.platform.DiagnosticsUiState @@ -27,40 +29,74 @@ fun DiagnosticsContent(     actions: DiagnosticsActions,     onBack: () -> Unit = {}, ) {-    AppScaffold(title = "Diagnostics", onNavigateBack = onBack, scrollBehavior = appBarScrollBehavior()) { padding ->+    AppScaffold(+        title = stringResource(R.string.diagnostics_title),+        onNavigateBack = onBack,+        scrollBehavior = appBarScrollBehavior(),+    ) { padding ->         Column(             modifier = Modifier.fillMaxSize().padding(padding)                 .verticalScroll(rememberScrollState())         ) {-            SettingsSection(title = "Engine") {-                DiagRow("Native engine", if (state.nativeEngineAvailable) "loaded" else "unavailable")-                DiagRow("Landmarks", state.landmarkCount.toString())-                DiagRow("Scale confidence", "%.2f".format(state.scaleConfidence))+            SettingsSection(title = stringResource(R.string.diagnostics_section_engine)) {+                DiagRow(+                    stringResource(R.string.diagnostics_native_engine),+                    stringResource(+                        if (state.nativeEngineAvailable) R.string.diagnostics_loaded+                        else R.string.diagnostics_unavailable+                    ),+                )+                DiagRow(+                    stringResource(R.string.diagnostics_landmarks),+                    state.landmarkCount.toString(),+                )+                DiagRow(+                    stringResource(R.string.diagnostics_scale_confidence),+                    "%.2f".format(state.scaleConfidence),+                )             }             SettingsDivider()-            SettingsSection(title = "Tracking") {-                DiagRow("Features detected", state.featureCount.toString())-                DiagRow("Features tracked", state.trackedCount.toString())-                DiagRow("Frame rate", "%.1f Hz".format(state.frameRateHz))+            SettingsSection(title = stringResource(R.string.diagnostics_section_tracking)) {+                DiagRow(+                    stringResource(R.string.diagnostics_features_detected),+                    state.featureCount.toString(),+                )+                DiagRow(+                    stringResource(R.string.diagnostics_features_tracked),+                    state.trackedCount.toString(),+                )+                DiagRow(+                    stringResource(R.string.diagnostics_frame_rate),+                    "%.1f Hz".format(state.frameRateHz),+                )             }             SettingsDivider()-            SettingsSection(title = "Sensors") {-                DiagRow("IMU rate", "%.0f Hz".format(state.imuRateHz))+            SettingsSection(title = stringResource(R.string.diagnostics_section_sensors)) {                 DiagRow(-                    "Camera/IMU clock skew",+                    stringResource(R.string.diagnostics_imu_rate),+                    "%.0f Hz".format(state.imuRateHz),+                )+                DiagRow(+                    stringResource(R.string.diagnostics_clock_skew),                     "%.1f ms".format(state.timestampSkewMs),                 )             }             SettingsDivider()-            SettingsSection(title = "Intrinsics") {-                DiagRow("Focal length", "%.1f px".format(state.focalPx))+            SettingsSection(title = stringResource(R.string.diagnostics_section_intrinsics)) {+                DiagRow(+                    stringResource(R.string.diagnostics_focal_length),+                    "%.1f px".format(state.focalPx),+                )                 DiagRow(-                    "Principal point",+                    stringResource(R.string.diagnostics_principal_point),                     "%.1f, %.1f".format(state.principalPointPx.first, state.principalPointPx.second),                 )             }             SettingsDivider()-            SettingsRow(title = "Reset tracking", onClick = actions::resetTracking)+            SettingsRow(+                title = stringResource(R.string.diagnostics_reset_tracking),+                onClick = actions::resetTracking,+            )         }     } }
measure/src/main/java/com/vayunmathur/measure/ui/LevelContent.kt
diff --git a/measure/src/main/java/com/vayunmathur/measure/ui/LevelContent.kt b/measure/src/main/java/com/vayunmathur/measure/ui/LevelContent.ktindex c62af62607..5b8f5e302f 100644--- a/measure/src/main/java/com/vayunmathur/measure/ui/LevelContent.kt+++ b/measure/src/main/java/com/vayunmathur/measure/ui/LevelContent.kt@@ -1,5 +1,6 @@ package com.vayunmathur.measure.ui +import androidx.annotation.StringRes import androidx.compose.foundation.Canvas import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column@@ -14,6 +15,7 @@ import androidx.compose.ui.draw.rotate import androidx.compose.ui.geometry.CornerRadius import androidx.compose.ui.geometry.Offset import androidx.compose.ui.graphics.drawscope.Stroke+import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import com.vayunmathur.library.ui.AppScaffold import com.vayunmathur.library.ui.IconButton@@ -22,6 +24,8 @@ import com.vayunmathur.library.ui.MaterialTheme import com.vayunmathur.library.ui.OutlinedButton import com.vayunmathur.library.ui.Text import com.vayunmathur.library.ui.appBarScrollBehavior+import com.vayunmathur.measure.R+import com.vayunmathur.measure.domain.HeldOrientation import com.vayunmathur.measure.domain.Units import com.vayunmathur.measure.platform.LevelActions import com.vayunmathur.measure.platform.LevelUiState@@ -37,7 +41,7 @@ fun LevelContent(     bottomBar: @Composable () -> Unit = {}, ) {     AppScaffold(-        title = "Level",+        title = stringResource(R.string.tool_level),         actions = { IconButton(onClick = onOpenSettings) { IconSettings() } },         bottomBar = bottomBar,         scrollBehavior = appBarScrollBehavior(),@@ -67,7 +71,11 @@ fun LevelContent(                 },             )             Text(-                if (state.isFlat) "Surface level" else state.orientation.label,+                if (state.isFlat) {+                    stringResource(R.string.level_surface_level)+                } else {+                    stringResource(state.orientation.labelRes())+                },                 style = MaterialTheme.typography.bodyMedium,                 color = MaterialTheme.colorScheme.onSurfaceVariant,             )@@ -97,11 +105,16 @@ fun LevelContent(             OutlinedButton(onClick = {                 if (state.isCalibrated) actions.clearCalibration() else actions.calibrateZero()             }) {-                Text(if (state.isCalibrated) "Clear calibration" else "Set zero here")+                Text(+                    stringResource(+                        if (state.isCalibrated) R.string.level_clear_calibration+                        else R.string.level_set_zero+                    )+                )             }             if (state.isCalibrated) {                 Text(-                    "Zeroed against a reference surface",+                    stringResource(R.string.level_zeroed),                     style = MaterialTheme.typography.bodySmall,                     color = MaterialTheme.colorScheme.onSurfaceVariant,                 )@@ -196,3 +209,18 @@ private fun EdgeBubble(angleDeg: Double, uiRotationDeg: Float, modifier: Modifie /** Deflection at which the bubble reaches the edge of its travel. */ private const val MAX_DISPLAY_DEG = 15.0 private const val LEVEL_TOLERANCE_DEG = 0.35++/**+ * Caption for how the phone is being held.+ *+ * The mapping lives here rather than on the enum so [HeldOrientation] stays free of+ * Android resource ids.+ */+@StringRes+private fun HeldOrientation.labelRes(): Int = when (this) {+    HeldOrientation.Portrait -> R.string.level_orientation_portrait+    HeldOrientation.PortraitUpsideDown -> R.string.level_orientation_portrait_upside_down+    HeldOrientation.LandscapeLeft -> R.string.level_orientation_landscape_left+    HeldOrientation.LandscapeRight -> R.string.level_orientation_landscape_right+    HeldOrientation.Flat -> R.string.level_orientation_flat+}
measure/src/main/java/com/vayunmathur/measure/ui/RulerContent.kt
diff --git a/measure/src/main/java/com/vayunmathur/measure/ui/RulerContent.kt b/measure/src/main/java/com/vayunmathur/measure/ui/RulerContent.ktindex 613ff4e856..ac9b56612f 100644--- a/measure/src/main/java/com/vayunmathur/measure/ui/RulerContent.kt+++ b/measure/src/main/java/com/vayunmathur/measure/ui/RulerContent.kt@@ -15,6 +15,7 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.geometry.Offset import androidx.compose.ui.input.pointer.pointerInput+import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.TextStyle import androidx.compose.ui.text.drawText import androidx.compose.ui.text.rememberTextMeasurer@@ -26,6 +27,7 @@ import com.vayunmathur.library.ui.IconSettings import com.vayunmathur.library.ui.MaterialTheme import com.vayunmathur.library.ui.Text import com.vayunmathur.library.ui.appBarScrollBehavior+import com.vayunmathur.measure.R import com.vayunmathur.measure.data.model.UnitSystem import com.vayunmathur.measure.domain.Units import com.vayunmathur.measure.platform.RulerUiState@@ -39,7 +41,7 @@ fun RulerContent(     var markerY by remember { mutableFloatStateOf(0f) }      AppScaffold(-        title = "Ruler",+        title = stringResource(R.string.tool_ruler),         actions = { IconButton(onClick = onOpenSettings) { IconSettings() } },         bottomBar = bottomBar,         scrollBehavior = appBarScrollBehavior(),@@ -56,7 +58,7 @@ fun RulerContent(                 modifier = Modifier.padding(top = 8.dp),             )             Text(-                "Drag the line; read against either edge",+                stringResource(R.string.ruler_hint),                 style = MaterialTheme.typography.bodySmall,                 color = MaterialTheme.colorScheme.onSurfaceVariant,                 modifier = Modifier.padding(bottom = 4.dp),
measure/src/main/java/com/vayunmathur/measure/ui/SavedMeasurementsContent.kt
diff --git a/measure/src/main/java/com/vayunmathur/measure/ui/SavedMeasurementsContent.kt b/measure/src/main/java/com/vayunmathur/measure/ui/SavedMeasurementsContent.ktindex 8b48901bc2..5fb8be241f 100644--- a/measure/src/main/java/com/vayunmathur/measure/ui/SavedMeasurementsContent.kt+++ b/measure/src/main/java/com/vayunmathur/measure/ui/SavedMeasurementsContent.kt@@ -9,6 +9,7 @@ import androidx.compose.foundation.lazy.items import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier+import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import com.vayunmathur.library.ui.AppScaffold import com.vayunmathur.library.ui.IconButton@@ -17,6 +18,7 @@ import com.vayunmathur.library.ui.MaterialTheme import com.vayunmathur.library.ui.SettingsRow import com.vayunmathur.library.ui.Text import com.vayunmathur.library.ui.appBarScrollBehavior+import com.vayunmathur.measure.R import com.vayunmathur.measure.data.model.MeasurementKind import com.vayunmathur.measure.data.model.SavedMeasurement import com.vayunmathur.measure.data.model.UnitSystem@@ -30,16 +32,23 @@ fun SavedMeasurementsContent(     actions: SavedActions,     onBack: () -> Unit = {}, ) {-    AppScaffold(title = "Saved", onNavigateBack = onBack, scrollBehavior = appBarScrollBehavior()) { padding ->+    AppScaffold(+        title = stringResource(R.string.saved_title),+        onNavigateBack = onBack,+        scrollBehavior = appBarScrollBehavior(),+    ) { padding ->         if (state.measurements.isEmpty()) {             Column(                 modifier = Modifier.fillMaxSize().padding(padding).padding(32.dp),                 horizontalAlignment = Alignment.CenterHorizontally,                 verticalArrangement = Arrangement.Center,             ) {-                Text("No saved measurements", style = MaterialTheme.typography.titleMedium)                 Text(-                    "Measure something in AR and tap save",+                    stringResource(R.string.saved_empty_title),+                    style = MaterialTheme.typography.titleMedium,+                )+                Text(+                    stringResource(R.string.saved_empty_body),                     style = MaterialTheme.typography.bodyMedium,                     color = MaterialTheme.colorScheme.onSurfaceVariant,                 )
measure/src/main/java/com/vayunmathur/measure/ui/SettingsContent.kt
diff --git a/measure/src/main/java/com/vayunmathur/measure/ui/SettingsContent.kt b/measure/src/main/java/com/vayunmathur/measure/ui/SettingsContent.ktindex e8cdaffccb..49ea316ac8 100644--- a/measure/src/main/java/com/vayunmathur/measure/ui/SettingsContent.kt+++ b/measure/src/main/java/com/vayunmathur/measure/ui/SettingsContent.kt@@ -7,6 +7,7 @@ import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.verticalScroll import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier+import androidx.compose.ui.res.stringResource import com.vayunmathur.library.ui.AppScaffold import com.vayunmathur.library.ui.SettingsDivider import com.vayunmathur.library.ui.SettingsRow@@ -14,6 +15,7 @@ import com.vayunmathur.library.ui.SettingsSection import com.vayunmathur.library.ui.SettingsSwitchRow import com.vayunmathur.library.ui.Text import com.vayunmathur.library.ui.appBarScrollBehavior+import com.vayunmathur.measure.R import com.vayunmathur.measure.data.model.UnitSystem import com.vayunmathur.measure.platform.SettingsActions import com.vayunmathur.measure.platform.SettingsUiState@@ -26,77 +28,90 @@ fun SettingsContent(     onOpenDiagnostics: () -> Unit = {},     onOpenSaved: () -> Unit = {}, ) {-    AppScaffold(title = "Settings", onNavigateBack = onBack, scrollBehavior = appBarScrollBehavior()) { padding ->+    AppScaffold(+        title = stringResource(R.string.settings_title),+        onNavigateBack = onBack,+        scrollBehavior = appBarScrollBehavior(),+    ) { padding ->         Column(             // The list is taller than the dialog on most phones; without this the             // advanced section at the bottom is simply unreachable.             modifier = Modifier.fillMaxSize().padding(padding).verticalScroll(rememberScrollState()),         ) {-            SettingsSection(title = "Units") {+            SettingsSection(title = stringResource(R.string.settings_section_units)) {                 SettingsSwitchRow(-                    title = "Imperial units",-                    supportingText = "Feet and inches instead of metres",+                    title = stringResource(R.string.settings_imperial_units),+                    supportingText = stringResource(R.string.settings_imperial_units_summary),                     checked = state.unitSystem == UnitSystem.Imperial,                     onCheckedChange = {                         actions.setUnitSystem(if (it) UnitSystem.Imperial else UnitSystem.Metric)                     },                 )                 SettingsSwitchRow(-                    title = "Fractional inches",-                    supportingText = "Show 3/16\" rather than 0.19\"",+                    title = stringResource(R.string.settings_fractional_inches),+                    supportingText = stringResource(R.string.settings_fractional_inches_summary),                     checked = state.useFractionalInches,                     enabled = state.unitSystem == UnitSystem.Imperial,                     onCheckedChange = actions::setUseFractionalInches,                 )             }             SettingsDivider()-            SettingsSection(title = "Compass") {+            SettingsSection(title = stringResource(R.string.tool_compass)) {                 SettingsSwitchRow(-                    title = "Use true north",-                    supportingText = "Corrects for magnetic declination at your location",+                    title = stringResource(R.string.settings_use_true_north),+                    supportingText = stringResource(R.string.settings_use_true_north_summary),                     checked = state.useTrueNorth,                     onCheckedChange = actions::setUseTrueNorth,                 )             }             SettingsDivider()-            SettingsSection(title = "Calibration") {+            SettingsSection(title = stringResource(R.string.settings_section_calibration)) {                 SettingsRow(-                    title = "Level",-                    supportingText = if (state.levelCalibrated) {-                        "Zeroed against a reference surface"-                    } else {-                        "Using raw gravity reading"-                    },+                    title = stringResource(R.string.tool_level),+                    supportingText = stringResource(+                        if (state.levelCalibrated) R.string.level_zeroed+                        else R.string.settings_level_uncalibrated_summary+                    ),                     enabled = state.levelCalibrated,                     onClick = actions::clearLevelCalibration,-                    trailingContent = { if (state.levelCalibrated) Text("Clear") },+                    trailingContent = {+                        if (state.levelCalibrated) Text(stringResource(R.string.settings_clear))+                    },                 )             }             SettingsDivider()-            SettingsSection(title = "General") {+            SettingsSection(title = stringResource(R.string.settings_section_general)) {                 SettingsSwitchRow(-                    title = "Haptic feedback",+                    title = stringResource(R.string.settings_haptic_feedback),                     checked = state.hapticsEnabled,                     onCheckedChange = actions::setHapticsEnabled,                 )                 SettingsSwitchRow(-                    title = "Keep screen on",-                    supportingText = "While a measuring tool is open",+                    title = stringResource(R.string.settings_keep_screen_on),+                    supportingText = stringResource(R.string.settings_keep_screen_on_summary),                     checked = state.keepScreenOn,                     onCheckedChange = actions::setKeepScreenOn,                 )-                SettingsRow(title = "Saved measurements", onClick = onOpenSaved)+                SettingsRow(+                    title = stringResource(R.string.settings_saved_measurements),+                    onClick = onOpenSaved,+                )             }             SettingsDivider()-            SettingsSection(title = "Advanced") {+            SettingsSection(title = stringResource(R.string.settings_section_advanced)) {                 SettingsSwitchRow(-                    title = "Tracking diagnostics",-                    supportingText = "Feature counts, IMU rate and clock skew",+                    title = stringResource(R.string.settings_tracking_diagnostics),+                    supportingText = stringResource(+                        R.string.settings_tracking_diagnostics_summary+                    ),                     checked = state.showDiagnostics,                     onCheckedChange = actions::setShowDiagnostics,                 )                 if (state.showDiagnostics) {-                    SettingsRow(title = "Open diagnostics", onClick = onOpenDiagnostics)+                    SettingsRow(+                        title = stringResource(R.string.settings_open_diagnostics),+                        onClick = onOpenDiagnostics,+                    )                 }             }         }
measure/src/main/java/com/vayunmathur/measure/ui/components/MeasureBottomBar.kt
diff --git a/measure/src/main/java/com/vayunmathur/measure/ui/components/MeasureBottomBar.kt b/measure/src/main/java/com/vayunmathur/measure/ui/components/MeasureBottomBar.ktindex c7cc8551ea..de6d249ce2 100644--- a/measure/src/main/java/com/vayunmathur/measure/ui/components/MeasureBottomBar.kt+++ b/measure/src/main/java/com/vayunmathur/measure/ui/components/MeasureBottomBar.kt@@ -1,6 +1,7 @@ package com.vayunmathur.measure.ui.components  import androidx.compose.runtime.Composable+import androidx.compose.ui.res.stringResource import com.vayunmathur.library.ui.IconArea import com.vayunmathur.library.ui.IconCompass import com.vayunmathur.library.ui.IconRuler@@ -8,6 +9,7 @@ import com.vayunmathur.library.ui.IconToolsLevel import com.vayunmathur.library.util.BottomBarItem import com.vayunmathur.library.util.BottomNavBar import com.vayunmathur.library.util.NavBackStack+import com.vayunmathur.measure.R import com.vayunmathur.measure.Route  /** The four tools, as one tab bar shared by every top-level page. */@@ -16,10 +18,10 @@ fun MeasureBottomBar(backStack: NavBackStack<Route>, current: Route) {     BottomNavBar(         backStack = backStack,         pages = listOf(-            BottomBarItem("Compass", Route.Compass) { IconCompass() },-            BottomBarItem("Level", Route.Level) { IconToolsLevel() },-            BottomBarItem("Ruler", Route.Ruler) { IconRuler() },-            BottomBarItem("Measure", Route.ArMeasure) { IconArea() },+            BottomBarItem(stringResource(R.string.tool_compass), Route.Compass) { IconCompass() },+            BottomBarItem(stringResource(R.string.tool_level), Route.Level) { IconToolsLevel() },+            BottomBarItem(stringResource(R.string.tool_ruler), Route.Ruler) { IconRuler() },+            BottomBarItem(stringResource(R.string.tool_measure), Route.ArMeasure) { IconArea() },         ),         currentPage = current,     )
measure/src/main/res/values/strings.xml
diff --git a/measure/src/main/res/values/strings.xml b/measure/src/main/res/values/strings.xmlindex 3d0fad682a..957b2527cc 100644--- a/measure/src/main/res/values/strings.xml+++ b/measure/src/main/res/values/strings.xml@@ -1,4 +1,233 @@ <?xml version="1.0" encoding="utf-8"?> <resources>     <string name="app_name">Measure</string>++    <!-- Bottom navigation tab label and screen title for the compass tool. -->+    <string name="tool_compass">Compass</string>+    <!-- Bottom navigation tab label and screen title for the spirit-level tool, which shows+         whether a surface is horizontal. This is a builder's level (a bubble level), NOT a+         level in a game and NOT a fill level. Noun. -->+    <string name="tool_level">Level</string>+    <!-- Bottom navigation tab label and screen title for the on-screen ruler tool. Noun. -->+    <string name="tool_ruler">Ruler</string>+    <!-- Bottom navigation tab label and screen title for the augmented-reality distance+         measuring tool. Noun, the name of the tool; also the app name. -->+    <string name="tool_measure">Measure</string>++    <!-- CompassContent: caption under the bearing, when the reading is corrected for magnetic+         declination and so points at the geographic north pole. -->+    <string name="compass_true_north">True north</string>+    <!-- CompassContent: caption under the bearing, when the reading is uncorrected and so+         points at the magnetic north pole. -->+    <string name="compass_magnetic_north">Magnetic north</string>+    <!-- CompassContent: warning shown when the phone is tilted too far for the magnetometer+         reading to be trusted. -->+    <string name="compass_tilt_warning">Hold the phone flat for an accurate bearing</string>+    <!-- CompassContent: magnetic declination readout. %1$s is a signed angle already formatted+         with a degree sign, e.g. "-3.4°". -->+    <string name="compass_declination">Declination %1$s</string>+    <!-- CompassContent: shown instead of the declination when there is no location fix, so the+         declination correction cannot be computed. -->+    <string name="compass_no_location">No location — showing magnetic north only</string>+    <!-- CompassContent: button that switches the readout from true north to magnetic north. -->+    <string name="compass_show_magnetic">Show magnetic</string>+    <!-- CompassContent: button that switches the readout from magnetic north to true north. -->+    <string name="compass_show_true_north">Show true north</string>+    <!-- CompassContent: button that freezes a marker on the dial at the current bearing. -->+    <string name="compass_hold_bearing">Hold bearing</string>+    <!-- CompassContent: button that removes the frozen bearing marker from the dial. -->+    <string name="compass_release_bearing">Release bearing</string>++    <!-- CompassContent: the sixteen compass points, in clockwise order starting at north.+         Used both for the N/E/S/W letters drawn on the dial (entries 1, 5, 9 and 13) and for+         the abbreviation shown next to the numeric bearing. These are abbreviations, not full+         words: keep them short (1-3 characters) or they will not fit on the dial. The order is+         fixed and must not be changed. -->+    <string-array name="compass_cardinals">+        <item>N</item>+        <item>NNE</item>+        <item>NE</item>+        <item>ENE</item>+        <item>E</item>+        <item>ESE</item>+        <item>SE</item>+        <item>SSE</item>+        <item>S</item>+        <item>SSW</item>+        <item>SW</item>+        <item>WSW</item>+        <item>W</item>+        <item>WNW</item>+        <item>NW</item>+        <item>NNW</item>+    </string-array>++    <!-- LevelContent: caption shown when the phone is lying flat, so the level is reading the+         tilt of the surface underneath it in two axes. -->+    <string name="level_surface_level">Surface level</string>+    <!-- LevelContent: caption naming how the phone is currently being held - upright. -->+    <string name="level_orientation_portrait">Portrait</string>+    <!-- LevelContent: caption naming how the phone is currently being held - upright but+         rotated a half turn, so the top edge points at the ground. -->+    <string name="level_orientation_portrait_upside_down">Portrait, upside down</string>+    <!-- LevelContent: caption naming how the phone is currently being held - sideways, with+         its left-hand edge resting on the ground. -->+    <string name="level_orientation_landscape_left">Landscape, left edge down</string>+    <!-- LevelContent: caption naming how the phone is currently being held - sideways, with+         its right-hand edge resting on the ground. -->+    <string name="level_orientation_landscape_right">Landscape, right edge down</string>+    <!-- LevelContent: caption naming how the phone is currently being held - lying flat on+         its back. -->+    <string name="level_orientation_flat">Flat</string>+    <!-- LevelContent: button that discards the stored zero offset and returns the level to+         the raw sensor reading. -->+    <string name="level_clear_calibration">Clear calibration</string>+    <!-- LevelContent: button that stores the current tilt as the new zero, so a surface known+         to be flat reads as level. -->+    <string name="level_set_zero">Set zero here</string>+    <!-- LevelContent caption and SettingsContent supporting text: the level has a stored zero+         offset taken from a surface the user declared flat. -->+    <string name="level_zeroed">Zeroed against a reference surface</string>++    <!-- RulerContent: instruction under the reading, explaining how to use the on-screen+         ruler. "the line" is the draggable marker line across the screen. -->+    <string name="ruler_hint">Drag the line; read against either edge</string>++    <!-- ArMeasureContent: button that joins the last placed point back to the first, turning+         an open chain of points into a closed shape so its area can be measured. -->+    <string name="ar_close_shape">Close shape</string>+    <!-- ArMeasureContent: button that removes every placed measuring point. Verb. -->+    <string name="ar_clear_points">Clear</string>+    <!-- ArMeasureContent: coaching banner while tracking starts up. The app genuinely cannot+         work out real-world scale until the phone is physically moved, so this is an+         instruction, not a progress message. -->+    <string name="ar_tracking_initialising">Move the phone sideways and turn it slightly to start tracking</string>+    <!-- ArMeasureContent: coaching banner when tracking is unreliable. "texture" means visible+         detail or pattern on the surface, which the camera needs in order to track. -->+    <string name="ar_tracking_limited">Tracking is weak — move slowly and keep texture in view</string>+    <!-- ArMeasureContent: coaching banner when tracking has failed entirely. -->+    <string name="ar_tracking_lost">Tracking lost — point at a textured surface to recover</string>+    <!-- ArMeasureContent: coaching banner when tracking is good and a surface has been found,+         so the user can start measuring. -->+    <string name="ar_tracking_ready">Ready — tap to place points</string>+    <!-- ArMeasureContent: coaching banner when tracking is good but no surface has been+         detected yet to place points on. -->+    <string name="ar_tracking_ready_no_surface">Ready — no surface found yet</string>+    <!-- ArMeasureContent: area readout. %1$s is an already-formatted area with its unit,+         e.g. "2.40 m²". -->+    <string name="ar_area">Area %1$s</string>+    <!-- ArMeasureContent: perimeter readout for a closed shape. %1$s is an already-formatted+         length with its unit, e.g. "6.20 m". -->+    <string name="ar_perimeter">Perimeter %1$s</string>+    <!-- ArMeasureContent: heading shown in place of the camera view when AR measuring cannot+         run at all. -->+    <string name="ar_unavailable_title">AR measure unavailable</string>+    <!-- ArMeasureContent: reason shown under ar_unavailable_title when the device does not+         ship the native tracking library. -->+    <string name="ar_unavailable_native">AR measuring needs the native tracking engine, which isn\'t available on this device.</string>+    <!-- ArMeasureContent: reason shown under ar_unavailable_title when the camera permission+         has not been granted. -->+    <string name="ar_unavailable_camera">Camera access is needed to measure in AR.</string>++    <!-- SavedMeasurementsContent: screen title for the list of measurements the user kept. -->+    <string name="saved_title">Saved</string>+    <!-- SavedMeasurementsContent: heading of the empty state. -->+    <string name="saved_empty_title">No saved measurements</string>+    <!-- SavedMeasurementsContent: body of the empty state, telling the user how to add one. -->+    <string name="saved_empty_body">Measure something in AR and tap save</string>+    <!-- MeasureViewModel: name given to a saved measurement when the user left the name+         blank. Shown as the row title in the saved list. Noun. -->+    <string name="saved_default_label">Measurement</string>++    <!-- SettingsContent: screen title. -->+    <string name="settings_title">Settings</string>+    <!-- SettingsContent: section heading over the unit-system options. Noun, plural - units of+         measurement such as metres or feet. -->+    <string name="settings_section_units">Units</string>+    <!-- SettingsContent: switch that shows lengths in feet and inches instead of metres. -->+    <string name="settings_imperial_units">Imperial units</string>+    <!-- SettingsContent: supporting text under settings_imperial_units. -->+    <string name="settings_imperial_units_summary">Feet and inches instead of metres</string>+    <!-- SettingsContent: switch that shows inches as tape-measure fractions rather than as a+         decimal. -->+    <string name="settings_fractional_inches">Fractional inches</string>+    <!-- SettingsContent: supporting text under settings_fractional_inches. The two examples+         are the same length written both ways; the straight quote is the inch symbol and+         should be kept. -->+    <string name="settings_fractional_inches_summary">Show 3/16\" rather than 0.19\"</string>+    <!-- SettingsContent: switch that corrects compass bearings for magnetic declination. -->+    <string name="settings_use_true_north">Use true north</string>+    <!-- SettingsContent: supporting text under settings_use_true_north. -->+    <string name="settings_use_true_north_summary">Corrects for magnetic declination at your location</string>+    <!-- SettingsContent: section heading over the level calibration row. Noun. -->+    <string name="settings_section_calibration">Calibration</string>+    <!-- SettingsContent: supporting text on the level calibration row when no zero offset has+         been stored, so the level shows the raw accelerometer reading. -->+    <string name="settings_level_uncalibrated_summary">Using raw gravity reading</string>+    <!-- SettingsContent: trailing action on the level calibration row, which discards the+         stored zero offset. Verb. -->+    <string name="settings_clear">Clear</string>+    <!-- SettingsContent: section heading over the miscellaneous options. -->+    <string name="settings_section_general">General</string>+    <!-- SettingsContent: switch for vibration on interaction. -->+    <string name="settings_haptic_feedback">Haptic feedback</string>+    <!-- SettingsContent: switch that stops the display sleeping. -->+    <string name="settings_keep_screen_on">Keep screen on</string>+    <!-- SettingsContent: supporting text under settings_keep_screen_on. -->+    <string name="settings_keep_screen_on_summary">While a measuring tool is open</string>+    <!-- SettingsContent: row that opens the list of saved measurements. -->+    <string name="settings_saved_measurements">Saved measurements</string>+    <!-- SettingsContent: section heading over the developer-facing options. -->+    <string name="settings_section_advanced">Advanced</string>+    <!-- SettingsContent: switch that reveals the AR tracking diagnostics screen. -->+    <string name="settings_tracking_diagnostics">Tracking diagnostics</string>+    <!-- SettingsContent: supporting text under settings_tracking_diagnostics. "IMU" is the+         inertial measurement unit, the accelerometer and gyroscope; keep the abbreviation. -->+    <string name="settings_tracking_diagnostics_summary">Feature counts, IMU rate and clock skew</string>+    <!-- SettingsContent: row that opens the tracking diagnostics screen. -->+    <string name="settings_open_diagnostics">Open diagnostics</string>++    <!-- DiagnosticsContent: screen title. Technical readouts for the AR tracker. -->+    <string name="diagnostics_title">Diagnostics</string>+    <!-- DiagnosticsContent: section heading over readouts from the native tracking engine. -->+    <string name="diagnostics_section_engine">Engine</string>+    <!-- DiagnosticsContent: row label for whether the native tracking library loaded. -->+    <string name="diagnostics_native_engine">Native engine</string>+    <!-- DiagnosticsContent: value of the diagnostics_native_engine row when the native library+         loaded successfully. Lowercase intentional - it sits in a value column. -->+    <string name="diagnostics_loaded">loaded</string>+    <!-- DiagnosticsContent: value of the diagnostics_native_engine row when the native library+         is missing. Lowercase intentional - it sits in a value column. -->+    <string name="diagnostics_unavailable">unavailable</string>+    <!-- DiagnosticsContent: row label for the number of 3D points the tracker is holding. -->+    <string name="diagnostics_landmarks">Landmarks</string>+    <!-- DiagnosticsContent: row label for how confident the tracker is in its real-world+         scale estimate. -->+    <string name="diagnostics_scale_confidence">Scale confidence</string>+    <!-- DiagnosticsContent: section heading over per-frame tracking readouts. -->+    <string name="diagnostics_section_tracking">Tracking</string>+    <!-- DiagnosticsContent: row label for how many image features were found this frame. -->+    <string name="diagnostics_features_detected">Features detected</string>+    <!-- DiagnosticsContent: row label for how many of those features were matched to the+         previous frame. -->+    <string name="diagnostics_features_tracked">Features tracked</string>+    <!-- DiagnosticsContent: row label for the camera frame rate. -->+    <string name="diagnostics_frame_rate">Frame rate</string>+    <!-- DiagnosticsContent: section heading over readouts from the motion sensors. -->+    <string name="diagnostics_section_sensors">Sensors</string>+    <!-- DiagnosticsContent: row label for the sample rate of the inertial measurement unit.+         Keep the "IMU" abbreviation. -->+    <string name="diagnostics_imu_rate">IMU rate</string>+    <!-- DiagnosticsContent: row label for the timestamp gap between the camera and the+         inertial measurement unit. Keep the "IMU" abbreviation. -->+    <string name="diagnostics_clock_skew">Camera/IMU clock skew</string>+    <!-- DiagnosticsContent: section heading over the camera's calibration constants. Noun,+         plural - the camera intrinsic parameters. -->+    <string name="diagnostics_section_intrinsics">Intrinsics</string>+    <!-- DiagnosticsContent: row label for the camera's focal length in pixels. -->+    <string name="diagnostics_focal_length">Focal length</string>+    <!-- DiagnosticsContent: row label for the camera's optical centre, in pixels. -->+    <string name="diagnostics_principal_point">Principal point</string>+    <!-- DiagnosticsContent: row that restarts the AR tracking session from scratch. -->+    <string name="diagnostics_reset_tracking">Reset tracking</string> </resources>
measure/src/test/java/com/vayunmathur/measure/domain/UnitsTest.kt
diff --git a/measure/src/test/java/com/vayunmathur/measure/domain/UnitsTest.kt b/measure/src/test/java/com/vayunmathur/measure/domain/UnitsTest.ktindex b1385a2b9e..a1259909e0 100644--- a/measure/src/test/java/com/vayunmathur/measure/domain/UnitsTest.kt+++ b/measure/src/test/java/com/vayunmathur/measure/domain/UnitsTest.kt@@ -70,11 +70,11 @@ class UnitsTest {      @Test     fun `cardinal points map to the nearest sixteenth`() {-        assertEquals("N", Units.cardinal(0.0))-        assertEquals("N", Units.cardinal(359.0))-        assertEquals("NE", Units.cardinal(45.0))-        assertEquals("S", Units.cardinal(180.0))-        assertEquals("W", Units.cardinal(270.0))+        assertEquals(0, Units.cardinalIndex(0.0))+        assertEquals(0, Units.cardinalIndex(359.0))+        assertEquals(2, Units.cardinalIndex(45.0))+        assertEquals(8, Units.cardinalIndex(180.0))+        assertEquals(12, Units.cardinalIndex(270.0))     }      @Test