Skip to content

Commit 5b85ddc

Browse files
committed
remove duplicate query on startup
1 parent 4794ea8 commit 5b85ddc

1 file changed

Lines changed: 1 addition & 22 deletions

File tree

app/src/main/kotlin/org/btcmap/map/MapFragment.kt

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import android.content.pm.PackageManager
77
import android.content.res.Configuration
88
import android.location.Location
99
import android.os.Bundle
10-
import android.util.Log
1110
import android.view.LayoutInflater
1211
import android.view.View
1312
import android.view.ViewGroup
@@ -246,11 +245,6 @@ class MapFragment : Fragment() {
246245
viewLifecycleOwner.lifecycleScope.launch {
247246
loadAreas(center.latitude, center.longitude)
248247
}
249-
when (filter) {
250-
Filter.MERCHANTS -> showMerchants()
251-
Filter.EVENTS -> showEvents()
252-
Filter.EXCHANGES -> showExchanges()
253-
}
254248
}
255249

256250
it.setStyle(Style.Builder().fromUri(prefs.mapStyle.uri(requireContext())))
@@ -344,7 +338,6 @@ class MapFragment : Fragment() {
344338
binding.sync.isVisible = true
345339

346340
val importResult = BundledPlaces.import(requireContext(), db())
347-
Log.d("import", importResult.toString())
348341

349342
if (importResult.placesImported > 0) {
350343
setFilter(filter)
@@ -578,7 +571,7 @@ class MapFragment : Fragment() {
578571
return@addOnMapClickListener true
579572
}
580573
} catch (e: Exception) {
581-
Log.e(null, null, e)
574+
e.printStackTrace()
582575
}
583576

584577
false
@@ -711,7 +704,6 @@ class MapFragment : Fragment() {
711704
private var filter = Filter.MERCHANTS
712705

713706
private fun setFilter(filter: Filter) {
714-
Log.d("MapFragment", "setFilter called with: $filter")
715707
this.filter = filter
716708

717709
binding.showMerchants.isSelected = filter == Filter.MERCHANTS
@@ -725,7 +717,6 @@ class MapFragment : Fragment() {
725717
lastDbCallTimeMs = 0L
726718

727719
if (initialLoadInProgress) {
728-
Log.d("MapFragment", "setFilter: skipping show due to initial load")
729720
return
730721
}
731722

@@ -756,13 +747,8 @@ class MapFragment : Fragment() {
756747
binding.map.getMapAsync { map ->
757748
val bounds = map.projection.visibleRegion.latLngBounds
758749
val expandedBounds = expandBounds(bounds, CLUSTERING_SCALE_FACTOR)
759-
Log.d(
760-
"MapFragment",
761-
"showMerchants: bounds=$bounds, expanded=$expandedBounds, cacheBounds=${merchantsCache.bounds}"
762-
)
763750
viewLifecycleOwner.lifecycleScope.launch {
764751
if (!merchantsCache.contains(expandedBounds)) {
765-
Log.d("MapFragment", "showMerchants: cache miss, fetching")
766752
dbCallCount++
767753
val startTime = System.currentTimeMillis()
768754
val newMerchants = withContext(Dispatchers.IO) {
@@ -776,13 +762,7 @@ class MapFragment : Fragment() {
776762
)
777763
}
778764
lastDbCallTimeMs = System.currentTimeMillis() - startTime
779-
Log.d(
780-
"MapFragment",
781-
"showMerchants: fetched ${newMerchants.size} merchants in ${lastDbCallTimeMs}ms"
782-
)
783765
merchantsCache = merchantsCache.add(newMerchants, expandedBounds)
784-
} else {
785-
Log.d("MapFragment", "showMerchants: cache hit")
786766
}
787767
val geoJson = merchantsCache.features.toGeoJson()
788768
if (geoJson != lastMerchantsGeoJson) {
@@ -887,7 +867,6 @@ class MapFragment : Fragment() {
887867
} else {
888868
"no bounds"
889869
}
890-
Log.d("MapFragment", "updateDebugStats: filter=$filter, cacheSize=$cacheSize")
891870
if (prefs.showDebugInfo) {
892871
binding.debugStats.apply {
893872
text =

0 commit comments

Comments
 (0)