From e819c09848109235314033539aab6138b7cf3ae7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dar=C3=ADo=20Sevilla=20Mu=C3=B1oz?= Date: Mon, 26 Oct 2026 09:41:56 +0100 Subject: [PATCH] fix: automatically road-route GPX stops on import --- app/src/main/java/dev/navframe/app/MainActivity.kt | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/dev/navframe/app/MainActivity.kt b/app/src/main/java/dev/navframe/app/MainActivity.kt index 026083d..ec442cc 100644 --- a/app/src/main/java/dev/navframe/app/MainActivity.kt +++ b/app/src/main/java/dev/navframe/app/MainActivity.kt @@ -356,12 +356,13 @@ open class MainActivity : Activity() { ensureActive() val current = service ?: run { hint.text = "Servicio no disponible · vuelve a cargar el GPX"; return@launch } cancelSearch(); routeDialog?.dismiss() - current.prepareImportedRoute(imported) + if (imported.isTrack) current.prepareImportedRoute(imported) lastImportedRoute = imported destination = null; destinationName = "" - hint.text = "Ruta GPX cargada" + hint.text = if (imported.isTrack) "Traza GPX cargada" else "Calculando GPX sobre carreteras…" showImportedRouteSheet(imported.name) - withPermissions(Action.IMPORT_ROUTE) + if (imported.isTrack) withPermissions(Action.IMPORT_ROUTE) + else current.calculateImportedStops(imported) } catch (cancelled: CancellationException) { throw cancelled } catch (error: Exception) { // Parser messages contain no coordinates, file paths or document contents. @@ -375,11 +376,6 @@ open class MainActivity : Activity() { val box = column().apply { setPadding(dp(20), dp(16), dp(20), dp(16)) } box.addView(label(name ?: "Ruta GPX", 20f)) box.addView(routeInfo) - lastImportedRoute?.takeIf { !it.isTrack && it.route.geometry.size in 2..50 }?.let { imported -> - box.addView(button("Calcular por carreteras · evitar autopistas") { - service?.calculateImportedStops(imported) - }) - } routeLoading = ProgressBar(this).apply { visibility = View.GONE } box.addView(routeLoading) retryRouteButton = null