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

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.plugin.sns.ui.c.a.a;
import com.tencent.mm.plugin.sns.ui.c.a.b;
import com.tencent.mm.sdk.platformtools.ab;
import com.tencent.mm.ui.MMActivity;
import com.tencent.mm.ui.ae;

class c$3 extends AnimatorListenerAdapter {
    final /* synthetic */ MMActivity icV;
    final /* synthetic */ c rGh;
    final /* synthetic */ a rGi;

    c$3(c cVar, MMActivity mMActivity, a aVar) {
        this.rGh = cVar;
        this.icV = mMActivity;
        this.rGi = aVar;
    }

    public final void onAnimationStart(Animator animator) {
        AppMethodBeat.i(40012);
        ab.i("MicroMsg.CardAdDetailBackAnimation", "onAnimation start");
        this.rGh.rFX.contentView.getLocationInWindow(this.rGh.rGg);
        ab.i("MicroMsg.CardAdDetailBackAnimation", "card container location in window %s, %s", new Object[]{Integer.valueOf(this.rGh.rGg[0]), Integer.valueOf(this.rGh.rGg[1])});
        this.rGh.rGf = new LayoutParams(-2, -2);
        this.rGh.rGf.leftMargin = this.rGh.rGg[0];
        this.rGh.rGf.rightMargin = (this.rGh.rGb.getWidth() - this.rGh.rGf.leftMargin) - this.rGh.rFX.contentView.getWidth();
        this.rGh.rGf.topMargin = this.rGh.rGg[1] - ae.getStatusBarHeight(this.icV);
        this.rGh.rGf.bottomMargin = (this.rGh.rGb.getHeight() - this.rGh.rGf.topMargin) - this.rGh.rFX.contentView.getHeight();
        int[] iArr = new int[2];
        this.rGh.rFX.rGN.getLocationInWindow(iArr);
        ab.i("MicroMsg.CardAdDetailBackAnimation", "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.rGh.rGb.getWidth() - layoutParams.leftMargin) - this.rGh.rFX.rGN.getWidth();
        layoutParams.topMargin = iArr[1] - ae.getStatusBarHeight(this.icV);
        layoutParams.bottomMargin = (this.rGh.rGb.getHeight() - layoutParams.topMargin) - this.rGh.rFX.rGN.getHeight();
        int[] iArr2 = new int[2];
        this.rGh.rFX.rGO.getLocationInWindow(iArr2);
        ab.i("MicroMsg.CardAdDetailBackAnimation", "other container location in window %s, %s", new Object[]{Integer.valueOf(iArr2[0]), Integer.valueOf(iArr2[1])});
        LayoutParams layoutParams2 = new LayoutParams(-1, -2);
        layoutParams2.leftMargin = iArr2[0];
        layoutParams2.rightMargin = (this.rGh.rGb.getWidth() - layoutParams2.leftMargin) - ((b) this.rGi).rGO.getWidth();
        layoutParams2.topMargin = iArr2[1] - ae.getStatusBarHeight(this.icV);
        layoutParams2.bottomMargin = (this.rGh.rGb.getHeight() - layoutParams2.topMargin) - ((b) this.rGi).rGO.getHeight();
        ViewGroup.LayoutParams layoutParams3 = this.rGh.rFX.rpP.getLayoutParams();
        layoutParams3.width = this.rGh.rFX.contentView.getWidth();
        layoutParams3.height = (this.rGh.rFX.contentView.getHeight() + this.rGh.rGc.topMargin) + this.rGh.rGc.bottomMargin;
        this.rGh.rFX.rpP.setLayoutParams(layoutParams3);
        this.rGh.rFX.rGO.setAlpha(0.0f);
        ((ViewGroup) this.rGh.rFX.rpP).removeView(this.rGh.rFX.contentView);
        this.rGh.rGb.addView(this.rGh.rFX.contentView, new LayoutParams(-1, -1));
        ((ViewGroup) this.rGh.rFX.contentView).removeView(this.rGh.rFX.rGN);
        this.rGh.rGb.addView(this.rGh.rFX.rGN, layoutParams);
        ((ViewGroup) this.rGh.rFX.contentView).removeView(this.rGh.rFX.rGO);
        this.rGh.rGb.addView(this.rGh.rFX.rGO, layoutParams2);
        this.rGh.rFX.rGN.setScaleX(0.0f);
        this.rGh.rFX.rGN.setScaleY(0.0f);
        this.rGh.rFX.rGN.setAlpha(0.0f);
        AppMethodBeat.o(40012);
    }

    public final void onAnimationEnd(Animator animator) {
        AppMethodBeat.i(40013);
        ab.i("MicroMsg.CardAdDetailBackAnimation", "onAnimation end");
        ((ViewGroup) this.icV.mController.ylv.getParent()).removeView(this.rGh.rFX.contentView);
        ((ViewGroup) this.icV.mController.ylv.getParent()).removeView(this.rGh.rFX.rGN);
        ((ViewGroup) this.icV.mController.ylv.getParent()).removeView(this.rGh.rFX.rGO);
        this.rGh.rFX.rGN.setScaleX(1.0f);
        this.rGh.rFX.rGN.setScaleY(1.0f);
        this.rGh.rFX.rGN.setAlpha(1.0f);
        ((ViewGroup) this.rGh.rFX.rpP).addView(this.rGh.rFX.contentView, this.rGh.rGc);
        ((ViewGroup) this.rGh.rFX.contentView).addView(this.rGh.rFX.rGN, this.rGh.rGd);
        ((ViewGroup) this.rGh.rFX.contentView).addView(this.rGh.rFX.rGO, this.rGh.rGe);
        this.rGh.rFX.contentView.setAlpha(1.0f);
        this.rGh.rFX.rGO.setAlpha(1.0f);
        if (this.rGh.rFW != null) {
            this.rGh.rFW.onAnimationEnd();
        }
        AppMethodBeat.o(40013);
    }
}
