JazzyViewPager
JazzyViewPager copied to clipboard
Stack animation is not working properly
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)
your commit not solve that issue yet. i test it on genymotion Google Nexus 5, os version 5.1.0
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.