aboutsummaryrefslogtreecommitdiff
path: root/androidApp/src
diff options
context:
space:
mode:
authorIván Ávalos <avalos@disroot.org>2021-12-15 23:23:52 -0600
committerIván Ávalos <avalos@disroot.org>2021-12-15 23:23:52 -0600
commit53960eef74a6b4cf187f380bc462b16e29e26592 (patch)
tree239632657b81918e9c56e0060b7a64301dfdb990 /androidApp/src
parentb43e9d3cb7bd938897159bced810ec44fec05d8c (diff)
downloadetbsa-trackermap-mobile-53960eef74a6b4cf187f380bc462b16e29e26592.tar.gz
etbsa-trackermap-mobile-53960eef74a6b4cf187f380bc462b16e29e26592.tar.bz2
etbsa-trackermap-mobile-53960eef74a6b4cf187f380bc462b16e29e26592.zip
Maps now showing, including a test marker in Moscow
Diffstat (limited to 'androidApp/src')
-rw-r--r--androidApp/src/main/java/mx/trackermap/TrackerMap/android/map/MapFragment.kt21
-rw-r--r--androidApp/src/main/res/drawable/map_default.pngbin0 -> 819 bytes
2 files changed, 19 insertions, 2 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 f0c2404..125d525 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,5 +1,6 @@
package mx.trackermap.TrackerMap.android.map
+import android.graphics.BitmapFactory
import android.os.Bundle
import android.util.Log
import android.view.LayoutInflater
@@ -7,6 +8,7 @@ import android.view.View
import android.view.ViewGroup
import com.mousebird.maply.*
import kotlinx.coroutines.DelicateCoroutinesApi
+import mx.trackermap.TrackerMap.android.R
import mx.trackermap.TrackerMap.android.databinding.MapFragmentBinding
import mx.trackermap.TrackerMap.android.units.UnitsViewModel
import org.koin.androidx.viewmodel.ext.android.viewModel
@@ -37,7 +39,7 @@ class MapFragment: GlobeMapFragment() {
val cacheDir = File(activity!!.cacheDir, cacheDirName)
cacheDir.mkdir()
- val tileInfo = RemoteTileInfoNew("https://tile.openstreetmap.org/{z}/{x}/{y}.png", 0, 21)
+ val tileInfo = RemoteTileInfoNew("https://mt0.google.com/vt/lyrs=m&hl=en&x={x}&y={y}&z={z}&s=Ga", 0, 21)
tileInfo.cacheDir = cacheDir
val params = SamplingParams()
@@ -53,8 +55,23 @@ class MapFragment: GlobeMapFragment() {
val latitude = 23.191 * Math.PI / 180
val longitude = -100.36 * Math.PI / 180
- val zoom = 2.0
+ val zoom = 0.4
mapControl.animatePositionGeo(longitude, latitude, zoom, 1.0)
+
+ insertMarkers()
+ }
+
+ private fun insertMarkers() {
+ val markerInfo = MarkerInfo()
+ val icon = BitmapFactory.decodeResource(activity!!.resources, R.drawable.map_default)
+ val markerSize = Point2d(80.0, 80.0)
+
+ val moscow = ScreenMarker()
+ moscow.loc = Point2d.FromDegrees(37.616667, 55.75)
+ moscow.image = icon
+ moscow.size = markerSize
+
+ mapControl.addScreenMarker(moscow, markerInfo, ThreadMode.ThreadAny)
}
override fun onDestroyView() {
diff --git a/androidApp/src/main/res/drawable/map_default.png b/androidApp/src/main/res/drawable/map_default.png
new file mode 100644
index 0000000..e7d1f72
--- /dev/null
+++ b/androidApp/src/main/res/drawable/map_default.png
Binary files differ