Skip to content

Commit

Permalink
remove onTouch listener that causes search results pins to be remove …
Browse files Browse the repository at this point in the history
…when moving on map. and zooms when a location is selected
  • Loading branch information
ferdyrod committed Oct 31, 2024
1 parent 076e4df commit 7c476da
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import android.content.Context
import android.content.Intent
import android.location.LocationListener
import android.os.Bundle
import android.view.MotionEvent
import androidx.activity.compose.setContent
import androidx.activity.viewModels
import androidx.appcompat.app.AppCompatActivity
Expand Down Expand Up @@ -35,7 +34,6 @@ import org.dhis2.maps.utils.GeometryCoordinate
import org.dhis2.maps.utils.addMoveListeners
import org.dhis2.ui.theme.Dhis2Theme
import org.hisp.dhis.android.core.common.FeatureType
import timber.log.Timber

class MapSelectorActivity : AppCompatActivity() {

Expand Down Expand Up @@ -157,15 +155,6 @@ class MapSelectorActivity : AppCompatActivity() {
mapStyles = mapSelectorViewModel.fetchMapStyles(),
onInitializationFinished = {
initZoom(mapSelectorViewModel.screenState.value)
it.mapView.setOnTouchListener { _, event ->
if (event.action == MotionEvent.ACTION_DOWN) {
Timber.tag("MAP").d("Touched")
mapSelectorViewModel.onMapTouched()
} else if (event.action == MotionEvent.ACTION_UP) {
mapSelectorViewModel.onMapTouched(false)
}
super.onTouchEvent(event)
}
it.map?.addMoveListeners(
onIdle = { bounds ->
mapSelectorViewModel.updateCurrentVisibleRegion(bounds)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -482,18 +482,4 @@ class MapSelectorViewModel(
)
}
}

fun onMapTouched(actionDown: Boolean = true) {
if (canCaptureManually()) {
val captureMode = if (actionDown) CaptureMode.MANUAL_SWIPE else CaptureMode.MANUAL
updateScreenState(
mapData = GetMapData(
_currentFeature,
_screenState.value.locationItems,
captureMode,
),
captureMode = captureMode,
)
}
}
}

0 comments on commit 7c476da

Please sign in to comment.