Skip to content

Add a MapLibre provider, with the tile style supplied by the user #75

Description

@parawanderer

IMapProvider exists so a map is a new implementation rather than a branch inside MapsActivity — see rule 7 in AGENTS.md. Google and AMap are implemented; MapLibre is the obvious third, and it is the one most people forking this project seem to want.

Why MapLibre specifically

Its API descends from Mapbox GL, so it lines up almost one-to-one with the existing GoogleMapProvider: SymbolManager for markers, LineManager for polylines, CameraUpdateFactory, addOnMapClickListener. Porting is close to mechanical.

It also renders vector tiles, so setRotateGesturesEnabled and setCompassEnabled map onto real behaviour rather than becoming no-ops — which is what would happen with a raster library like osmdroid.

The part that makes it mergeable

MapLibre ships no tiles. It renders whatever style URL it is given, so this needs a source, and that is the whole design decision:

  • Do not bundle a key or pick a vendor. Same reasoning as rule 5 — a bundled key belongs to whoever ships the app, not to its users.
  • Take a style URL from Settings, exactly as AMap takes a key today. One provider then covers MapTiler, Stadia, Protomaps, a self-hosted style, or anything else, without this project having a relationship with any of them.
  • Selecting MapLibre without a style URL must not save, matching the AMap behaviour in Settings and on the first-run screen.
  • Defaulting to tile.openstreetmap.org is not an option: OSM's tile usage policy does not cover app traffic, and a popular app pointed at it is quietly abusing a volunteer-funded service.

Done looks like

  • MapLibreProvider implements IMapProvider — all 23 methods, no changes to MapsActivity
  • Registered in MapProviderFactory
  • A style URL field in Settings, with the same not-saveable-when-empty rule as AMap
  • Strings added through scripts/add_strings.py so all ten locales have them

Worth knowing before starting: the instrumented tests run on an aosp-atd image with no Play Services, so anything that touches Maps cannot be tested there today — see #63.


Written by Claude Code.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    @appIssues regarding the OpenTagViewer Android appenhancementNew feature or requestgood first issueGood for newcomers

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions