mirror of
https://github.com/Dasemu/NavFrame.git
synced 2026-11-26 23:26:09 +00:00
fix: automatically road-route GPX stops on import
This commit is contained in:
1 parent
e6ca89784f
commit
e819c09848
1 file changed
+4
-8
@@ -356,12 +356,13 @@ open class MainActivity : Activity() {
|
|||||||
ensureActive()
|
ensureActive()
|
||||||
val current = service ?: run { hint.text = "Servicio no disponible · vuelve a cargar el GPX"; return@launch }
|
val current = service ?: run { hint.text = "Servicio no disponible · vuelve a cargar el GPX"; return@launch }
|
||||||
cancelSearch(); routeDialog?.dismiss()
|
cancelSearch(); routeDialog?.dismiss()
|
||||||
current.prepareImportedRoute(imported)
|
if (imported.isTrack) current.prepareImportedRoute(imported)
|
||||||
lastImportedRoute = imported
|
lastImportedRoute = imported
|
||||||
destination = null; destinationName = ""
|
destination = null; destinationName = ""
|
||||||
hint.text = "Ruta GPX cargada"
|
hint.text = if (imported.isTrack) "Traza GPX cargada" else "Calculando GPX sobre carreteras…"
|
||||||
showImportedRouteSheet(imported.name)
|
showImportedRouteSheet(imported.name)
|
||||||
withPermissions(Action.IMPORT_ROUTE)
|
if (imported.isTrack) withPermissions(Action.IMPORT_ROUTE)
|
||||||
|
else current.calculateImportedStops(imported)
|
||||||
} catch (cancelled: CancellationException) { throw cancelled }
|
} catch (cancelled: CancellationException) { throw cancelled }
|
||||||
catch (error: Exception) {
|
catch (error: Exception) {
|
||||||
// Parser messages contain no coordinates, file paths or document contents.
|
// 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)) }
|
val box = column().apply { setPadding(dp(20), dp(16), dp(20), dp(16)) }
|
||||||
box.addView(label(name ?: "Ruta GPX", 20f))
|
box.addView(label(name ?: "Ruta GPX", 20f))
|
||||||
box.addView(routeInfo)
|
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 }
|
routeLoading = ProgressBar(this).apply { visibility = View.GONE }
|
||||||
box.addView(routeLoading)
|
box.addView(routeLoading)
|
||||||
retryRouteButton = null
|
retryRouteButton = null
|
||||||
|
|||||||
Reference in new issue
Block a user