Skip to content

Commit aeb3005

Browse files
committed
Upload file
1 parent c644f94 commit aeb3005

3 files changed

Lines changed: 582 additions & 29 deletions

File tree

common/src/main/java/com/omarea/overscroll/OverScrollDelegate.java

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -522,23 +522,26 @@ private boolean onTouchEventInternal(MotionEvent event) {
522522
}
523523
break;
524524
}
525-
case MotionEvent.ACTION_UP:
526-
case MotionEvent.ACTION_CANCEL: {
527-
if (mOffsetY != 0f) {
528-
// Sping back to 0
529-
final int startScrollY = Math.round(mOffsetY);
530-
// mScroller.startScroll(0, startScrollY, 0, -startScrollY,
531-
// SPRING_BACK_DURATION);
532-
// mPath.reset();
533-
// mPath.moveTo(0f, startScrollY);
534-
// mPath.lineTo(1f, 0);
535-
// mScroller.start(1f, SPRING_BACK_DURATION, mPath);
536-
mScroller.start(startScrollY, DRAG_BACK_DURATION, sDragBackPathPointsHolder);
537-
setState(OS_SPRING_BACK);
538-
mView.invalidate();
539-
}
540-
mActivePointerId = INVALID_POINTER;
541-
}
525+
case MotionEvent.ACTION_UP:
526+
case MotionEvent.ACTION_CANCEL: {
527+
528+
if (mOffsetY != 0f) {
529+
530+
if (isOsTop()) {
531+
// 🔼 KÉO LÊN → GIỮ NGUYÊN, KHÔNG AUTO CUỘN
532+
setState(OS_NONE);
533+
// giữ mOffsetY, không spring
534+
} else if (isOsBottom()) {
535+
// 🔽 KÉO XUỐNG ĐÁY → VẪN SPRING BACK
536+
final int startScrollY = Math.round(mOffsetY);
537+
mScroller.start(startScrollY, DRAG_BACK_DURATION, sDragBackPathPointsHolder);
538+
setState(OS_SPRING_BACK);
539+
}
540+
mView.invalidate();
541+
}
542+
543+
mActivePointerId = INVALID_POINTER;
544+
}
542545
}
543546
return isOsDrag();
544547
}

0 commit comments

Comments
 (0)