Arrival Issue
This commit is contained in:
@@ -17,8 +17,8 @@ android {
|
||||
applicationId = "com.kouros.navigation"
|
||||
minSdk = 33
|
||||
targetSdk = 36
|
||||
versionCode = 84
|
||||
versionName = "0.2.0.84"
|
||||
versionCode = 85
|
||||
versionName = "0.2.0.85"
|
||||
base.archivesName = "navi-$versionName"
|
||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
|
||||
@@ -475,8 +475,8 @@ class NavigationSession : Session(), NavigationListener, NavigationObserverCallb
|
||||
checkTraffic(currentDate, location)
|
||||
updateSpeedCamera(location)
|
||||
checkRoute(currentDate, location)
|
||||
checkArrival()
|
||||
updateNavigationScreen()
|
||||
checkArrival()
|
||||
|
||||
snapLocation(location, streetName)
|
||||
}
|
||||
@@ -508,7 +508,7 @@ class NavigationSession : Session(), NavigationListener, NavigationObserverCallb
|
||||
* Updates the navigation screen with new trip information.
|
||||
*/
|
||||
fun updateNavigationScreen() {
|
||||
if (routeModel.navState.destination.name.isEmpty()
|
||||
if (routeModel.isNavigating() && routeModel.navState.destination.name.isEmpty()
|
||||
&& routeModel.navState.destination.street.isEmpty()) {
|
||||
return
|
||||
}
|
||||
@@ -568,6 +568,8 @@ class NavigationSession : Session(), NavigationListener, NavigationObserverCallb
|
||||
settingsViewModel.onLastRouteChanged("")
|
||||
routeModel.navState = routeModel.navState.copy(arrived = true)
|
||||
surfaceRenderer.routeData.value = ""
|
||||
navigationScreen.navigationType = NavigationType.ARRIVAL
|
||||
invalidateScreen()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@ class Simulation {
|
||||
if (routeModel.navState.route.isRouteValid()) {
|
||||
if (BuildConfig.DEBUG) {
|
||||
gpxSimulation(routeModel, lifecycleScope, updateLocation)
|
||||
//currentSimulation(routeModel, lifecycleScope, updateLocation)
|
||||
} else {
|
||||
currentSimulation(routeModel, lifecycleScope, updateLocation)
|
||||
}
|
||||
@@ -46,24 +47,26 @@ class Simulation {
|
||||
var lastLocation = Location(LocationManager.FUSED_PROVIDER)
|
||||
var curBearing = 0f
|
||||
simulationJob = lifecycleScope.launch {
|
||||
for (point in points) {
|
||||
val fakeLocation = Location(LocationManager.FUSED_PROVIDER).apply {
|
||||
latitude = point[1]
|
||||
longitude = point[0]
|
||||
bearing = curBearing
|
||||
speedAccuracyMetersPerSecond = 1.0f // ~1 m/s
|
||||
speed = 13.0f // ~50 km/h
|
||||
time = System.currentTimeMillis()
|
||||
elapsedRealtimeNanos = SystemClock.elapsedRealtimeNanos()
|
||||
for ((index, point) in points.withIndex()) {
|
||||
if (index >= 0) {
|
||||
val fakeLocation = Location(LocationManager.FUSED_PROVIDER).apply {
|
||||
latitude = point[1]
|
||||
longitude = point[0]
|
||||
bearing = curBearing
|
||||
speedAccuracyMetersPerSecond = 1.0f // ~1 m/s
|
||||
speed = 13.0f // ~50 km/h
|
||||
time = System.currentTimeMillis()
|
||||
elapsedRealtimeNanos = SystemClock.elapsedRealtimeNanos()
|
||||
}
|
||||
curBearing = lastLocation.bearingTo(fakeLocation)
|
||||
// Update your app's state as if a real GPS update occurred
|
||||
updateLocation(fakeLocation)
|
||||
// Wait before moving to the next point (e.g., every 1 second)
|
||||
delay(1000)
|
||||
lastLocation = fakeLocation
|
||||
}
|
||||
curBearing = lastLocation.bearingTo(fakeLocation)
|
||||
// Update your app's state as if a real GPS update occurred
|
||||
updateLocation(fakeLocation)
|
||||
// Wait before moving to the next point (e.g., every 1 second)
|
||||
delay(1000)
|
||||
lastLocation = fakeLocation
|
||||
}
|
||||
routeModel.stopNavigation()
|
||||
// routeModel.stopNavigation()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,5 @@
|
||||
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.Handler
|
||||
import androidx.car.app.CarContext
|
||||
@@ -35,7 +29,6 @@ import androidx.lifecycle.Observer
|
||||
import androidx.lifecycle.asLiveData
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import com.kouros.data.R
|
||||
import com.kouros.navigation.car.NavigationNotificationService
|
||||
import com.kouros.navigation.car.SurfaceRenderer
|
||||
import com.kouros.navigation.car.screen.settings.SettingsScreen
|
||||
import com.kouros.navigation.data.Constants
|
||||
|
||||
Reference in New Issue
Block a user