Skip to content

Commit

Permalink
include local grid details in legend
Browse files Browse the repository at this point in the history
  • Loading branch information
wuan committed Jan 20, 2025
1 parent 2b3cce5 commit 742bd3b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
19 changes: 15 additions & 4 deletions app/src/main/java/org/blitzortung/android/app/view/LegendView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -187,11 +187,22 @@ class LegendView @JvmOverloads constructor(

private val regionName: String
get() {
val regionNumber = strikesOverlay!!.parameters.region

for ((index, regionNumberString) in resources.getStringArray(R.array.regions_values).withIndex()) {
if (regionNumber == Integer.parseInt(regionNumberString)) {
return resources.getStringArray(R.array.regions)[index]
val strikesOverlay = strikesOverlay

if (strikesOverlay != null) {
val regionNumber = strikesOverlay.parameters.region
val dataArea = strikesOverlay.parameters.dataArea

for ((index, regionNumberString) in resources.getStringArray(R.array.regions_values).withIndex()) {
if (regionNumber == Integer.parseInt(regionNumberString)) {
val detail = if (regionNumber < 0) {
" ($dataArea)"
} else {
""
}
return resources.getStringArray(R.array.regions)[index] + detail
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,7 @@ class MainDataHandler @Inject constructor(
return if (event != null) {
val mapView = event.source as OwnMapView
val updated = updateLocation(mapView.boundingBox)
// Log.v(LOG_TAG, "MainDataHandler.onScroll() update: $updated")
ensureUpdate(updated, mapView)
} else {
false
Expand All @@ -424,6 +425,7 @@ class MainDataHandler @Inject constructor(
val updateAutoGridSize = updateAutoGridSize(event.zoomLevel)
val updateLocation = updateLocation(mapView.boundingBox, updateAutoGridSize)
val updated = updateLocation || updateAutoGridSize
// Log.v(LOG_TAG, "MainDataHandler.onZoom() update: $updated (location: $updateLocation, autoGrid: $updateAutoGridSize)")
ensureUpdate(updated, mapView)
} else {
false
Expand Down

0 comments on commit 742bd3b

Please sign in to comment.