JazzyViewPager icon indicating copy to clipboard operation
JazzyViewPager copied to clipboard

Stack animation is not working properly

Open makovkastar opened this issue 11 years ago • 2 comments

When user starts dragging the top page - the bottom page immediately overlaps it. See attached screenshots. This bug is appearing constantly on my Nexus S (Android 4.1.2) and on emulator (Android 4.2)

screenshot_2013-05-01-14-53-54

screenshot_2013-05-01-15-16-49

makovkastar avatar May 01 '13 12:05 makovkastar

your commit not solve that issue yet. i test it on genymotion Google Nexus 5, os version 5.1.0

shayanpourvatan avatar Sep 13 '15 15:09 shayanpourvatan

i fixed my issue with following code:

 @TargetApi(Build.VERSION_CODES.LOLLIPOP)
    protected void animateStack(View left, View right, float positionOffset, int positionOffsetPixels) {


        if (mState == State.IDLE) {
            return;
        }


        if (mState == State.GOING_RIGHT) {


            if (right != null) {

                manageLayer(right, true);
                mScale = (1 - SCALE_MAX) * positionOffset + SCALE_MAX;
                mTrans = -getWidth() - getPageMargin() + positionOffsetPixels;
                ViewHelper.setScaleX(right, mScale);
                ViewHelper.setScaleY(right, mScale);
                ViewHelper.setTranslationX(right, mTrans);

                if (API_21) {
                    right.setZ(mScale);
                }
            }

            if (left != null) {

                left.bringToFront();

                if (API_21) {
                    left.setZ(1);
                }
            }
        } else if (mState == State.GOING_LEFT) {

            if (left != null) {

                mScale = (1 - SCALE_MAX) * (1 - positionOffset) + SCALE_MAX;
                mTrans = positionOffsetPixels;
                ViewHelper.setScaleX(left, mScale);
                ViewHelper.setScaleY(left, mScale);
                ViewHelper.setTranslationX(left, mTrans);

                if (API_21) {
                    left.setZ(mScale);
                }
            }


            if (right != null) {
                manageLayer(right, true);
                if (API_21) {
                    right.setZ(1);
                }

                right.bringToFront();
            }
        }
    }

and add API 21 as API 11 in static values like following:

API_21 = Build.VERSION.SDK_INT >= 21;

this is what i want, might be useful for some one else.

shayanpourvatan avatar Sep 13 '15 16:09 shayanpourvatan