android-coverflow icon indicating copy to clipboard operation
android-coverflow copied to clipboard

Images do not flatten out when in the middle

Open SheldonNeilson opened this issue 11 years ago • 1 comments

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;
    }

SheldonNeilson avatar May 13 '14 06:05 SheldonNeilson

Three years old but still life saver. 👍

ghost avatar May 18 '17 14:05 ghost