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