File tree Expand file tree Collapse file tree 1 file changed +18
-3
lines changed
balloon/src/main/kotlin/com/skydoves/balloon Expand file tree Collapse file tree 1 file changed +18
-3
lines changed Original file line number Diff line number Diff line change @@ -1827,16 +1827,31 @@ public class Balloon private constructor(
1827
1827
)
1828
1828
}
1829
1829
1830
+ /* * remembers the last pressed action event to pass it after move the touch-up points. */
1831
+ private var passedEventActionDownEvent: Pair <MotionEvent , Boolean >? = null
1832
+
1830
1833
private fun passTouchEventToAnchor (anchor : View ) {
1831
1834
if (! this .builder.passTouchEventToAnchor) return
1832
1835
setOnBalloonOverlayTouchListener { view, event ->
1833
1836
view.performClick()
1834
1837
val rect = Rect ()
1835
1838
anchor.getGlobalVisibleRect(rect)
1836
- if (event.action == MotionEvent .ACTION_UP || event.action == MotionEvent .ACTION_MOVE ) {
1837
- anchor.rootView.dispatchTouchEvent(event)
1839
+
1840
+ if (event.action == MotionEvent .ACTION_DOWN ) {
1841
+ passedEventActionDownEvent = event to rect.contains(
1842
+ event.rawX.toInt(),
1843
+ event.rawY.toInt(),
1844
+ )
1845
+ }
1846
+
1847
+ val passedEventActionDownEvents = passedEventActionDownEvent?.first
1848
+ val passedEventActionDownInvokable = passedEventActionDownEvent?.second ? : false
1849
+
1850
+ if (passedEventActionDownInvokable && (event.action == MotionEvent .ACTION_UP )
1851
+ ) {
1852
+ anchor.rootView.dispatchTouchEvent(passedEventActionDownEvents!! )
1838
1853
true
1839
- } else if (rect.contains(event.rawX.toInt(), event.rawY.toInt()) ) {
1854
+ } else if (passedEventActionDownInvokable ) {
1840
1855
anchor.rootView.dispatchTouchEvent(event)
1841
1856
true
1842
1857
} else {
You can’t perform that action at this time.
0 commit comments