Arrival Issue
This commit is contained in:
@@ -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"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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,24 +47,26 @@ 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()) {
|
||||||
val fakeLocation = Location(LocationManager.FUSED_PROVIDER).apply {
|
if (index >= 0) {
|
||||||
latitude = point[1]
|
val fakeLocation = Location(LocationManager.FUSED_PROVIDER).apply {
|
||||||
longitude = point[0]
|
latitude = point[1]
|
||||||
bearing = curBearing
|
longitude = point[0]
|
||||||
speedAccuracyMetersPerSecond = 1.0f // ~1 m/s
|
bearing = curBearing
|
||||||
speed = 13.0f // ~50 km/h
|
speedAccuracyMetersPerSecond = 1.0f // ~1 m/s
|
||||||
time = System.currentTimeMillis()
|
speed = 13.0f // ~50 km/h
|
||||||
elapsedRealtimeNanos = SystemClock.elapsedRealtimeNanos()
|
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
|
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
|
||||||
|
|||||||
Reference in New Issue
Block a user