Claude refactoring

This commit is contained in:
Dimitris
2026-02-25 11:09:31 +01:00
parent 5a6165dff8
commit eb6d3e4ef7
14 changed files with 553 additions and 288 deletions

View File

@@ -0,0 +1,21 @@
package com.kouros.navigation.data
import android.location.Location
import com.kouros.navigation.model.IconMapper
import com.kouros.navigation.utils.location
// Immutable Data Class
data class NavigationState (
val route: Route = Route.Builder().buildEmpty(),
val iconMapper: IconMapper = IconMapper(),
val navigating: Boolean = false,
val arrived: Boolean = false,
val travelMessage: String = "",
val maneuverType: Int = 0,
val lastLocation: Location = location(0.0, 0.0),
val currentLocation: Location = location(0.0, 0.0),
val routeBearing: Float = 0F,
val currentRouteIndex: Int = 0,
val destination: Place = Place(),
val carConnection: Int = 0,
)

View File

@@ -37,7 +37,7 @@ class TomTomRepository : NavigationRepository() {
val tomtomApiKey = runBlocking { repository.tomTomApiKeyFlow.first() }
val url =
routeUrl + "${currentLocation.latitude},${currentLocation.longitude}:${location.latitude},${location.longitude}" +
"/json?vehicleHeading=90&sectionType=traffic&report=effectiveSettings&routeType=eco" +
"/json?sectionType=traffic&report=effectiveSettings&routeType=eco" +
"&traffic=true&avoid=unpavedRoads&travelMode=car" +
"&vehicleMaxSpeed=120&vehicleCommercial=false" +
"&instructionsType=text&language=en-GB&sectionType=lanes" +

View File

@@ -6,6 +6,7 @@ import androidx.car.app.connection.CarConnection.CONNECTION_TYPE_NATIVE
import androidx.car.app.connection.CarConnection.CONNECTION_TYPE_PROJECTION
import androidx.car.app.navigation.model.Maneuver
import com.kouros.navigation.data.Constants.NEXT_STEP_THRESHOLD
import com.kouros.navigation.data.NavigationState
import com.kouros.navigation.data.Place
import com.kouros.navigation.data.Route
import com.kouros.navigation.data.StepData
@@ -23,22 +24,6 @@ import kotlin.math.absoluteValue
open class RouteModel {
// Immutable Data Class
data class NavigationState(
val route: Route = Route.Builder().buildEmpty(),
val iconMapper: IconMapper = IconMapper(),
val navigating: Boolean = false,
val arrived: Boolean = false,
val travelMessage: String = "",
val maneuverType: Int = 0,
val lastLocation: Location = location(0.0, 0.0),
val currentLocation: Location = location(0.0, 0.0),
val routeBearing: Float = 0F,
val currentRouteIndex: Int = 0,
val destination: Place = Place(),
val carConnection: Int = 0,
)
var navState = NavigationState()
val route: Route

View File

@@ -52,5 +52,7 @@
<string name="options">Optionen</string>
<string name="tomtom_api_key">TomTom ApiKey</string>
<string name="use_car_settings">Verwende Auto Einstellungen</string>
<string name="exit_number">Ausfahrt nummer</string>
<string name="navigation_icon_description">Navigations Icon</string>
</resources>

View File

@@ -38,4 +38,6 @@
<string name="options">Options</string>
<string name="tomtom_api_key">TomTom ApiKey</string>
<string name="use_car_settings">Use car settings</string>
<string name="exit_number">Exit number</string>
<string name="navigation_icon_description">Navigation icon</string>
</resources>