Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 0 additions & 2 deletions .settings/org.eclipse.buildship.core.prefs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -267,10 +267,33 @@ public boolean onInterceptTouchEvent(MotionEvent ev) {
}
}

private boolean isTouchUnderChildView(MotionEvent event) {
View targetChildView = getChildAt(0);
float translationX = targetChildView.getTranslationX();
float translationY = targetChildView.getTranslationY();
float x = event.getX();
float y = event.getY();
return x >= targetChildView.getLeft() + translationX &&
x <= targetChildView.getRight() + translationX &&
y >= targetChildView.getTop() + translationY &&
y <= targetChildView.getBottom() + translationY;
}

/**
* 不拦截 Touch 事件的几种情况
* 1.不开启父亲布局拦截.
* 2.当前子 View 为 null
* 3.当前 Touch 事件没用作用到子 View
* @param event
* @return
*/
@Override
public boolean onTouchEvent(MotionEvent event) {
float velocityY = 0;
if (getChildAt(0) == null || !isParentDispatchTouchEvent) {

if (!isParentDispatchTouchEvent ||
getChildAt(0) == null ||
!isTouchUnderChildView(event)) {
return super.onTouchEvent(event);
}
if (isAnimating()) {
Expand Down