package com.tencent.mm.plugin.sns.ui.b.b;

import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.view.ViewGroup;
import android.widget.FrameLayout.LayoutParams;
import com.tencent.matrix.trace.core.AppMethodBeat;
import com.tencent.mm.sdk.platformtools.ab;
import java.util.Iterator;

class c$2 extends AnimatorListenerAdapter {
    final /* synthetic */ c rGv;

    c$2(c cVar) {
        this.rGv = cVar;
    }

    public final void onAnimationStart(Animator animator) {
        AppMethodBeat.i(40047);
        if (this.rGv.rGu.eBB) {
            ab.i("MicroMsg.CardAdBackAnimation", "holder is busy");
            Iterator it = this.rGv.rGa.getChildAnimations().iterator();
            while (it.hasNext()) {
                ((Animator) it.next()).cancel();
            }
            AppMethodBeat.o(40047);
            return;
        }
        this.rGv.rGu.eBB = true;
        this.rGv.rGu.rIE.getLocationInWindow(this.rGv.rGg);
        ab.i("MicroMsg.CardAdBackAnimation", "card container location in window %s, %s", new Object[]{Integer.valueOf(this.rGv.rGg[0]), Integer.valueOf(this.rGv.rGg[1])});
        this.rGv.rGf = new LayoutParams(-2, -2);
        this.rGv.rGf.leftMargin = this.rGv.rGg[0];
        this.rGv.rGf.rightMargin = (this.rGv.rGb.getWidth() - this.rGv.rGf.leftMargin) - this.rGv.rGu.rIE.getWidth();
        this.rGv.rGf.topMargin = this.rGv.rGg[1];
        this.rGv.rGf.bottomMargin = (this.rGv.rGb.getHeight() - this.rGv.rGf.topMargin) - this.rGv.rGu.rIE.getHeight();
        int[] iArr = new int[2];
        this.rGv.rGu.rIF.getLocationInWindow(iArr);
        ab.i("MicroMsg.CardAdBackAnimation", "media container location in window %s, %s", new Object[]{Integer.valueOf(iArr[0]), Integer.valueOf(iArr[1])});
        LayoutParams layoutParams = new LayoutParams(-2, -2);
        layoutParams.leftMargin = iArr[0];
        layoutParams.rightMargin = (this.rGv.rGb.getWidth() - layoutParams.leftMargin) - this.rGv.rGu.rIF.getWidth();
        layoutParams.topMargin = iArr[1];
        layoutParams.bottomMargin = (this.rGv.rGb.getHeight() - layoutParams.topMargin) - this.rGv.rGu.rIF.getHeight();
        ViewGroup.LayoutParams layoutParams2 = this.rGv.rGu.rHB.getLayoutParams();
        layoutParams2.width = this.rGv.rGu.rIE.getWidth();
        layoutParams2.height = (this.rGv.rGu.rIE.getHeight() + this.rGv.rGc.topMargin) + this.rGv.rGc.bottomMargin;
        this.rGv.rGu.rHB.setLayoutParams(layoutParams2);
        iArr = new int[2];
        this.rGv.rGu.rIG.getLocationInWindow(iArr);
        ab.i("MicroMsg.CardAdBackAnimation", "other container location in window %s, %s", new Object[]{Integer.valueOf(iArr[0]), Integer.valueOf(iArr[1])});
        LayoutParams layoutParams3 = new LayoutParams(-1, -2);
        layoutParams3.leftMargin = iArr[0];
        layoutParams3.rightMargin = (this.rGv.rGb.getWidth() - layoutParams3.leftMargin) - this.rGv.rGu.rIG.getWidth();
        layoutParams3.topMargin = iArr[1];
        layoutParams3.bottomMargin = (this.rGv.rGb.getHeight() - layoutParams3.topMargin) - this.rGv.rGu.rIG.getHeight();
        this.rGv.rGu.rIG.setAlpha(0.0f);
        this.rGv.rGu.rHB.removeView(this.rGv.rGu.rIE);
        this.rGv.rGb.addView(this.rGv.rGu.rIE, new LayoutParams(-1, -1));
        this.rGv.rGu.rIE.removeView(this.rGv.rGu.rIF);
        this.rGv.rGb.addView(this.rGv.rGu.rIF, layoutParams);
        this.rGv.rGu.rIE.removeView(this.rGv.rGu.rIG);
        this.rGv.rGb.addView(this.rGv.rGu.rIG, layoutParams3);
        this.rGv.rGu.rIF.setScaleX(0.0f);
        this.rGv.rGu.rIF.setScaleY(0.0f);
        this.rGv.rGu.rIF.setAlpha(0.0f);
        AppMethodBeat.o(40047);
    }
}
