Giter Site home page Giter Site logo

Comments (2)

TokenYc avatar TokenYc commented on June 8, 2024

I handle the problem like this.Maybe help someone,but this not a very good solution.
private int oldScrollY=0;
private int moveStartY=0;
@OverRide
public boolean dispatchTouchEvent(@SuppressWarnings("NullableProblems") MotionEvent event) {

    if (mSelfUpdateScroll) {
        mIsTouchOngoing = false;
        mIsDraggingDraggable = false;
        mIsScrolling = false;
        mIsFlinging = false;
        removeCallbacks(mIdleRunnable);
        removeCallbacks(mScrollRunnable);
        return super.dispatchTouchEvent(event);
    }

    final int action = event.getActionMasked();
    if (action == MotionEvent.ACTION_DOWN) {
        if (getScrollY()>=mMaxScrollY){
            oldScrollY=0;
        }
        moveStartY=0;
        mIsTouchOngoing = true;
        mScroller.abortAnimation();

        if (mDraggableView != null && mDraggableView.getGlobalVisibleRect(mDraggableRect)) {
            final int x = (int) (event.getRawX() + .5F);
            final int y = (int) (event.getRawY() + .5F);
            mIsDraggingDraggable = mDraggableRect.contains(x, y);
        } else {
            mIsDraggingDraggable = false;
        }
    } else if (action == MotionEvent.ACTION_UP
            || action == MotionEvent.ACTION_CANCEL) {
        moveStartY=0;
        mIsTouchOngoing = false;

        if (mCloseUpAlgorithm != null) {
            removeCallbacks(mIdleRunnable);
            postDelayed(mIdleRunnable, mConsiderIdleMillis);
        }
    }else if(action==MotionEvent.ACTION_MOVE){
        if (getScrollY()<mMaxScrollY) {
            oldScrollY = getScrollY();
        }else if (getScrollY()==mMaxScrollY){
            if (moveStartY==0){
                moveStartY= (int) event.getRawY();
            }else if (moveStartY-event.getRawY()>100){
                oldScrollY=0;
            }
        }
    }

    final boolean isPrevScrolling = mIsScrolling;
    final boolean isPrevFlinging = mIsFlinging;

    mIsFlinging = mFlingDetector.onTouchEvent(event);
    mIsScrolling = mScrollDetector.onTouchEvent(event);

    removeCallbacks(mScrollRunnable);
    post(mScrollRunnable);

    final boolean isIntercepted = mIsScrolling || mIsFlinging;
    final boolean isPrevIntercepted = isPrevScrolling || isPrevFlinging;

    final boolean shouldRedirectDownTouch = action == MotionEvent.ACTION_MOVE
            && (!isIntercepted && isPrevIntercepted)
            && getScrollY() == mMaxScrollY;

    if (isIntercepted || isPrevIntercepted) {

        mMotionEventHook.hook(event, MotionEvent.ACTION_CANCEL);

        if (!isPrevIntercepted) {
            return true;
        }
    }

    if (shouldRedirectDownTouch) {
        mMotionEventHook.hook(event, MotionEvent.ACTION_DOWN);
    }
    if (action == MotionEvent.ACTION_UP
            || action == MotionEvent.ACTION_CANCEL){
        moveStartY=0;
        if (getScrollY()==mMaxScrollY&&(mMaxScrollY-oldScrollY<200)){
            oldScrollY=0;
            return true;
        }
    }

    super.dispatchTouchEvent(event);
    return true;
}

from scrollable.

noties avatar noties commented on June 8, 2024

I have fixed it, it's in pull request already: #46

from scrollable.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.