Arrival Issue

This commit is contained in:
Dimitris
2026-03-28 11:17:51 +01:00
parent 90010d91b7
commit 5317a14fb3
4 changed files with 25 additions and 27 deletions

View File

@@ -17,8 +17,8 @@ android {
applicationId = "com.kouros.navigation" applicationId = "com.kouros.navigation"
minSdk = 33 minSdk = 33
targetSdk = 36 targetSdk = 36
versionCode = 84 versionCode = 85
versionName = "0.2.0.84" versionName = "0.2.0.85"
base.archivesName = "navi-$versionName" base.archivesName = "navi-$versionName"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
} }

View File

@@ -475,8 +475,8 @@ class NavigationSession : Session(), NavigationListener, NavigationObserverCallb
checkTraffic(currentDate, location) checkTraffic(currentDate, location)
updateSpeedCamera(location) updateSpeedCamera(location)
checkRoute(currentDate, location) checkRoute(currentDate, location)
checkArrival()
updateNavigationScreen() updateNavigationScreen()
checkArrival()
snapLocation(location, streetName) snapLocation(location, streetName)
} }
@@ -508,7 +508,7 @@ class NavigationSession : Session(), NavigationListener, NavigationObserverCallb
* Updates the navigation screen with new trip information. * Updates the navigation screen with new trip information.
*/ */
fun updateNavigationScreen() { fun updateNavigationScreen() {
if (routeModel.navState.destination.name.isEmpty() if (routeModel.isNavigating() && routeModel.navState.destination.name.isEmpty()
&& routeModel.navState.destination.street.isEmpty()) { && routeModel.navState.destination.street.isEmpty()) {
return return
} }
@@ -568,6 +568,8 @@ class NavigationSession : Session(), NavigationListener, NavigationObserverCallb
settingsViewModel.onLastRouteChanged("") settingsViewModel.onLastRouteChanged("")
routeModel.navState = routeModel.navState.copy(arrived = true) routeModel.navState = routeModel.navState.copy(arrived = true)
surfaceRenderer.routeData.value = "" surfaceRenderer.routeData.value = ""
navigationScreen.navigationType = NavigationType.ARRIVAL
invalidateScreen()
} }
} }

View File

@@ -28,6 +28,7 @@ class Simulation {
if (routeModel.navState.route.isRouteValid()) { if (routeModel.navState.route.isRouteValid()) {
if (BuildConfig.DEBUG) { if (BuildConfig.DEBUG) {
gpxSimulation(routeModel, lifecycleScope, updateLocation) gpxSimulation(routeModel, lifecycleScope, updateLocation)
//currentSimulation(routeModel, lifecycleScope, updateLocation)
} else { } else {
currentSimulation(routeModel, lifecycleScope, updateLocation) currentSimulation(routeModel, lifecycleScope, updateLocation)
} }
@@ -46,7 +47,8 @@ class Simulation {
var lastLocation = Location(LocationManager.FUSED_PROVIDER) var lastLocation = Location(LocationManager.FUSED_PROVIDER)
var curBearing = 0f var curBearing = 0f
simulationJob = lifecycleScope.launch { simulationJob = lifecycleScope.launch {
for (point in points) { for ((index, point) in points.withIndex()) {
if (index >= 0) {
val fakeLocation = Location(LocationManager.FUSED_PROVIDER).apply { val fakeLocation = Location(LocationManager.FUSED_PROVIDER).apply {
latitude = point[1] latitude = point[1]
longitude = point[0] longitude = point[0]
@@ -63,7 +65,8 @@ class Simulation {
delay(1000) delay(1000)
lastLocation = fakeLocation lastLocation = fakeLocation
} }
routeModel.stopNavigation() }
// routeModel.stopNavigation()
} }
} }

View File

@@ -1,11 +1,5 @@
package com.kouros.navigation.car.screen package com.kouros.navigation.car.screen
import android.content.Context
import android.content.Intent
import android.location.Location
import android.location.LocationManager
import android.os.Build
import android.os.Build.VERSION_CODES
import android.os.CountDownTimer import android.os.CountDownTimer
import android.os.Handler import android.os.Handler
import androidx.car.app.CarContext import androidx.car.app.CarContext
@@ -35,7 +29,6 @@ import androidx.lifecycle.Observer
import androidx.lifecycle.asLiveData import androidx.lifecycle.asLiveData
import androidx.lifecycle.lifecycleScope import androidx.lifecycle.lifecycleScope
import com.kouros.data.R import com.kouros.data.R
import com.kouros.navigation.car.NavigationNotificationService
import com.kouros.navigation.car.SurfaceRenderer import com.kouros.navigation.car.SurfaceRenderer
import com.kouros.navigation.car.screen.settings.SettingsScreen import com.kouros.navigation.car.screen.settings.SettingsScreen
import com.kouros.navigation.data.Constants import com.kouros.navigation.data.Constants