mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
* fix: map crash (fixes #6432) * Fix typos in comments in ExploreMapFragment.kt --------- Co-authored-by: Nicolas Raoul <nicolas.raoul@gmail.com>
This commit is contained in:
parent
0a4b179db5
commit
adb6181e9f
1 changed files with 8 additions and 6 deletions
|
|
@ -963,13 +963,17 @@ class ExploreMapFragment : CommonsDaggerSupportFragment(), ExploreMapContract.Vi
|
|||
if (geoPoint != null) {
|
||||
binding!!.mapView.controller.setCenter(geoPoint)
|
||||
val overlays = binding!!.mapView.overlays
|
||||
// collects the indices of items to remove
|
||||
val indicesToRemove = mutableListOf<Int>()
|
||||
for (i in overlays.indices) {
|
||||
if (overlays[i] is Marker) {
|
||||
binding!!.mapView.overlays.removeAt(i)
|
||||
} else if (overlays[i] is ScaleDiskOverlay) {
|
||||
binding!!.mapView.overlays.removeAt(i)
|
||||
if (overlays[i] is Marker || overlays[i] is ScaleDiskOverlay) {
|
||||
indicesToRemove.add(i)
|
||||
}
|
||||
}
|
||||
// removes the items in reverse order to avoid index shifting
|
||||
indicesToRemove.sortedDescending().forEach { index ->
|
||||
binding!!.mapView.overlays.removeAt(index)
|
||||
}
|
||||
val diskOverlay = ScaleDiskOverlay(
|
||||
requireContext(),
|
||||
geoPoint, 2000, GeoConstants.UnitOfMeasure.foot
|
||||
|
|
@ -979,7 +983,6 @@ class ExploreMapFragment : CommonsDaggerSupportFragment(), ExploreMapContract.Vi
|
|||
this.style = Paint.Style.STROKE
|
||||
this.strokeWidth = 2f
|
||||
})
|
||||
|
||||
setCirclePaint1(Paint().apply {
|
||||
setColor(Color.argb(40, 128, 128, 128))
|
||||
this.style = Paint.Style.FILL_AND_STROKE
|
||||
|
|
@ -988,7 +991,6 @@ class ExploreMapFragment : CommonsDaggerSupportFragment(), ExploreMapContract.Vi
|
|||
setDisplaySizeMax(1700)
|
||||
}
|
||||
binding!!.mapView.overlays.add(diskOverlay)
|
||||
|
||||
val startMarker = Marker(
|
||||
binding!!.mapView
|
||||
).apply {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue