This commit is contained in:
Dimitris
2026-03-16 15:09:03 +01:00
parent 5198725879
commit ada878b23c
21 changed files with 235 additions and 8724 deletions

View File

@@ -13,8 +13,8 @@ android {
applicationId = "com.kouros.navigation"
minSdk = 33
targetSdk = 36
versionCode = 68
versionName = "0.2.0.68"
versionCode = 71
versionName = "0.2.0.71"
base.archivesName = "navi-$versionName"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
@@ -69,6 +69,8 @@ android {
buildFeatures {
compose = true
}
}
dependencies {

View File

@@ -95,7 +95,9 @@ fun gpx(context: Context, mock: MockLocation) {
CoroutineScope(Dispatchers.IO).launch {
var lastLocation = location(0.0, 0.0)
val parser = GPXParser()
val input = context.resources.openRawResource(R.raw.vh)
val resourceId: Int = context.resources
.getIdentifier("vh", "raw", context.packageName)
val input = context.resources.openRawResource(resourceId)
val parsedGpx: Gpx? = parser.parse(input) // consider using a background thread
parsedGpx?.let {
val tracks = parsedGpx.tracks

View File

@@ -147,6 +147,8 @@ class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
navigationViewModel.route.value = ""
textToSpeechManager = TextToSpeechManager(applicationContext)
val repository = getSettingsRepository(applicationContext)
repository.guidanceAudioFlow.asLiveData().observe(this, Observer {
@@ -201,9 +203,10 @@ class MainActivity : ComponentActivity() {
updateInterval = 0.5.seconds, desiredAccuracy = DesiredAccuracy.Highest
)
val lastRoute by appViewModel.lastRoute.collectAsState()
if (lastRoute.isNotEmpty()) {
navigationViewModel.route.value = lastRoute
}
// use not the same route for mobile and car navigation
//if (lastRoute.isNotEmpty()) {
// navigationViewModel.route.value = lastRoute
//}
val userLocationState = rememberUserLocationState(locationProvider)
if (!useMock) {
val locationState = locationProvider.location.collectAsState()

View File

@@ -21,6 +21,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.rotate
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.unit.dp
import com.kouros.data.R
import kotlinx.coroutines.launch
@OptIn(ExperimentalMaterial3Api::class)
@@ -73,7 +74,7 @@ private fun ExpandCollapseButton(
onClick = { coroutineScope.launch { if (expanded) onCollapse() else onExpand() } },
) {
Icon(
painter = painterResource(com.kouros.android.cars.carappservice.R.drawable.keyboard_arrow_up_24px),
painter = painterResource(R.drawable.keyboard_arrow_up_24px),
contentDescription = if (expanded) "Collapse" else "Expand",
modifier = Modifier.rotate(degrees),
)