-
Notifications
You must be signed in to change notification settings - Fork 133
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
[Android Auto] Add onClick example #1682
base: main
Are you sure you want to change the base?
Conversation
In order to support 1.3.0-beta.1 in an example, this repository needs to be upgraded to a new version of compileSdkVersion=33, which appears to require a newer version of kotlin. Which requires a few upgrades unrelated to this pull request For example
An option, is to remove the upgrades from the cc: @tobrun |
212034b
to
6d5fe47
Compare
6d5fe47
to
cde90b5
Compare
7ea29d8
to
334ef1d
Compare
cde90b5
to
bc04a80
Compare
Thanks for flagging @kmadsen, I'm having the team look more into above requirements |
ed5686e
to
3613a29
Compare
bc04a80
to
5e43af3
Compare
3613a29
to
b12ba1c
Compare
5e43af3
to
b6a59ed
Compare
712ec5f
to
4f1eb41
Compare
b6a59ed
to
5f66310
Compare
5f66310
to
cc1197d
Compare
val carContext = mapboxCarMap.carContext | ||
if (customCallbackEnabled) { | ||
val surfaceCallback = mapboxCarMap.prepareSurfaceCallback( | ||
carContext, initializer.onCreate(carContext) | ||
) | ||
carContext.getCarService(AppManager::class.java) | ||
.setSurfaceCallback(object : SurfaceCallbackInterceptor(surfaceCallback) { | ||
override fun onClick(x: Float, y: Float) { | ||
super.onClick(x, y) | ||
onMapSurfaceClick(x, y) | ||
} | ||
}) | ||
} else { | ||
mapboxCarMap.setup(carContext, initializer.onCreate(carContext)) | ||
} | ||
} |
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.
You can toggle between these at runtime and everything works.
All observers that are attached, will be detached and then attached with a new map surface
2f0dc6f
to
9903822
Compare
9903822
to
2b3dce7
Compare
Blocked
Status is that this example is blocked until kotlin and the compile version are upgraded. So this change is built on top of this one #1683. The other can be merged while this one could be merged after repo upgrades
Summary of changes
We would like to build things that use the new "onClick" function that is available in 1.3.0-beta.1.
Unfortunately, this feature is only available in beta and if we upgrade the mapbox extension library, we will also block our ability to create a stable release.
Fortunately, there is an easy solution that provides a mechanism for downstream developers to use our existing extension and adopt this new feature. The idea is to temporarily (or maybe not temporary) expose the
CarMapSurfaceOwner
as a public experimental class. And then a downstream developer can useMapboxCarMap.setupWithCustomCallback()
to inject their own version of the SurfaceCallback. After1.3.0
is rolled out to stable, we will be able to add theonClick
to the core sdk and we may no longer need to surface this internal class.This updates the
android-auto-app
to have the latest versions to showcase this ability.support-onclick.mov
User impact (optional)
Pull request checklist:
@JvmOverloads
,@file:JvmName
, etc).make update-api
to update generated api files, if there's public API changes, otherwise theverify-api-*
CI steps might fail.check changelog
CI step will fail.v10.[version]
release branch fix / enhancement, merge it tomain
firstly 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.