aboutsummaryrefslogtreecommitdiff
path: root/androidApp
diff options
context:
space:
mode:
authorIván Ávalos <avalos@disroot.org>2022-01-16 00:49:24 -0600
committerIván Ávalos <avalos@disroot.org>2022-01-16 00:49:24 -0600
commit73a7543dbd286a4ff3b6bd4d3155823491102095 (patch)
tree2adf39c82759f0670bb55dc129df1f8ae8c6e698 /androidApp
parent972b0cf5ff61fd7eabfb8960fa474cb80dcde80a (diff)
downloadetbsa-trackermap-mobile-73a7543dbd286a4ff3b6bd4d3155823491102095.tar.gz
etbsa-trackermap-mobile-73a7543dbd286a4ff3b6bd4d3155823491102095.tar.bz2
etbsa-trackermap-mobile-73a7543dbd286a4ff3b6bd4d3155823491102095.zip
Added max zoom, min zoom and attribution text on strings.xml and reduced device selection zoom
Diffstat (limited to 'androidApp')
-rw-r--r--androidApp/src/main/java/mx/trackermap/TrackerMap/android/map/MapFragment.kt9
-rw-r--r--androidApp/src/main/java/mx/trackermap/TrackerMap/android/units/UnitsActivity.kt9
-rw-r--r--androidApp/src/main/res/values/strings.xml23
3 files changed, 26 insertions, 15 deletions
diff --git a/androidApp/src/main/java/mx/trackermap/TrackerMap/android/map/MapFragment.kt b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/map/MapFragment.kt
index e4fb8ea..4a63e65 100644
--- a/androidApp/src/main/java/mx/trackermap/TrackerMap/android/map/MapFragment.kt
+++ b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/map/MapFragment.kt
@@ -58,9 +58,9 @@ class MapFragment : GlobeMapFragment() {
Log.d("MapFragment", "controlHasStarted")
if (tileInfo == null) {
- val mapUrl = getString(R.string.maps_streets_tile_url)
- val tmpInfo = RemoteTileInfoNew(mapUrl, 0, 21)
- tileInfo = makeTileInfo(getString(R.string.maps_streets_tile_url), tmpInfo)
+ val layer = resources.getStringArray(R.array.maps_streets_tile_url)
+ val tmpInfo = RemoteTileInfoNew(layer[0], layer[1].toInt(), layer[2].toInt())
+ tileInfo = makeTileInfo(layer[0], tmpInfo)
}
val params = SamplingParams()
@@ -87,7 +87,6 @@ class MapFragment : GlobeMapFragment() {
screenLoc: Point2d?
) {
super.userDidSelect(mapControl, selObjs, loc, screenLoc)
-
selObjs?.forEach { selectedObject ->
if (selectedObject.selObj is ScreenMarker) {
val screenMarker = selectedObject.selObj as ScreenMarker
@@ -302,7 +301,7 @@ class MapFragment : GlobeMapFragment() {
))
}
- fun focusOn(latitude: Double, longitude: Double, zoom: Double = 0.0000144, animated: Boolean = true) {
+ fun focusOn(latitude: Double, longitude: Double, zoom: Double = 0.00009, animated: Boolean = true) {
val lat = latitude * Math.PI / 180
val lon = longitude * Math.PI / 180
if (animated) {
diff --git a/androidApp/src/main/java/mx/trackermap/TrackerMap/android/units/UnitsActivity.kt b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/units/UnitsActivity.kt
index bf5f1d8..cbd543a 100644
--- a/androidApp/src/main/java/mx/trackermap/TrackerMap/android/units/UnitsActivity.kt
+++ b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/units/UnitsActivity.kt
@@ -90,13 +90,14 @@ class UnitsActivity : AppCompatActivity() {
val popOver = PopupMenu(this, view)
popOver.menuInflater.inflate(R.menu.map_layers, popOver.menu)
popOver.setOnMenuItemClickListener { item ->
- unitsViewModel.setMapLayer(
+ val layer = resources.getStringArray(
when (item.itemId) {
- R.id.layerStreets -> getString(R.string.maps_streets_tile_url)
- R.id.layerSatellite -> getString(R.string.maps_satellite_url)
- else -> getString(R.string.maps_streets_tile_url)
+ R.id.layerStreets -> R.array.maps_streets_tile_url
+ R.id.layerSatellite -> R.array.maps_satellite_tile_url
+ else -> R.array.maps_streets_tile_url
}
)
+ unitsViewModel.setMapLayer(layer[0], layer[1].toInt(), layer[2].toInt())
true
}
popOver.show()
diff --git a/androidApp/src/main/res/values/strings.xml b/androidApp/src/main/res/values/strings.xml
index 025a7b9..67f0a26 100644
--- a/androidApp/src/main/res/values/strings.xml
+++ b/androidApp/src/main/res/values/strings.xml
@@ -10,12 +10,23 @@
https://www.google.com/maps/place/%1$f,%2$f?z=19
</string>
- <string name="maps_streets_tile_url" translatable="false">
- https://a.tile.openstreetmap.fr/osmfr/{z}/{x}/{y}.png
- </string>
- <string name="maps_satellite_url" translatable="false">
- https://mt0.google.com/vt/lyrs=y&amp;hl=en&amp;x={x}&amp;y={y}&amp;z={z}&amp;s=Ga
- </string>
+ <!-- Tile URLs -->
+ <!-- [0] = tile server URL -->
+ <!-- [1] = min zoom -->
+ <!-- [2] = max zoom -->
+ <!-- [3] = attribution text -->
+ <string-array name="maps_streets_tile_url" translatable="false">
+ <item>https://a.tile.openstreetmap.fr/osmfr/{z}/{x}/{y}.png</item>
+ <item>0</item>
+ <item>20</item>
+ <item>&#169; OpenStreetMap France | &#169; &lt;a href="https://www.openstreetmap.org/copyright"&gt;OpenStreetMap&lt;/a&gt; contributors</item>
+ </string-array>
+ <string-array name="maps_satellite_tile_url" translatable="false">
+ <item>https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}</item>
+ <item>0</item>
+ <item>17</item>
+ <item>Tiles &#169; Esri &#8212; Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community</item>
+ </string-array>
<string name="notification_channel_id" translatable="false">default</string>
<string name="notification_channel" translatable="false">Default</string>