-
Notifications
You must be signed in to change notification settings - Fork 154
[Android Auto] Allow early initialization #1603
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3f41b7c to
9eec41a
Compare
9eec41a to
58fb234
Compare
748743d to
c7b318a
Compare
kmadsen
commented
Aug 16, 2022
...ion-androidauto/src/main/java/com/mapbox/maps/extension/androidauto/CarMapSurfaceCallback.kt
Show resolved
Hide resolved
c7b318a to
abe6ab0
Compare
kmadsen
commented
Aug 16, 2022
extension-androidauto/src/main/java/com/mapbox/maps/extension/androidauto/MapboxCarMap.kt
Show resolved
Hide resolved
pengdev
reviewed
Aug 19, 2022
extension-androidauto/src/main/java/com/mapbox/maps/extension/androidauto/MapboxCarMapEx.kt
Outdated
Show resolved
Hide resolved
pengdev
reviewed
Aug 19, 2022
extension-androidauto/src/main/java/com/mapbox/maps/extension/androidauto/MapboxCarMapEx.kt
Outdated
Show resolved
Hide resolved
pengdev
reviewed
Aug 19, 2022
...n-androidauto/src/main/java/com/mapbox/maps/extension/androidauto/MapboxCarMapInitializer.kt
Show resolved
Hide resolved
evil159
approved these changes
Aug 19, 2022
Contributor
evil159
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM :D
pengdev
reviewed
Aug 19, 2022
...roidauto/src/main/java/com/mapbox/maps/extension/androidauto/MapboxCarMapSessionInstaller.kt
Outdated
Show resolved
Hide resolved
pengdev
reviewed
Aug 19, 2022
...roidauto/src/main/java/com/mapbox/maps/extension/androidauto/MapboxCarMapSessionInstaller.kt
Outdated
Show resolved
Hide resolved
pengdev
reviewed
Aug 19, 2022
...roidauto/src/main/java/com/mapbox/maps/extension/androidauto/MapboxCarMapSessionInstaller.kt
Outdated
Show resolved
Hide resolved
pengdev
reviewed
Aug 19, 2022
...droidauto/src/main/java/com/mapbox/maps/extension/androidauto/MapboxCarMapScreenInstaller.kt
Outdated
Show resolved
Hide resolved
pengdev
reviewed
Aug 19, 2022
...droidauto/src/main/java/com/mapbox/maps/extension/androidauto/MapboxCarMapScreenInstaller.kt
Outdated
Show resolved
Hide resolved
Member
|
In general looks good to me, besides a few nits. |
yunikkk
reviewed
Aug 19, 2022
extension-androidauto/src/main/java/com/mapbox/maps/extension/androidauto/MapboxCarMap.kt
Show resolved
Hide resolved
a892ec2 to
cfa7318
Compare
yunikkk
approved these changes
Aug 22, 2022
pengdev
approved these changes
Aug 22, 2022
7 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary of changes
The
MapboxCarMaphas boilerplate to setup in android auto because it cannot be initialized until theCarContexthas received anonCreatelifecycle callback. There is a clear pattern in any session or screen that can be resolved with an extension.Here is the current solution. You keep a nullable or
lateinit varof theMapboxCarMap. You theninita lifecycle observer which will createMapboxCarMapafter theonCreatelifecycle callback. TheMapboxCarMapObserveris an asynchronous callback, so it does not make sense to require asynchronous construction of theMapboxCarMapSynchronous construction
This change separates construction from initialization. To make it easier to configure the
MapboxCarMapbefore session is created. This is still lazy loading data, but is making the syntax and data management easier.New installers
After the MapboxCarMap can be initialized before onCreate, this makes it so you can initialize a Session or Screen with a specified configuration. This removes the need to add a lifecycle observer, but still allows you to do so . And you can specify which lifecycle your observers should be attached to (on every app open? only when the session is created? and so on).
Screens are also simple, this allows you to specify controllers like a gesture handler without thinking. The focus is put on designing
MapboxCarObserverimplementations that create the desired experiences.Pull request checklist:
@JvmOverloads,@file:JvmName, etc).make update-apito update generated api files, if there's public API changes, otherwise theverify-api-*CI steps might fail.check changelogCI step will fail.v10.[version]release branch fix / enhancement, merge it tomainfirstly and then port tov10.[version]release branch.Fixes: < Link to related issues that will be fixed by this pull request, if they exist >
PRs must be submitted under the terms of our Contributor License Agreement CLA.