ozodrukh/CircularReveal

Reverse animation not working on Note 2

Closed this issue · 4 comments

CircularReveal is working but when I try to play the reverse animation, its working on all devices except Note 2 (Android 4.4.2). Any help would be appreciated.

show your code?

Code that triggers the animations -

view.findViewById(R.id.coverView).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mCurrentCircularRevealView = circularRevealView;
                circularRevealView.startAnimation(R.color.up_vote_cover_color);
                circularRevealView.postDelayed(new Runnable() {
                    @Override
                    public void run() {
                        circularRevealView.startReverseAnimation();
                    }
                }, 1000);
            }
        });

To start the initial animation -

    public void startAnimation(int resId) {
        if (mIsViewCovered) {
            return;
        }

        int cx = (getLeft() + getRight()) / 2;
        int cy = (getTop() + getBottom()) / 2;
        int finalRadius = Math.max(getWidth(), getHeight());
        mCoverAnimator = ViewAnimationUtils.createCircularReveal(this, cx, cy, 0, finalRadius);
        mCoverAnimator.setInterpolator(new AccelerateDecelerateInterpolator());
        mCoverAnimator.setDuration(500);

        mCoverAnimator.addListener(mCoverListener);

        mReverseAnimator = mCoverAnimator.reverse();
        mReverseAnimator.addListener(mRevealListener);

        setBackgroundResource(resId);
        mIsViewCovered = true;
        mCoverAnimator.start();
    }

Reverse Animation - 

public void startReverseAnimation() {
        if (mReverseAnimator == null || mReverseAnimator.isRunning() || !mIsViewCovered) {
            return;
        }

        mReverseAnimator.setDuration(500);
        mReverseAnimator.start();
        mIsViewCovered = false;
    }

What happens in your setBackgroundResource()?
I believe that may affect the animation.
Also, you have to set the duration after reversing the animation because it gets reset.
Eg:

    mReverseAnimator = mCoverAnimator.reverse();
    mReverseAnimator.setDuration(500);

Deprecated