Skip to content
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] Added the ability to hide the recenter button in the navigation view #483

Merged
merged 3 commits into from
Mar 11, 2025

Conversation

jd-alexander
Copy link
Contributor

Summary

This PR adds a new configuration option to hide the recenter button in the navigation UI. Similar to the existing options for mute and zoom buttons, users can now control the visibility of the recenter button that appears in the bottom-left corner when the camera is not following the user's location.

Changes

  • Added a new showRecenter boolean parameter to VisualNavigationViewConfig (defaults to true for backward compatibility)
  • Added a new helper function useRecenterButton() in line with existing button visibility controls
  • Updated the NavigatingInnerGridView to check the new parameter before displaying the recenter button
  • Updated the overlay views to pass the config parameter to the inner grid view

Usage

Developers can now control the recenter button visibility as part of their navigation configuration:

val navigationConfig = VisualNavigationViewConfig.Default().copy(
    // Hide default mute button
    showMute = false,
    // Hide default zoom controls
    showZoom = false,
    // Hide recenter button
    showRecenter = false
)

Testing

The changes maintain backward compatibility, with the recenter button visible by default. The feature can be tested by configuring a navigation view with showRecenter = false and verifying that the recenter button doesn't appear when the camera is not tracking the user's location.

I am having trouble testing the changes due to issues with setting up cargo. So I need assistance with testing these changes.

Execution failed for task ':core:buildCargoNdkDebug'.
> Failed to run `cargo --version`. You probably don't have 'cargo' executable in PATH: /Users/joeldean/.rvm/gems/ruby-3.2.1/bin:/Users/joeldean/.rvm/gems/ruby-3.2.1@global/bin:/Users/joeldean/.rvm/rubies/ruby-3.2.1/bin:/Users/joeldean/.codeium/windsurf/bin:/Users/joeldean/.nvm/versions/node/v18.20.4/bin:/Users/joeldean/.local/share/pnpm:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/usr/local/MacGPG2/bin:/Users/joeldean/.orbstack/bin:/Users/joeldean/Library/Android/sdk:/Users/joeldean/Library/Android/sdk/platform-tools:/Users/joeldean/Library/Android/sdk/cmdline-tools/latest/bin:/Users/joeldean/Library/Android/sdk/emulator:/Users/joeldean/.rvm/bin:~/.npm-global/bin

- Add showRecenter parameter to VisualNavigationViewConfig (default: true)
- Add useRecenterButton() helper function
- Update NavigatingInnerGridView to check the parameter
- Pass parameter through overlay views

Similar to existing controls for mute and zoom buttons, this allows
developers to hide the recenter button that appears when the camera
is not following the user's location.
Copy link
Collaborator

@Archdoog Archdoog left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me. Looks like we've just gotta run ktfmt 👍

Copy link
Contributor

@ianthetechie ianthetechie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM; thanks! Just pushed a ktfmt fix. Will merge after CI passes.

@ianthetechie ianthetechie merged commit 6010e97 into stadiamaps:main Mar 11, 2025
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants