Skip to content

Commit

Permalink
start implementation of new MapScreen using MapWithContentTemplate
Browse files Browse the repository at this point in the history
  • Loading branch information
johan12345 committed May 4, 2024
1 parent 9614d56 commit cdd842c
Show file tree
Hide file tree
Showing 5 changed files with 1,031 additions and 147 deletions.
1 change: 1 addition & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_LOCATION" />
<uses-permission android:name="androidx.car.app.MAP_TEMPLATES" />
<uses-permission android:name="androidx.car.app.ACCESS_SURFACE" />
<uses-permission android:name="com.google.android.gms.permission.CAR_FUEL" />
<uses-permission android:name="com.google.android.gms.permission.CAR_SPEED" />

Expand Down
8 changes: 6 additions & 2 deletions app/src/main/java/net/vonforst/evmap/auto/CarAppService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import android.location.Location
import android.os.Build
import android.util.Log
import androidx.annotation.RequiresPermission
import androidx.car.app.AppManager
import androidx.car.app.CarContext
import androidx.car.app.Screen
import androidx.car.app.ScreenManager
Expand Down Expand Up @@ -125,8 +126,11 @@ class EVMapSession(val cas: CarAppService) : Session(), DefaultLifecycleObserver
}

override fun onCreateScreen(intent: Intent): Screen {

val mapScreen = MapScreen(carContext, this)
val mapScreen = if (carContext.carAppApiLevel >= 7) {
MapScreen(carContext, this)
} else {
LegacyMapScreen(carContext, this)
}
val screens = mutableListOf<Screen>(mapScreen)

handleActionsIntent(intent)?.let {
Expand Down
Loading

0 comments on commit cdd842c

Please sign in to comment.