aboutsummaryrefslogtreecommitdiff
path: root/androidApp/src/main/java/mx/trackermap/TrackerMap
diff options
context:
space:
mode:
authorIván Ávalos <avalos@disroot.org>2021-12-15 22:13:35 -0600
committerIván Ávalos <avalos@disroot.org>2021-12-15 22:13:35 -0600
commitb43e9d3cb7bd938897159bced810ec44fec05d8c (patch)
tree97059be6c5226d7edf98ab21a8cdacb3787b0c70 /androidApp/src/main/java/mx/trackermap/TrackerMap
parent64edb0466aae0f920b6a9d6c01c142e1207ae5b1 (diff)
downloadetbsa-trackermap-mobile-b43e9d3cb7bd938897159bced810ec44fec05d8c.tar.gz
etbsa-trackermap-mobile-b43e9d3cb7bd938897159bced810ec44fec05d8c.tar.bz2
etbsa-trackermap-mobile-b43e9d3cb7bd938897159bced810ec44fec05d8c.zip
WhirlyGlobe Maply test. Map shows completely black, same as with MapLibre GL we tested earlier
Diffstat (limited to 'androidApp/src/main/java/mx/trackermap/TrackerMap')
-rw-r--r--androidApp/src/main/java/mx/trackermap/TrackerMap/android/map/MapFragment.kt39
-rw-r--r--androidApp/src/main/java/mx/trackermap/TrackerMap/android/units/UnitsActivity.kt2
2 files changed, 37 insertions, 4 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 2ffaa2c..f0c2404 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
@@ -5,25 +5,56 @@ import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
-import androidx.fragment.app.Fragment
+import com.mousebird.maply.*
import kotlinx.coroutines.DelicateCoroutinesApi
import mx.trackermap.TrackerMap.android.databinding.MapFragmentBinding
import mx.trackermap.TrackerMap.android.units.UnitsViewModel
import org.koin.androidx.viewmodel.ext.android.viewModel
+import java.io.File
-class MapFragment: Fragment() {
+@DelicateCoroutinesApi
+class MapFragment: GlobeMapFragment() {
private var _binding: MapFragmentBinding? = null
private val binding get() = _binding!!
private val unitsViewModel: UnitsViewModel by viewModel()
+ override fun chooseDisplayType(): MapDisplayType {
+ return MapDisplayType.Map
+ }
+
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View {
- _binding = MapFragmentBinding.inflate(inflater, container, false)
- return binding.root
+ super.onCreateView(inflater, container, savedInstanceState)
+ return baseControl.contentView!!
+ }
+
+ override fun controlHasStarted() {
+ val cacheDirName = "stamen_watercolor6"
+ val cacheDir = File(activity!!.cacheDir, cacheDirName)
+ cacheDir.mkdir()
+
+ val tileInfo = RemoteTileInfoNew("https://tile.openstreetmap.org/{z}/{x}/{y}.png", 0, 21)
+ tileInfo.cacheDir = cacheDir
+
+ val params = SamplingParams()
+ params.coordSystem = SphericalMercatorCoordSystem()
+ params.coverPoles = true
+ params.edgeMatching = true
+ params.minZoom = tileInfo.minZoom
+ params.maxZoom = tileInfo.maxZoom
+ params.singleLevel = true
+
+ val loader = QuadImageLoader(params, tileInfo, baseControl)
+ loader.setImageFormat(RenderController.ImageFormat.MaplyImageUShort565)
+
+ val latitude = 23.191 * Math.PI / 180
+ val longitude = -100.36 * Math.PI / 180
+ val zoom = 2.0
+ mapControl.animatePositionGeo(longitude, latitude, zoom, 1.0)
}
override fun onDestroyView() {
diff --git a/androidApp/src/main/java/mx/trackermap/TrackerMap/android/units/UnitsActivity.kt b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/units/UnitsActivity.kt
index 2be6da3..60218db 100644
--- a/androidApp/src/main/java/mx/trackermap/TrackerMap/android/units/UnitsActivity.kt
+++ b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/units/UnitsActivity.kt
@@ -5,12 +5,14 @@ import android.util.Log
import androidx.appcompat.app.AppCompatActivity
import androidx.core.widget.doAfterTextChanged
import androidx.fragment.app.commit
+import kotlinx.coroutines.DelicateCoroutinesApi
import mx.trackermap.TrackerMap.android.R
import mx.trackermap.TrackerMap.android.databinding.UnitsActivityBinding
import mx.trackermap.TrackerMap.android.devices.DevicesFragment
import mx.trackermap.TrackerMap.android.map.MapFragment
import org.koin.androidx.viewmodel.ext.android.viewModel
+@DelicateCoroutinesApi
class UnitsActivity : AppCompatActivity() {
private var _binding: UnitsActivityBinding? = null