Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions android/src/main/java/com/rngooglemapsplus/GoogleMapsViewImpl.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ import android.content.res.Configuration
import android.graphics.Bitmap
import android.location.Location
import android.util.Size
import android.view.MotionEvent
import android.view.View
import android.view.ViewGroup
import android.widget.FrameLayout
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.findViewTreeLifecycleOwner
Expand Down Expand Up @@ -181,6 +183,30 @@ class GoogleMapsViewImpl(
}
}

private fun disallowParentTouchEventIntercept(disallowIntercept: Boolean): Boolean {
val parent = this.parent as? ViewGroup
if (parent != null) {
parent.requestDisallowInterceptTouchEvent(disallowIntercept)
return true
}
return false
}

override fun dispatchTouchEvent(ev: MotionEvent): Boolean {
when (ev.actionMasked) {
MotionEvent.ACTION_DOWN -> {
disallowParentTouchEventIntercept(
googleMap?.uiSettings?.isScrollGesturesEnabled ?: false
)
}
MotionEvent.ACTION_UP -> {
disallowParentTouchEventIntercept(false)
}
}
super.dispatchTouchEvent(ev)
return true
}

override fun onCameraMoveStarted(reason: Int) =
onUi {
if (!mapViewLoaded) return@onUi
Expand Down
Loading