Ground station position overlay revised
This commit is contained in:
1 parent
57a9012f98
commit
9617b69f3f
2 files changed
+17
-12
No files matched your search
@@ -7,7 +7,6 @@ import android.graphics.Paint
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import android.view.View
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.lifecycle.Observer
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
@@ -129,7 +128,7 @@ class MapOsmFragment : Fragment(R.layout.fragment_map_osm) {
|
||||
viewModel.getGSP().observe(viewLifecycleOwner, Observer { stationPosition ->
|
||||
when (stationPosition) {
|
||||
is Result.Success -> {
|
||||
setUserLocation(stationPosition.data)
|
||||
setupPosOverlay(stationPosition.data)
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -144,19 +143,15 @@ class MapOsmFragment : Fragment(R.layout.fragment_map_osm) {
|
||||
})
|
||||
}
|
||||
|
||||
private fun setUserLocation(position: GroundStationPosition) {
|
||||
val startPoint = GeoPoint(position.latitude, position.longitude)
|
||||
val positionMarker = Marker(binding.mapView).apply {
|
||||
this.position = startPoint
|
||||
textLabelBackgroundColor = Color.TRANSPARENT
|
||||
textLabelForegroundColor = ContextCompat.getColor(mainActivity, R.color.themeAccent)
|
||||
textLabelFontSize = 24
|
||||
setTextIcon("GSP")
|
||||
private fun setupPosOverlay(gsp: GroundStationPosition) {
|
||||
Marker(binding.mapView).apply {
|
||||
setInfoWindow(null)
|
||||
setAnchor(Marker.ANCHOR_CENTER, Marker.ANCHOR_BOTTOM)
|
||||
icon = resources.getDrawable(R.drawable.ic_map_pos, mainActivity.theme)
|
||||
position = GeoPoint(gsp.latitude, gsp.longitude)
|
||||
binding.mapView.overlays[0] = this
|
||||
binding.mapView.invalidate()
|
||||
}
|
||||
binding.mapView.overlays[0] = positionMarker
|
||||
binding.mapView.invalidate()
|
||||
}
|
||||
|
||||
private fun setupSatOverlay(passList: List<SatPass>) {
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:tint="@color/themeAccent"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="@color/themeAccent"
|
||||
android:pathData="M12,2C8.13,2 5,5.13 5,9c0,5.25 7,13 7,13s7,-7.75 7,-13c0,-3.87 -3.13,-7 -7,-7zM12,11.5c-1.38,0 -2.5,-1.12 -2.5,-2.5s1.12,-2.5 2.5,-2.5 2.5,1.12 2.5,2.5 -1.12,2.5 -2.5,2.5z" />
|
||||
</vector>
|
||||
Reference in new issue
Block a user