aboutsummaryrefslogtreecommitdiff
path: root/androidApp/src/main/java/mx/trackermap/TrackerMap/android/map
diff options
context:
space:
mode:
authorIván Ávalos <avalos@disroot.org>2022-01-17 00:52:22 -0600
committerIván Ávalos <avalos@disroot.org>2022-01-17 00:52:22 -0600
commit7c90f36e21e6d1400990427b3c4eabd4a83d5e9a (patch)
tree27083e80aef72427e760bf4c805b6186dc0a12c3 /androidApp/src/main/java/mx/trackermap/TrackerMap/android/map
parentbce64ef4f702c351d349881704d92f724e90239f (diff)
downloadetbsa-trackermap-mobile-7c90f36e21e6d1400990427b3c4eabd4a83d5e9a.tar.gz
etbsa-trackermap-mobile-7c90f36e21e6d1400990427b3c4eabd4a83d5e9a.tar.bz2
etbsa-trackermap-mobile-7c90f36e21e6d1400990427b3c4eabd4a83d5e9a.zip
Switch to list fragment on search and fixed black flash when switching fragments
Diffstat (limited to 'androidApp/src/main/java/mx/trackermap/TrackerMap/android/map')
-rw-r--r--androidApp/src/main/java/mx/trackermap/TrackerMap/android/map/MapFragment.kt18
-rw-r--r--androidApp/src/main/java/mx/trackermap/TrackerMap/android/map/UnitMapFragment.kt6
2 files changed, 13 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 06d3d97..17fc9d4 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
@@ -1,6 +1,7 @@
package mx.trackermap.TrackerMap.android.map
import android.graphics.Bitmap
+import android.graphics.Color
import android.graphics.Typeface
import android.os.Bundle
import android.util.Log
@@ -48,6 +49,11 @@ class MapFragment : GlobeMapFragment() {
return MapDisplayType.Map
}
+ override fun preControlCreated() {
+ super.preControlCreated()
+ mapSettings.clearColor = Color.WHITE
+ }
+
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
@@ -237,9 +243,11 @@ class MapFragment : GlobeMapFragment() {
mbr.expandByFraction(0.1)
mapControl?.addPostSurfaceRunnable {
- val zoom = mapControl.findHeightToViewBounds(mbr, mbr.middle())
- .coerceAtLeast(mapControl.zoomLimitMin)
- mapControl.setPositionGeo(mbr.middle(), zoom)
+ mapControl?.let {
+ val zoom = it.findHeightToViewBounds(mbr, mbr.middle())
+ .coerceAtLeast(mapControl.zoomLimitMin)
+ it.setPositionGeo(mbr.middle(), zoom)
+ }
}
}
}
@@ -328,10 +336,7 @@ class MapFragment : GlobeMapFragment() {
val lat = latitude * Math.PI / 180
val lon = longitude * Math.PI / 180
// Ensure height is equal or higher than bottom limit
- Log.d("MapFragment", "Target: %7.7f".format(height))
- Log.d("MapFragment", "Min: %7.7f".format(mapControl.zoomLimitMin))
val z = height.coerceAtLeast(mapControl.zoomLimitMin)
- Log.d("MapFragment", "Final: %7.7f".format(z))
if (animated) {
mapControl.animatePositionGeo(lon, lat, z, 0.2)
} else {
@@ -346,7 +351,6 @@ class MapFragment : GlobeMapFragment() {
val cacheDirMap = File(it.cacheDir, cacheDirName)
cacheDirMap.mkdir()
Log.d("MapFragment", "Cache dir for $url = ${cacheDirMap.absolutePath}")
-
(tileInfo as? RemoteTileInfoNew)?.cacheDir = cacheDirMap
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 cb5edc3..0658f56 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
@@ -68,8 +68,7 @@ class UnitMapFragment(private val unitsViewModel: UnitsViewModel) : UnitFragment
unitsMapFragment.display(
units.mapNotNull(MarkerTransformations::unitToMarker).toTypedArray(),
- isReport = false,
- center = unitsViewModel.selectedUnit.value == null
+ isReport = false
)
}
@@ -102,8 +101,7 @@ class UnitMapFragment(private val unitsViewModel: UnitsViewModel) : UnitFragment
unitsViewModel.mapLayerType.observe(viewLifecycleOwner) { type ->
Log.d("UnitMapFragment", "Loading layer!")
unitsMapFragment.updateLayer(type)
- val selectedUnit = unitsViewModel.selectedUnit.value
- selectedUnit?.let {
+ unitsViewModel.selectedUnit.value?.let {
unitsMapFragment.focusOn(it.position!!.latitude!!, it.position!!.longitude!!)
}
val layer = MapLayer.layers[type]!!