Skip to content

Panel glitching and stopping in the middle every so often #525

Open
@PhpXp

Description

@PhpXp

Since I first tried this library I had a problem that every 1 in 50 times or so the panel glitched and got stuck in the middle even though I had no anchor point set.

Example: https://gfycat.com/SeparateInformalAmericanavocet

ignore the View animations it's just an example I think it happens when I try to expand the panel very quickly.

After some debugging I noticed the issue is in the ViewDragHelper:

public boolean continueSettling(boolean deferCallbacks) {
    // Make sure, there is a captured view
    if (mCapturedView == null) {
        return false;
    }
    if (mDragState == STATE_SETTLING) {
        boolean keepGoing = mScroller.computeScrollOffset();
        final int x = mScroller.getCurrX();
        final int y = mScroller.getCurrY();
        final int dx = x - mCapturedView.getLeft();
        final int dy = y - mCapturedView.getTop();

        if(!keepGoing && dy != 0) { //add this 5 lines
            //Invalid drag state
            mCapturedView.setTop(0);
            return true;
        }
        // ...

I don't know why it happens but everytime it does, keepGoing is false but dy is a very large negative number (around -600) instead of 0. The correct behaviour is that when y is getting close to 0, so should dy.

So adding those 5 lines fixes the glitching but it's really just a workaround.

I have Android 5.1.1 on an Z3 Compact, but the issue was already present in 5.0.2.

Does anyone else experience this glitch?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions