aboutsummaryrefslogtreecommitdiff
path: root/androidApp/src/main/java/mx/trackermap
diff options
context:
space:
mode:
authorIsidro Henoch <imhenoch@protonmail.com>2022-01-13 14:33:55 -0600
committerIsidro Henoch <imhenoch@protonmail.com>2022-01-13 14:33:55 -0600
commitcbec64bc49161618ba5f95382b8669b9de3d939b (patch)
tree3bb2a225453de49897d18acba369e101da4a829c /androidApp/src/main/java/mx/trackermap
parent5096d7306d48e03a5b096f1b190b089abce16fe5 (diff)
downloadetbsa-trackermap-mobile-cbec64bc49161618ba5f95382b8669b9de3d939b.tar.gz
etbsa-trackermap-mobile-cbec64bc49161618ba5f95382b8669b9de3d939b.tar.bz2
etbsa-trackermap-mobile-cbec64bc49161618ba5f95382b8669b9de3d939b.zip
Fixes the map layer issue
Diffstat (limited to 'androidApp/src/main/java/mx/trackermap')
-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 ->