Street
This commit is contained in:
@@ -8,6 +8,7 @@ import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.material3.Badge
|
||||
import androidx.compose.material3.BadgedBox
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.ui.Modifier
|
||||
@@ -114,13 +115,13 @@ fun BuildingLayer(tiles: Source) {
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun DrawImage(width: Int, height: Int, location: Location) {
|
||||
NavigationImage(height)
|
||||
fun DrawImage(width: Int, height: Int, location: Location, street: String) {
|
||||
NavigationImage(height, street)
|
||||
Speed(width, height, location)
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun NavigationImage(height: Int) {
|
||||
fun NavigationImage(height: Int, street: String) {
|
||||
val vector = ImageVector.vectorResource(id = R.drawable.assistant_navigation_48px)
|
||||
val color = remember { NavigationColor }
|
||||
BadgedBox(
|
||||
@@ -137,6 +138,8 @@ fun NavigationImage(height: Int) {
|
||||
contentDescription = "Navigation",
|
||||
tint = color
|
||||
)
|
||||
if (street.isNotEmpty())
|
||||
Text(text=street)
|
||||
}
|
||||
}
|
||||
@Composable
|
||||
|
||||
@@ -7,7 +7,9 @@ import android.content.Intent
|
||||
import android.content.pm.PackageManager
|
||||
import android.location.Location
|
||||
import android.location.LocationManager
|
||||
import android.os.Build
|
||||
import android.util.Log
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.car.app.CarContext
|
||||
import androidx.car.app.Screen
|
||||
import androidx.car.app.ScreenManager
|
||||
@@ -85,6 +87,7 @@ class NavigationSession : Session(), NavigationScreen.Listener {
|
||||
lifecycle.addObserver(mLifeCycleObserver)
|
||||
}
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.M)
|
||||
override fun onCreateScreen(intent: Intent): Screen {
|
||||
routeModel = RouteCarModel()
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@ import androidx.car.app.AppManager
|
||||
import androidx.car.app.CarContext
|
||||
import androidx.car.app.SurfaceCallback
|
||||
import androidx.car.app.SurfaceContainer
|
||||
import androidx.compose.foundation.isSystemInDarkTheme
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
import androidx.compose.runtime.getValue
|
||||
@@ -197,7 +196,11 @@ class SurfaceRenderer(
|
||||
var target = position.target
|
||||
var localTilt = tilt
|
||||
if (!preview) {
|
||||
DrawImage(width, height,lastLocation)
|
||||
if (routeModel.isNavigating()) {
|
||||
DrawImage(width, height, lastLocation, "")
|
||||
} else {
|
||||
DrawImage(width, height, lastLocation, "")
|
||||
}
|
||||
} else {
|
||||
bearing = 0.0
|
||||
zoom = previewZoom()
|
||||
|
||||
Reference in New Issue
Block a user