RouteCarModel
This commit is contained in:
@@ -553,16 +553,7 @@ class NavigationSession : CarSession(), NavigationListener, NavigationObserverCa
|
||||
* Updates the trip information and notifies the listener with a new Trip object.
|
||||
* This includes destination name, address, travel estimate, and loading status.
|
||||
*/
|
||||
|
||||
val tripBuilder = Trip.Builder()
|
||||
tripBuilder.addDestination(
|
||||
routeModel.getDestination(),
|
||||
routeModel.getTravelEstimateTrip(carContext)
|
||||
)
|
||||
tripBuilder.setLoading(false)
|
||||
tripBuilder.setCurrentRoad( routeModel.getDestination().name.toString())
|
||||
tripBuilder.addStep(routeModel.getSteps(carContext).first(), routeModel.getTravelEstimateStep(carContext))
|
||||
updateTrip(tripBuilder.build())
|
||||
updateTrip(routeModel.getTrip(carContext))
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -24,6 +24,7 @@ import androidx.car.app.navigation.model.LaneDirection
|
||||
import androidx.car.app.navigation.model.Maneuver
|
||||
import androidx.car.app.navigation.model.Step
|
||||
import androidx.car.app.navigation.model.TravelEstimate
|
||||
import androidx.car.app.navigation.model.Trip
|
||||
import androidx.core.graphics.drawable.IconCompat
|
||||
import com.kouros.data.R
|
||||
import com.kouros.navigation.car.screen.createCarIcon
|
||||
@@ -165,6 +166,21 @@ class RouteCarModel : RouteModel() {
|
||||
.build()
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a trip builder object
|
||||
*/
|
||||
fun getTrip(carContext: CarContext): Trip {
|
||||
val tripBuilder = Trip.Builder()
|
||||
tripBuilder.addDestination(
|
||||
getDestination(),
|
||||
getTravelEstimateTrip(carContext)
|
||||
)
|
||||
tripBuilder.setLoading(false)
|
||||
tripBuilder.setCurrentRoad( getDestination().name.toString())
|
||||
tripBuilder.addStep(getSteps(carContext).first(), getTravelEstimateStep(carContext))
|
||||
return tripBuilder.build()
|
||||
}
|
||||
|
||||
private fun createDelay(delay: Int): CarText {
|
||||
val delayBuilder = SpannableStringBuilder()
|
||||
delayBuilder.append(
|
||||
|
||||
Reference in New Issue
Block a user