-
Notifications
You must be signed in to change notification settings - Fork 145
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
Location button is not customizable #340
Comments
If you would like to upvote the priority of this issue, please comment below or react with 👍 so we can see what is popular when we triage.@vladcioricagoogle Thank you for opening this issue. 🙏
This is an automated message, feel free to ignore. |
🎉 This issue has been resolved in version 3.1.0 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
If I understand this change correctly, it adds an additional, distinct way of handling a click on the My Location button when using a custom Composable: the standard GoogleMap onMyLocationButtonClick parameter turns dead. Seems a bit odd. |
Hi @bubenheimer . The standard Google Map listener
Both can be done independently, but ultimately feeding the standard |
@kikoso what I am saying is that "customising the click listener" is not a new feature for android-maps-compose. It has always been available in android-maps-compose via the GoogleMap After this change there are two different ways now to set a click listener. When customizing the button, then the GoogleMap function's onMyLocationButtonClick parameter is not used. (Because the default location button is not displayed, so its listener is not used.) That's not a good API design. The premise of this issue that "Current location button [] is not supporting overriding of [] it's onClick method" is wrong. |
As for how to address this issue & PR in a better way: All the PR really offers is adding a button in addition to the map and disabling the map's default button. This can go in an example, there is no reason to clutter the library with it. Also, the way this button is added to the GoogleMap AndroidView is a mess. There is no structural element around the AndroidView + Button combo, its appearance depends on whatever structural element is around the GoogleMap() call. Plus, the Button Row reuses the same modifier that's used on the AndroidView. And there is always this extra Row now, no matter if I have a custom button or not. Please undo the addition of this PR, it merely destabilizes the existing API. |
I'm a a bit confused. I want to replace the default "my location" button with a custom button, but I want the button to act as the default "my location" button in every other respect (i.e. zoom to user's location with an appropriate zoom level and start following the user). As stated in the original request:
My understanding is that customization of the button was supported by the proposed implementation:
but was later removed in #428 . Is customizing the button but not its onClick handler supported or do I need to implement a custom handler as in |
Hi @FelixZY . #428 fixed a bug that was introduced previously. There is an example customising a location button in CustomControlsActivity. TL;DR: deactivate local location button, implement your listener and add your Composable. |
@kikoso the "location button" in CustomControlsActivity simply shows a toast - it does not reposition the map to the current user location. It does not behave as the standard location button. Screencast.from.2024-07-02.16.12.23.webm |
@FelixZY, that is intended to showcase a custom behavior on the location button. You would need to replace it with the intended behavior. |
Ok. What I would like though, is for my custom button to have the same behavior as the default button. My understanding is that OPs question included this ("Current location button is not customizable [...]"), and that #347 added support for this ("This PR introduces two related features [...] * Customising the Location button."). However, this was then seemingly reverted in #428. From what I'm able to gather, it's not currently possible to get the default behavior when using a custom button. Instead, I would need to replicate the default behavior myself by listening to location updates and pushing them to the map myself, similarly to |
Current location button is not customizable and is not supporting overriding of the it's onClick method. There can be multiple use cases where the location should redirect the map to a specific location, not the current device location.
The text was updated successfully, but these errors were encountered: