Claude refactoring
This commit is contained in:
@@ -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,
|
||||
)
|
||||
@@ -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§ionType=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§ionType=lanes" +
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
Reference in New Issue
Block a user