Static images improvements (#933)
1. On devices less than xhdpi request a 1x image from MapTiler (such devices are generally old, slower and with little memory so avoiding to get the 2x image only to have to shrink it later could help). 2. Coerce too big width/height combos within the API limits keeping the aspect ratio (this will allow requests on big horizontal displays to succeed). 3. Don't crash when given weird width/height combos (i.e. zero or negative). 4. Introduce interfaces to hide this whole logic and make it easier for forks to implement their own. Related to: - https://github.com/vector-im/element-meta/issues/1678
This commit is contained in:
parent
88c66dde58
commit
57d04e487c
11 changed files with 501 additions and 90 deletions
17
docs/maps.md
17
docs/maps.md
|
|
@ -27,16 +27,21 @@ Place your API key in `local.properties` with the key
|
|||
services.maptiler.apikey=abCd3fGhijK1mN0pQr5t
|
||||
```
|
||||
|
||||
Optionally you can also place your custom MapTyler style ids for light and dark maps
|
||||
in the `local.properties` with the keys `services.maptiler.lightMapId` and
|
||||
`services.maptiler.darkMapId`. If you don't specify these, the default MapTiler "basic-v2"
|
||||
styles will be used.
|
||||
|
||||
## Making releasable builds with MapTiler
|
||||
|
||||
To insert the MapTiler API key when building an APK, set the
|
||||
`ELEMENT_ANDROID_MAPTILER_API_KEY` environment variable in your build
|
||||
environment.
|
||||
environment.
|
||||
If you've added custom styles also set the `ELEMENT_ANDROID_MAPTILER_LIGHT_MAP_ID`
|
||||
and `ELEMENT_ANDROID_MAPTILER_DARK_MAP_ID` environment variables accordingly.
|
||||
|
||||
## Using other map sources or MapTiler styles
|
||||
|
||||
If you wish to use an alternative map provider, or custom MapTiler styles,
|
||||
you can customise the functions in
|
||||
`features/location/api/src/main/kotlin/io/element/android/features/location/api/internal/MapUrls.kt`.
|
||||
We've kept this file small and self contained to minimise the chances of merge
|
||||
collisions in forks.
|
||||
If you wish to use an alternative map provider, you can provide your own implementations of
|
||||
`TileServerStyleUriBuilder` and `StaticMapUrlBuilder` in
|
||||
`features/location/api/src/main/kotlin/io/element/android/features/location/api/internal/`.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue