Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Coverflow issue on 4.0.3 Samsung Galaxy S2

I'm using android coverflow, and it works fine on most of devices, but it seems that in Android 4.0.3 it does not put the center image back to the center once that you slide back and forth.

They remain "stuck" and under the wrong angle.

Did anyone had similar issues? What could cause this behavior?

So middle image on the attached image should be centered and not angled as it is.

CowerFlow Issue

like image 396
Balkyto Avatar asked Oct 22 '12 15:10

Balkyto


2 Answers

I just added

child.invalidate() 

before

final int childCenter = getCenterOfView(child); in getChildStaticTransformation(View child, Transformation t) 

so it becomes

protected boolean getChildStaticTransformation(View child, Transformation t) {

    child.invalidate();
    final int childCenter = getCenterOfView(child);
    final int childWidth = child.getWidth();
    int rotationAngle = 0;
like image 76
Shantur Avatar answered Sep 23 '22 11:09

Shantur


Are you using Neil Davies Coverflow Widget V2?

If yes, I found out the problem. If no, I am sorry, I can't help you.

The problem is in the function getCenterOfView. More accurate, it is a problem about view.getLeft(). <-- please tell me if anyone know why it is different after 4.0

The value return from view.getLeft() is different at every time. So this will affect another function getChildStaticTransformation, it can't find which imageview is the center.

My solution, a dirty fix, is give a range for it to detect its center.

if (childCenter <= mCoveflowCenter + 125
            && childCenter >= mCoveflowCenter - 125) {
        transformImageBitmap((ImageView) child, t, 0);
}

Please let me know if anyone has a better solution on this.

like image 29
Rush Avatar answered Sep 24 '22 11:09

Rush