shared(nearby): add layerDisplayName and wire into subtitleFor;
app(found): use shared layerDisplayName for Hittat subtitle (no UI change)
This commit is contained in:
@@ -805,13 +805,8 @@ private fun KlottrApp(
|
||||
} else base
|
||||
},
|
||||
subtitleFor = { f -> // Undertext "<lager> • <avstånd> m" (+ ev. koordinater)
|
||||
val layerName = when (f.layer) {
|
||||
FoundStore.LAYER_KLOTTER -> "Klotter"
|
||||
FoundStore.LAYER_FORNSOK -> "Fornsök"
|
||||
FoundStore.LAYER_DM -> "DigitaltMuseum"
|
||||
FoundStore.LAYER_WIKI -> "Wikipedia"
|
||||
else -> "Plats"
|
||||
}
|
||||
val layerName = app.klottr.nearby.layerDisplayName(f.layer) // Centralt visningsnamn från :shared
|
||||
|
||||
val my = LastLocationStore.lastKnownLocation //
|
||||
val distM = my?.let { app.klottr.util.distanceMeters(it.latitude, it.longitude, f.lat, f.lon).roundToInt() } //
|
||||
val distText = distM?.let { formatDistance(it) } ?: "-" //
|
||||
|
||||
12
shared/src/commonMain/kotlin/app/klottr/nearby/LayerNames.kt
Normal file
12
shared/src/commonMain/kotlin/app/klottr/nearby/LayerNames.kt
Normal file
@@ -0,0 +1,12 @@
|
||||
package app.klottr.nearby // Samlad namngivning av lager
|
||||
|
||||
import app.klottr.util.FoundStore // Lagerkonstanter
|
||||
|
||||
// Visningsnamn för lager (svenska)
|
||||
fun layerDisplayName(layer: String): String = when (layer) {
|
||||
FoundStore.LAYER_WIKI -> "Wikipedia" //
|
||||
FoundStore.LAYER_DM -> "DigitaltMuseum" //
|
||||
FoundStore.LAYER_FORNSOK -> "Fornsök" //
|
||||
FoundStore.LAYER_KLOTTER -> "Klotter" //
|
||||
else -> "Plats" //
|
||||
}
|
||||
@@ -5,14 +5,6 @@ import app.klottr.nearby.NearbyEntryShared // Vår delade radmodell
|
||||
|
||||
// Bygg undertext: "<Lager-namn> • <avstånd> m"
|
||||
fun subtitleFor(entry: NearbyEntryShared): String = buildString { //
|
||||
append(
|
||||
when (entry.layer) {
|
||||
FoundStore.LAYER_WIKI -> "Wikipedia"
|
||||
FoundStore.LAYER_DM -> "DigitaltMuseum"
|
||||
FoundStore.LAYER_FORNSOK -> "Fornsök"
|
||||
FoundStore.LAYER_KLOTTER -> "Klotter"
|
||||
else -> "Plats"
|
||||
}
|
||||
)
|
||||
append(layerDisplayName(entry.layer)) // Använd delad namngivare istället för inline-when
|
||||
append(" • ${entry.distanceM} m")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user