maplibre / maplibre/MapLibre-Android-Auto-Sample

Fullscreen working great, but splitscreen not resizing to it's visible bounds.

Open
#12 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Kotlin
Stars
29
Forks
9
PR merge metrics
No merged PRs in 30d

Description

Does your splitscreen automatically resize with this demo's codebase? If so, can someone point to what is causing the MapView to resize?

I don't see my map resizing when transitioning from splitscreen. I have the sample app working in fullscreen mode and in splitscreen the `MapView` doesn't resize and the map is therefore not centered in the split layout.

I see that nothing interesting happens in the `onStableAreaChanged` callback, and it seems mapContainer.setSurfaceSize is only ever called with `w=800` and `h=400` from the initial `onSurfaceAvailable` callback in `MapRenderer`. I would assume, and I have tried, that the `setSurfaceSize` would be called after the app receives a new layout size in `onStableAreaChanged`. But i'm reading the the `width` and `height` of the `Rect` in `onStableAreaChanged` excludes the system UI components like the `zoom, hamburger menu, and Test button`. But the map is behind those system UI components.

So now i'm confused and unsure if this demo actually accomplishes the resizing.

I've tried setting the `mapContainer.setSurfaceSize` to `stableArea.width() + stableArea.right` and `stableArea.height() + stableArea.top` in the `onStableAreaChanged`, and this works for splitscreen, but going back to fullscreen it causes issues with not receiving the proper dimensions. It's also seen in the screenshots that the mapView is outside the "stableArea" (the stablearea has a blue rect drawn)

I must be missing something here. Obviously I can store the initial `width` and `height` from `onSurfaceAvailable` surfaceContainer, and revert back when the layout size change, and leep track of what's the biggest layout size, But I don't like that.

Image

Image

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the sample app in fullscreen and split-screen modes, then trace onSurfaceAvailable, onStableAreaChanged, and MapRenderer's mapContainer.setSurfaceSize calls. Compare the stable-area dimensions with the visible MapView bounds in both transitions. Done means the map resizes and remains centered when entering and leaving split-screen without breaking fullscreen.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, kotlin
Domain
mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.