Compare commits

...
5 Commits
Author SHA1 Message Date
johan12345 63a10d7f68 Release 2.1.3 2026-05-10 13:30:24 +02:00
johan12345 e117c844ed Merge branch 'car-app-library-1.8' 2026-05-10 13:25:22 +02:00
johan12345 36174297e5 fix Tesla login
redirect URI changed
fixes #422
2026-05-06 20:35:26 +02:00
johan12345 ac37cdde32 new map screen: keep scroll position on refresh 2026-04-24 22:12:40 +02:00
johan12345 4345ee6550 Upgrade Car App Library to 1.8.0-beta01 2026-04-24 22:12:40 +02:00
7 changed files with 69 additions and 12 deletions

No files matched your search

+3 -3
View File
@@ -21,8 +21,8 @@ android {
minSdk = 23
targetSdk = 36
// NOTE: always increase versionCode by 2 since automotive flavor uses versionCode + 1
versionCode = 274
versionName = "2.1.2"
versionCode = 276
versionName = "2.1.3"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
@@ -330,7 +330,7 @@ dependencies {
implementation("com.github.ev-map:locale-config-x:58b036abf4")
// Android Auto
val carAppVersion = "1.7.0"
val carAppVersion = "1.8.0-beta01"
implementation("androidx.car.app:app:$carAppVersion")
normalImplementation("androidx.car.app:app-projected:$carAppVersion")
automotiveImplementation("androidx.car.app:app-automotive:$carAppVersion")
@@ -25,7 +25,7 @@ interface TeslaAuthenticationApi {
class AuthCodeRequest(
val code: String,
@Json(name = "code_verifier") val codeVerifier: String,
@Json(name = "redirect_uri") val redirectUri: String = "https://auth.tesla.com/void/callback",
@Json(name = "redirect_uri") val redirectUri: String = "tesla://auth/callback",
scope: String = "openid email offline_access",
@Json(name = "client_id") clientId: String = "ownerapi"
) : OAuth2Request(scope, clientId)
@@ -98,13 +98,13 @@ interface TeslaAuthenticationApi {
.appendQueryParameter("client_id", "ownerapi")
.appendQueryParameter("code_challenge", codeChallenge)
.appendQueryParameter("code_challenge_method", "S256")
.appendQueryParameter("redirect_uri", "https://auth.tesla.com/void/callback")
.appendQueryParameter("redirect_uri", "tesla://auth/callback")
.appendQueryParameter("response_type", "code")
.appendQueryParameter("scope", "openid email offline_access phone")
.appendQueryParameter("is_in_app", "true")
.appendQueryParameter("state", "123").build()
val resultUrlPrefix = "https://auth.tesla.com/void/callback"
val resultUrlPrefix = "tesla://auth/callback"
}
}
@@ -21,6 +21,7 @@ import androidx.car.app.model.Pane
import androidx.car.app.model.Place
import androidx.car.app.model.PlaceMarker
import androidx.car.app.model.Row
import androidx.car.app.model.RowSection
import androidx.core.content.ContextCompat
import androidx.core.graphics.drawable.IconCompat
import net.vonforst.evmap.R
@@ -54,7 +55,7 @@ class ChargerListFormatter(
private val iconGen = ChargerIconGenerator(carContext, null, height = 96)
var favorites: Set<Long> = emptySet()
fun buildChargerList(
fun buildChargerListLegacy(
chargers: List<ChargeLocation>?,
availabilities: Map<Long, Pair<ZonedDateTime, ChargeLocationStatus?>>
): ItemList? {
@@ -103,6 +104,55 @@ class ChargerListFormatter(
}
}
fun buildChargerList(
chargers: List<ChargeLocation>?,
availabilities: Map<Long, Pair<ZonedDateTime, ChargeLocationStatus?>>
): RowSection? {
return if (chargers != null) {
val chargerList = chargers.take(screen.maxRows)
val builder = RowSection.Builder()
// only show the city if not all chargers are in the same city
val showCity = chargerList.map { it.address?.city }.distinct().size > 1
chargerList.forEach { charger ->
builder.addItem(
formatCharger(
charger,
availabilities,
showCity,
charger.id in favorites
)
)
}
builder.setNoItemsMessage(
carContext.getString(
if (screen.filterStatus == FILTERS_FAVORITES) {
R.string.auto_no_favorites_found
} else {
R.string.auto_no_chargers_found
}
)
)
builder.setOnItemVisibilityChangedListener(screen)
builder.build()
} else {
if (screen.loadingError) {
val builder = RowSection.Builder()
builder.setNoItemsMessage(
carContext.getString(R.string.connection_error)
)
builder.build()
} else if (screen.locationError) {
val builder = RowSection.Builder()
builder.setNoItemsMessage(
carContext.getString(R.string.location_error)
)
builder.build()
} else {
null
}
}
}
private fun formatCharger(
charger: ChargeLocation,
availabilities: Map<Long, Pair<ZonedDateTime, ChargeLocationStatus?>>,
@@ -58,7 +58,6 @@ import java.io.IOException
import java.time.Duration
import java.time.Instant
import java.time.ZonedDateTime
import kotlin.collections.set
import kotlin.math.abs
import kotlin.math.min
@@ -164,7 +163,7 @@ class LegacyMapScreen(ctx: CarContext, val session: EVMapSession) :
setAnchor(Place.Builder(CarLocation.create(it.latitude, it.longitude)).build())
}
}
formatter.buildChargerList(chargers, availabilities)?.let {
formatter.buildChargerListLegacy(chargers, availabilities)?.let {
setItemList(it)
} ?: setLoading(true)
setCurrentLocationEnabled(true)
@@ -21,9 +21,9 @@ import androidx.car.app.model.ActionStrip
import androidx.car.app.model.CarColor
import androidx.car.app.model.CarIcon
import androidx.car.app.model.Header
import androidx.car.app.model.ListTemplate
import androidx.car.app.model.MessageTemplate
import androidx.car.app.model.PaneTemplate
import androidx.car.app.model.SectionedItemTemplate
import androidx.car.app.model.Template
import androidx.car.app.navigation.model.MapController
import androidx.car.app.navigation.model.MapWithContentTemplate
@@ -213,7 +213,7 @@ class MapScreen(ctx: CarContext, val session: EVMapSession) :
}.build())
}.build()
} else {
ListTemplate.Builder().apply {
SectionedItemTemplate.Builder().apply {
setHeader(Header.Builder().apply {
setTitle(title)
setStartHeaderAction(Action.APP_ICON)
@@ -223,8 +223,10 @@ class MapScreen(ctx: CarContext, val session: EVMapSession) :
chargers?.filterIsInstance<ChargeLocation>(),
availabilities
)?.let {
setSingleList(it)
addSection(it)
} ?: setLoading(true)
setScrollStatePersistenceStrategy(SectionedItemTemplate.SCROLL_STATE_PRESERVE_INDEX)
}.build()
}
return MapWithContentTemplate.Builder().apply {
@@ -0,0 +1,3 @@
Fehler behoben:
- Android Auto: Scrollposition in der Liste nach Aktualisierung beibehalten
- Tesla Login funktionierte nicht
@@ -0,0 +1,3 @@
Bugfixes:
- Android Auto: Keep scroll position after refresh
- Tesla login was not working