aboutsummaryrefslogtreecommitdiff
path: root/androidApp
diff options
context:
space:
mode:
Diffstat (limited to 'androidApp')
-rw-r--r--androidApp/src/main/java/mx/trackermap/TrackerMap/android/map/MapFragment.kt25
-rw-r--r--androidApp/src/main/java/mx/trackermap/TrackerMap/android/map/UnitMapFragment.kt4
2 files changed, 18 insertions, 11 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 34ff655..e3f4ead 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
@@ -38,6 +38,8 @@ class MapFragment : GlobeMapFragment() {
private val objects = mutableListOf<ComponentObject>()
private val geofenceObjects = mutableListOf<ComponentObject>()
+ private var tileInfo: TileInfoNew? = null
+
override fun chooseDisplayType(): MapDisplayType {
return MapDisplayType.Map
}
@@ -52,23 +54,27 @@ class MapFragment : GlobeMapFragment() {
}
override fun controlHasStarted() {
+ Log.d("MapFragment", "controlHasStarted")
+
val cacheDirName = "stamen_watercolor6"
val cacheDir = File(activity!!.cacheDir, cacheDirName)
cacheDir.mkdir()
- val tileInfo = RemoteTileInfoNew(
- getString(R.string.maps_streets_tile_url),
- 0,
- 21
- )
- tileInfo.cacheDir = cacheDir
+ if (tileInfo == null) {
+ tileInfo = RemoteTileInfoNew(
+ getString(R.string.maps_streets_tile_url),
+ 0,
+ 21
+ )
+ (tileInfo as RemoteTileInfoNew).cacheDir = cacheDir
+ }
val params = SamplingParams()
params.coordSystem = SphericalMercatorCoordSystem()
params.coverPoles = true
params.edgeMatching = true
- params.minZoom = tileInfo.minZoom
- params.maxZoom = tileInfo.maxZoom
+ params.minZoom = tileInfo!!.minZoom
+ params.maxZoom = tileInfo!!.maxZoom
params.singleLevel = true
params.maxTiles = 25
@@ -310,7 +316,8 @@ class MapFragment : GlobeMapFragment() {
}
}
- fun setTileInfo(tileInfo: TileInfoNew) {
+ fun updateTileInfo(tileInfo: TileInfoNew) {
+ this.tileInfo = tileInfo
loader?.changeTileInfo(tileInfo)
}
diff --git a/androidApp/src/main/java/mx/trackermap/TrackerMap/android/map/UnitMapFragment.kt b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/map/UnitMapFragment.kt
index 06e5713..cc9a551 100644
--- a/androidApp/src/main/java/mx/trackermap/TrackerMap/android/map/UnitMapFragment.kt
+++ b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/map/UnitMapFragment.kt
@@ -56,7 +56,7 @@ class UnitMapFragment(private val unitsViewModel: UnitsViewModel) : UnitFragment
}
private fun setupObservers() {
- Log.d("MapFragment", "setupObservers()")
+ Log.d("UnitMapFragment", "setupObservers()")
unitsViewModel.units.observe(viewLifecycleOwner) { units ->
Log.d("UnitMapFragment", "Available units: $units")
@@ -95,7 +95,7 @@ class UnitMapFragment(private val unitsViewModel: UnitsViewModel) : UnitFragment
unitsViewModel.mapTileInfo.observe(viewLifecycleOwner) { tileInfo ->
Log.d("UnitMapFragment", "Loading layer!")
- unitsMapFragment.setTileInfo(tileInfo)
+ unitsMapFragment.updateTileInfo(tileInfo)
}
unitsViewModel.geofences.observe(viewLifecycleOwner) { geofences ->