aboutsummaryrefslogtreecommitdiff
path: root/androidApp/src/main/java/mx/trackermap/TrackerMap/android/map/MapFragment.kt
diff options
context:
space:
mode:
authorIván Ávalos <avalos@disroot.org>2022-01-12 22:39:04 -0600
committerIván Ávalos <avalos@disroot.org>2022-01-12 22:39:04 -0600
commitb0179b7602d39bf12c3095b3019974dcd9925774 (patch)
tree7d9e848c5bd836182a9fb8592271b553ee1b3895 /androidApp/src/main/java/mx/trackermap/TrackerMap/android/map/MapFragment.kt
parent057b5c0ff74ef81096ad442b359be598e9a576aa (diff)
downloadetbsa-trackermap-mobile-b0179b7602d39bf12c3095b3019974dcd9925774.tar.gz
etbsa-trackermap-mobile-b0179b7602d39bf12c3095b3019974dcd9925774.tar.bz2
etbsa-trackermap-mobile-b0179b7602d39bf12c3095b3019974dcd9925774.zip
Implemented map layer switching and updated strings.xml
Diffstat (limited to 'androidApp/src/main/java/mx/trackermap/TrackerMap/android/map/MapFragment.kt')
-rw-r--r--androidApp/src/main/java/mx/trackermap/TrackerMap/android/map/MapFragment.kt17
1 files changed, 10 insertions, 7 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 5714aae..9b4d24a 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
@@ -23,6 +23,8 @@ typealias MarkerCallback = (Int?) -> Unit
class MapFragment : GlobeMapFragment() {
+ private var loader: QuadImageLoader? = null
+
data class Marker(
val id: Int,
val latitude: Double,
@@ -54,7 +56,7 @@ class MapFragment : GlobeMapFragment() {
cacheDir.mkdir()
val tileInfo = RemoteTileInfoNew(
- getString(R.string.maps_tile_url),
+ getString(R.string.maps_streets_tile_url),
0,
21
)
@@ -69,8 +71,8 @@ class MapFragment : GlobeMapFragment() {
params.singleLevel = true
params.maxTiles = 25
- val loader = QuadImageLoader(params, tileInfo, baseControl)
- loader.setImageFormat(RenderController.ImageFormat.MaplyImageUShort565)
+ loader = QuadImageLoader(params, tileInfo, baseControl)
+ loader?.setImageFormat(RenderController.ImageFormat.MaplyImageUShort565)
val clusterGenerator = BasicClusterGenerator(
intArrayOf(
@@ -232,7 +234,6 @@ class MapFragment : GlobeMapFragment() {
geofences.forEach { geofence ->
geofence.area?.let { area ->
- Log.d("MainFragment", "Geofence ${geofence.name} = ${geofence.area}")
try {
val geometry = GeometryReader.readGeometry(area)
if (!geometry.isEmpty) {
@@ -254,9 +255,7 @@ class MapFragment : GlobeMapFragment() {
}
}
}
- } catch (e: SFException) {
- e.printStackTrace()
- }
+ } catch (e: SFException) {}
}
}
@@ -289,6 +288,10 @@ class MapFragment : GlobeMapFragment() {
}
}
+ fun setTileInfo(tileInfo: TileInfoNew) {
+ loader?.changeTileInfo(tileInfo)
+ }
+
private fun getIcon(markerType: MarkerType): Bitmap {
return ResourcesCompat.getDrawable(
activity!!.resources,