fix(android): apply edge insets to initial camera and watermark reliably - #89
Merged
Conversation
setPadding never repositions an already-set camera, so apply edge insets before the initial moveCamera in onMapReady. Whether the renderer repositions the watermark for setPadding varies by renderer version and timing (and lite mode never applies padding), so measure the watermark's layout position and translate only for the remainder, re-evaluating on every layout pass since the renderer adds and positions it asynchronously.
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
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.
Problem
Two Android edge-inset bugs, both visible on screens that reserve space for a bottom sheet via
edgeInsets:Initial camera ignores edge insets.
onMapReadymoved the camera to the initial position before applying padding. Unlike iOS (GMSMapView.paddingrepositions the camera target into the visible region), Android'ssetPaddingnever moves an already-set camera — so the initial camera centered in the full view instead of the inset viewport.Watermark position is inconsistent.
applyWatermarkTranslationassumedsetPaddingnever repositions the watermark (fix(android): reposition Google watermark with edge insets #55) and translated it unconditionally. In practice the renderer sometimes repositions it — depending on renderer version and whether the watermark view existed when padding was set — so the manual translation either double-shifted the logo off-screen or, when the asyncGoogleWatermarklookup raced and missed, never applied at all.Fix
moveCamerainonMapReady; camera updates aftersetPaddingare relative to the padded center.setPadding).OnGlobalLayoutListenersince the renderer adds and positions the watermark asynchronously; a target cache keyed on the watermark instance makes re-evaluations idempotent and avoids snapping in-flight animated inset changes.