app(ui): replace local LAYER_FORNSOK with FoundStore.LAYER_FORNSOK in MainActivity; tidy related code
This commit is contained in:
@@ -170,9 +170,6 @@ import kotlin.math.abs
|
||||
import kotlin.math.roundToInt
|
||||
import com.google.android.gms.location.LocationServices as GmsLocationServices
|
||||
|
||||
// Extra lagersträng (vi rör inte FoundStore:s egna konstanter)
|
||||
private const val LAYER_FORNSOK = "FORNSOK"
|
||||
|
||||
class MainActivity : ComponentActivity() {
|
||||
|
||||
private lateinit var fgPermissionLauncher: ActivityResultLauncher<Array<String>>
|
||||
@@ -589,7 +586,7 @@ private fun KlottrApp(
|
||||
val d = app.klottr.util.distanceMeters(loc.latitude, loc.longitude, f.lat, f.lon).roundToInt()
|
||||
if (d <= fornsokRadius) {
|
||||
val added = FoundStore.markFound(
|
||||
context, LAYER_FORNSOK, f.id,
|
||||
context, FoundStore.LAYER_FORNSOK, f.id, // [ÄNDRAD] Använd delade konstanten från FoundStore (KMP)
|
||||
label = f.title, lat = f.lat, lon = f.lon, timeMillis = now
|
||||
)
|
||||
if (added) anyNew = true
|
||||
@@ -803,7 +800,7 @@ private fun KlottrApp(
|
||||
}
|
||||
}
|
||||
val clickable = (f.layer == FoundStore.LAYER_WIKI) ||
|
||||
(f.layer == LAYER_FORNSOK) ||
|
||||
(f.layer == FoundStore.LAYER_FORNSOK) ||
|
||||
(f.layer == FoundStore.LAYER_KLOTTER) ||
|
||||
(f.layer == FoundStore.LAYER_DM)
|
||||
|
||||
@@ -817,7 +814,7 @@ private fun KlottrApp(
|
||||
when (f.layer) {
|
||||
FoundStore.LAYER_KLOTTER -> "Okänt klotter"
|
||||
FoundStore.LAYER_DM -> "DigitaltMuseum"
|
||||
LAYER_FORNSOK -> "Fornsök"
|
||||
FoundStore.LAYER_FORNSOK -> "Fornsök"
|
||||
else -> "Wikipedia"
|
||||
}
|
||||
},
|
||||
@@ -829,7 +826,7 @@ private fun KlottrApp(
|
||||
// 1) Typ (lager)
|
||||
val layerName = when (f.layer) {
|
||||
FoundStore.LAYER_KLOTTER -> "Klotter"
|
||||
LAYER_FORNSOK -> "Fornsök"
|
||||
FoundStore.LAYER_FORNSOK -> "Fornsök"
|
||||
FoundStore.LAYER_DM -> "DigitaltMuseum"
|
||||
FoundStore.LAYER_WIKI -> "Wikipedia"
|
||||
else -> "Plats"
|
||||
@@ -864,7 +861,7 @@ private fun KlottrApp(
|
||||
val pid = f.id.toLongOrNull()
|
||||
if (pid != null) openWiki = OpenWiki(pid, f.lat, f.lon)
|
||||
}
|
||||
LAYER_FORNSOK -> {
|
||||
FoundStore.LAYER_FORNSOK -> {
|
||||
// Hämta riktiga fält (desc/type/uri) nära fyndets position innan vi öppnar dialogen
|
||||
scope.launch {
|
||||
val enriched = withContext(Dispatchers.IO) {
|
||||
@@ -1324,7 +1321,7 @@ private fun NearbyDialog(
|
||||
when (e.layer) {
|
||||
FoundStore.LAYER_WIKI -> "Wikipedia"
|
||||
FoundStore.LAYER_DM -> "DigitaltMuseum"
|
||||
LAYER_FORNSOK -> "Fornsök"
|
||||
FoundStore.LAYER_FORNSOK -> "Fornsök" // Använd delad konstant även här.
|
||||
FoundStore.LAYER_KLOTTER -> "Klotter"
|
||||
else -> "Plats"
|
||||
}
|
||||
@@ -1342,7 +1339,7 @@ private fun NearbyDialog(
|
||||
val item = dm.firstOrNull { it.id == e.id }
|
||||
if (item != null) ({ onDmClick(item) }) else null
|
||||
}
|
||||
LAYER_FORNSOK -> {
|
||||
FoundStore.LAYER_FORNSOK -> { // [ÄNDRAD] Använd delad konstant
|
||||
val item = forn.firstOrNull { it.id == e.id }
|
||||
if (item != null) ({ onFornsokClick(item) }) else null
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user