Compare commits
4 Commits
90010d91b7
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8ca450cd10 | ||
|
|
94d6d6d311 | ||
|
|
d81d33df43 | ||
|
|
5317a14fb3 |
@@ -17,8 +17,8 @@ android {
|
||||
applicationId = "com.kouros.navigation"
|
||||
minSdk = 33
|
||||
targetSdk = 36
|
||||
versionCode = 84
|
||||
versionName = "0.2.0.84"
|
||||
versionCode = 87
|
||||
versionName = "0.2.0.87"
|
||||
base.archivesName = "navi-$versionName"
|
||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
|
||||
@@ -472,13 +472,13 @@ class NavigationSession : Session(), NavigationListener, NavigationObserverCallb
|
||||
val streetName = routeModel.currentStep().street
|
||||
val currentDate = LocalDateTime.now(ZoneOffset.UTC)
|
||||
|
||||
snapLocation(location, streetName)
|
||||
|
||||
checkTraffic(currentDate, location)
|
||||
updateSpeedCamera(location)
|
||||
checkRoute(currentDate, location)
|
||||
checkArrival()
|
||||
updateNavigationScreen()
|
||||
|
||||
snapLocation(location, streetName)
|
||||
checkArrival()
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -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,7 +47,8 @@ class Simulation {
|
||||
var lastLocation = Location(LocationManager.FUSED_PROVIDER)
|
||||
var curBearing = 0f
|
||||
simulationJob = lifecycleScope.launch {
|
||||
for (point in points) {
|
||||
for ((index, point) in points.withIndex()) {
|
||||
if (index >= 0) {
|
||||
val fakeLocation = Location(LocationManager.FUSED_PROVIDER).apply {
|
||||
latitude = point[1]
|
||||
longitude = point[0]
|
||||
@@ -63,7 +65,8 @@ class Simulation {
|
||||
delay(1000)
|
||||
lastLocation = fakeLocation
|
||||
}
|
||||
routeModel.stopNavigation()
|
||||
}
|
||||
// routeModel.stopNavigation()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,7 +120,7 @@ class Simulation {
|
||||
if (duration > 100) {
|
||||
// delay(duration / 4)
|
||||
}
|
||||
delay(1000)
|
||||
delay(500)
|
||||
lastTime = p.time
|
||||
lastLocation = fakeLocation
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -5,6 +5,7 @@ import android.graphics.Bitmap
|
||||
import android.graphics.BitmapFactory
|
||||
import android.graphics.Canvas
|
||||
import android.graphics.Matrix
|
||||
import android.graphics.Paint
|
||||
import androidx.annotation.DrawableRes
|
||||
import androidx.car.app.model.CarIcon
|
||||
import androidx.car.app.navigation.model.LaneDirection
|
||||
@@ -181,13 +182,17 @@ class IconMapper {
|
||||
bitmaps.first().height,
|
||||
bitmaps.first().config!!
|
||||
)
|
||||
val paint = Paint().apply {
|
||||
color = android.graphics.Color.YELLOW
|
||||
}
|
||||
val canvas = Canvas(bmOverlay)
|
||||
canvas.drawBitmap(bitmaps.first(), matrix, null)
|
||||
canvas.drawBitmap(bitmaps.first(), matrix, paint)
|
||||
var i = 0
|
||||
|
||||
bitmaps.forEach { bitmap ->
|
||||
if (i > 0) {
|
||||
matrix.setTranslate(i * 45F, 0F)
|
||||
canvas.drawBitmap(bitmap, matrix, null)
|
||||
canvas.drawBitmap(bitmap, matrix, paint)
|
||||
}
|
||||
i++
|
||||
}
|
||||
|
||||
@@ -143,7 +143,7 @@ fun duration(
|
||||
val cameraDuration = if ((lastBearing - bearing).absoluteValue > 20.0) {
|
||||
2.seconds
|
||||
} else {
|
||||
1.2.seconds
|
||||
3.seconds
|
||||
//val updateDuration = java.time.Duration.between(LocalDateTime.now(), lastLocationUpdate)
|
||||
//((updateDuration!!.toMillis().absoluteValue * 1.2).toDuration(DurationUnit.MILLISECONDS))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user