Remove close action
This commit is contained in:
@@ -17,8 +17,8 @@ android {
|
||||
applicationId = "com.kouros.navigation"
|
||||
minSdk = 33
|
||||
targetSdk = 37
|
||||
versionCode = 111
|
||||
versionName = "0.3.0.111"
|
||||
versionCode = 112
|
||||
versionName = "0.3.0.112"
|
||||
base.archivesName = "navi-$versionName"
|
||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
|
||||
@@ -404,7 +404,7 @@ class NavigationSession : CarSession(), NavigationListener, NavigationObserverCa
|
||||
screenManager.popToRoot()
|
||||
screenManager.pushForResult(
|
||||
SearchScreen(carContext, surfaceRenderer, navigationViewModel, mutableListOf())
|
||||
) { result ->
|
||||
) { _ ->
|
||||
// Handle search result if needed
|
||||
}
|
||||
}
|
||||
@@ -807,7 +807,7 @@ class NavigationSession : CarSession(), NavigationListener, NavigationObserverCa
|
||||
val bearingRoute = surfaceRenderer.lastLocation.bearingPositive(location)
|
||||
val bearingSpeedCamera = try {
|
||||
camera.tags.direction.toFloat()
|
||||
} catch (e: Exception) {
|
||||
} catch (_: Exception) {
|
||||
0F
|
||||
}
|
||||
if (camera.distance < 80) {
|
||||
@@ -825,7 +825,6 @@ class NavigationSession : CarSession(), NavigationListener, NavigationObserverCa
|
||||
private fun checkRoute(location: Location) {
|
||||
val distance = location.distanceTo(lastRouteCheckLocation)
|
||||
if (distance > checkDistance(routeModel)) {
|
||||
Log.d(TAG, "CheckRoute $distance ${checkDistance(routeModel)}")
|
||||
if (lastRouteCheckLocation.latitude != 0.0) {
|
||||
val destination = location(
|
||||
routeModel.navState.destination.longitude,
|
||||
|
||||
@@ -46,7 +46,10 @@ import org.maplibre.compose.camera.CameraState
|
||||
import org.maplibre.compose.style.BaseStyle
|
||||
import org.maplibre.spatialk.geojson.Position
|
||||
import java.time.LocalDateTime
|
||||
import kotlin.math.*
|
||||
import kotlin.math.PI
|
||||
import kotlin.math.cos
|
||||
import kotlin.math.pow
|
||||
import kotlin.math.sin
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.kouros.navigation.car.map
|
||||
|
||||
import android.location.Location
|
||||
import android.util.Log
|
||||
import androidx.compose.foundation.Canvas
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.PaddingValues
|
||||
@@ -130,6 +129,8 @@ fun MapLibre(
|
||||
TrafficLayer(traffic!!)
|
||||
RouteLayer(route)
|
||||
StartEndLayer(route)
|
||||
// change also createLineStringCollection in GeoUtils
|
||||
// Uncomment StartEndLayer
|
||||
// RouteLayerPoint(route )
|
||||
}
|
||||
SpeedCameraLayer(speedCameras)
|
||||
@@ -137,30 +138,6 @@ fun MapLibre(
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun StartEndLayer(routeData: String?) {
|
||||
if (!routeData.isNullOrEmpty()) {
|
||||
val end = createPointCollection(routeData)
|
||||
val routes = rememberGeoJsonSource(GeoJsonData.JsonString(end))
|
||||
val img = image(painterResource(R.drawable.sports_score_48px), drawAsSdf = true)
|
||||
SymbolLayer(
|
||||
id = "end-layer",
|
||||
source = routes,
|
||||
iconColor = const(Color.Black),
|
||||
iconImage = img,
|
||||
iconSize =
|
||||
interpolate(
|
||||
type = exponential(2.0f),
|
||||
input = zoom(),
|
||||
5 to const(2.0f),
|
||||
10 to const(2.0f),
|
||||
15 to const(3.0f),
|
||||
20 to const(4.0f),
|
||||
),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun RouteLayer(routeData: String?) {
|
||||
if (!routeData.isNullOrEmpty()) {
|
||||
@@ -204,6 +181,30 @@ fun TrafficLayer(trafficData: Map<String, String>) {
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun StartEndLayer(routeData: String?) {
|
||||
if (!routeData.isNullOrEmpty()) {
|
||||
val end = createPointCollection(routeData)
|
||||
val routes = rememberGeoJsonSource(GeoJsonData.JsonString(end))
|
||||
val img = image(painterResource(R.drawable.sports_score_48px), drawAsSdf = true)
|
||||
SymbolLayer(
|
||||
id = "end-layer",
|
||||
source = routes,
|
||||
iconColor = const(Color.Black),
|
||||
iconImage = img,
|
||||
iconSize =
|
||||
interpolate(
|
||||
type = exponential(2.0f),
|
||||
input = zoom(),
|
||||
5 to const(2.0f),
|
||||
10 to const(2.0f),
|
||||
15 to const(3.0f),
|
||||
20 to const(4.0f),
|
||||
),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun ClosedLayer(entry: Map.Entry<String, String>) {
|
||||
val routes = rememberGeoJsonSource(GeoJsonData.JsonString(entry.value))
|
||||
@@ -291,9 +292,9 @@ private fun routeLineWidth(base: Dp, isCasing: Boolean = false): Expression<DpVa
|
||||
fun RouteLayerPoint(routeData: String?) {
|
||||
if (!routeData.isNullOrEmpty()) {
|
||||
val routes = rememberGeoJsonSource(GeoJsonData.JsonString(routeData))
|
||||
val img = image(painterResource(R.drawable.ic_favorite_filled_white_24dp), drawAsSdf = true)
|
||||
val img = image(painterResource(R.drawable.settings_48px), drawAsSdf = true)
|
||||
SymbolLayer(
|
||||
id = "point-layer",
|
||||
id = "route-point-layer",
|
||||
source = routes,
|
||||
iconOpacity = const(2.0f),
|
||||
iconColor = const(Color.Red),
|
||||
@@ -302,10 +303,10 @@ fun RouteLayerPoint(routeData: String?) {
|
||||
interpolate(
|
||||
type = exponential(1.2f),
|
||||
input = zoom(),
|
||||
5 to const(0.4f),
|
||||
6 to const(0.6f),
|
||||
7 to const(0.8f),
|
||||
20 to const(1.0f),
|
||||
5 to const(0.8f),
|
||||
6 to const(1.0f),
|
||||
7 to const(1.2f),
|
||||
20 to const(1.4f),
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -137,13 +137,13 @@ open class NavigationScreen(
|
||||
* Creates and returns a NavigationTemplate for the active navigation state.
|
||||
*/
|
||||
private fun navigation(actionStripBuilder: ActionStrip.Builder): Template {
|
||||
actionStripBuilder.addAction(
|
||||
createAction(
|
||||
carContext,
|
||||
R.drawable.ic_close_white_24dp,
|
||||
0
|
||||
) { stopNavigation() }
|
||||
)
|
||||
// actionStripBuilder.addAction(
|
||||
// createAction(
|
||||
// carContext,
|
||||
// R.drawable.ic_close_white_24dp,
|
||||
// 0
|
||||
// ) { stopNavigation() }
|
||||
// )
|
||||
val navigationTemplate = NavigationTemplate.Builder()
|
||||
.setNavigationInfo(
|
||||
getRoutingInfo()
|
||||
|
||||
@@ -153,7 +153,6 @@ fun duration(
|
||||
lastLocationUpdate: LocalDateTime
|
||||
): Duration {
|
||||
if (viewStyle == ViewStyle.PREVIEW ||
|
||||
viewStyle == ViewStyle.PAN_VIEW ||
|
||||
viewStyle == ViewStyle.AMENITY_VIEW) {
|
||||
return 100.milliseconds
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user