android-coverflow
android-coverflow copied to clipboard
Images do not flatten out when in the middle
Suggest making the following modification to Coverflow.getChildStaticTransformation() so that the center image is flattened out...
@Override
protected boolean getChildStaticTransformation(final View child, final Transformation t) {
final int childCenter = getCenterOfView(child);
final int childWidth = child.getWidth();
int rotationAngle = 0;
t.clear();
t.setTransformationType(Transformation.TYPE_MATRIX);
if (childCenter > mCoveflowCenter - (childWidth /2) && childCenter < mCoveflowCenter + (childWidth /2)) {
transformImageBitmap((ImageView) child, t, 0);
} else {
rotationAngle = (int) ((float) (mCoveflowCenter - childCenter) / childWidth * mMaxRotationAngle);
if (Math.abs(rotationAngle) > mMaxRotationAngle) {
rotationAngle = rotationAngle < 0 ? -mMaxRotationAngle : mMaxRotationAngle;
}
transformImageBitmap((ImageView) child, t, rotationAngle);
}
return true;
}
Three years old but still life saver. 👍