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