package com.tencent.mm.plugin.facedetect.ui;

import android.graphics.Bitmap;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.tencent.matrix.trace.core.AppMethodBeat;
import com.tencent.mm.sdk.platformtools.ab;
import com.tencent.mm.sdk.platformtools.bo;

public final class b extends a {
    private Button lWA;
    private Button lWE;
    private TextView lWG;
    private ViewGroup lYe;
    private ImageView lYf;
    private RelativeLayout lYg;
    private RelativeLayout lYh;
    private RelativeLayout lYi;
    private ImageView lYj;
    private ImageView lYk;
    private ImageView lYl;
    private TextView lYm;
    private TextView lYn;
    private TextView lYo;

    b(FaceDetectPrepareUI faceDetectPrepareUI) {
        super(faceDetectPrepareUI);
    }

    public final void create() {
        AppMethodBeat.i(508);
        synchronized (((FaceDetectPrepareUI) this.lWJ.get())) {
            try {
                if (this.lWJ.get() != null) {
                    this.lYe = (ViewGroup) ((FaceDetectPrepareUI) this.lWJ.get()).findViewById(2131823811);
                    this.lYf = (ImageView) ((FaceDetectPrepareUI) this.lWJ.get()).findViewById(2131823812);
                    this.lYg = (RelativeLayout) ((FaceDetectPrepareUI) this.lWJ.get()).findViewById(2131823751);
                    this.lYh = (RelativeLayout) ((FaceDetectPrepareUI) this.lWJ.get()).findViewById(2131823747);
                    this.lYi = (RelativeLayout) ((FaceDetectPrepareUI) this.lWJ.get()).findViewById(2131823742);
                    this.lYj = (ImageView) ((FaceDetectPrepareUI) this.lWJ.get()).findViewById(2131823753);
                    this.lYk = (ImageView) ((FaceDetectPrepareUI) this.lWJ.get()).findViewById(2131823752);
                    this.lYl = (ImageView) ((FaceDetectPrepareUI) this.lWJ.get()).findViewById(2131823749);
                    this.lWE = (Button) ((FaceDetectPrepareUI) this.lWJ.get()).findViewById(2131823815);
                    this.lWA = (Button) ((FaceDetectPrepareUI) this.lWJ.get()).findViewById(2131823813);
                    this.lWG = (TextView) ((FaceDetectPrepareUI) this.lWJ.get()).findViewById(2131823814);
                    this.lYm = (TextView) ((FaceDetectPrepareUI) this.lWJ.get()).findViewById(2131823754);
                    this.lYn = (TextView) ((FaceDetectPrepareUI) this.lWJ.get()).findViewById(2131823750);
                    this.lYo = (TextView) ((FaceDetectPrepareUI) this.lWJ.get()).findViewById(2131823744);
                    this.lYe.setVisibility(8);
                }
            } finally {
                while (true) {
                }
                AppMethodBeat.o(508);
            }
        }
    }

    public final void a(c cVar) {
        AppMethodBeat.i(509);
        ab.i("MicroMsg.FaceReflectJumper", "show config: %s", new Object[]{cVar});
        this.lYe.setVisibility(0);
        if (cVar.lYz) {
            if (cVar.lYP != null) {
                this.lWE.setOnClickListener(cVar.lYP);
            }
            this.lWE.setVisibility(0);
            if (!bo.isNullOrNil(cVar.lYI)) {
                this.lWE.setText(cVar.lYI);
            }
        } else {
            this.lWE.setVisibility(8);
        }
        if (cVar.lYw) {
            if (cVar.lYM != null) {
                this.lWA.setOnClickListener(cVar.lYM);
            }
            this.lWA.setVisibility(0);
            if (!bo.isNullOrNil(cVar.lYG)) {
                this.lWA.setText(cVar.lYG);
            }
        } else {
            this.lWA.setVisibility(8);
        }
        if (cVar.lYC) {
            if (cVar.lYO != null) {
                this.lWG.setClickable(true);
                this.lWG.setOnClickListener(cVar.lYO);
            }
            this.lWG.setVisibility(0);
            if (!bo.isNullOrNil(cVar.lYK)) {
                this.lWG.setText(cVar.lYK);
            }
        } else {
            this.lWG.setVisibility(8);
        }
        if (cVar.lYE != null) {
            this.lYf.setImageBitmap(cVar.lYE);
        }
        switch (cVar.status) {
            case 1:
                if (!bo.isNullOrNil(cVar.lYF)) {
                    this.lYm.setText(cVar.lYF);
                }
                ab.i("MicroMsg.FaceReflectJumper", "checking animation");
                this.lYg.setVisibility(0);
                this.lYh.setVisibility(8);
                this.lYi.setVisibility(8);
                this.lYj.post(new 1(this));
                AppMethodBeat.o(509);
                return;
            case 2:
                if (!bo.isNullOrNil(cVar.lYF)) {
                    this.lYn.setText(cVar.lYF);
                }
                ab.i("MicroMsg.FaceReflectJumper", "check success animation");
                this.lYk.clearAnimation();
                this.lYg.setVisibility(8);
                this.lYh.setVisibility(0);
                this.lYg.setVisibility(8);
                this.lYi.setVisibility(8);
                this.lYl.setScaleX(0.0f);
                this.lYl.setScaleY(0.0f);
                this.lYl.animate().scaleX(1.0f).scaleY(1.0f).setDuration(800);
                AppMethodBeat.o(509);
                return;
            case 3:
                if (!bo.isNullOrNil(cVar.lYF)) {
                    this.lYo.setText(cVar.lYF);
                }
                ab.i("MicroMsg.FaceReflectJumper", "check failed animation");
                this.lYh.setVisibility(8);
                this.lYg.setVisibility(8);
                this.lYi.setVisibility(0);
                this.lYk.clearAnimation();
                this.lYg.setVisibility(8);
                break;
        }
        AppMethodBeat.o(509);
    }

    public final void dismiss() {
        AppMethodBeat.i(510);
        ab.c("MicroMsg.FaceReflectJumper", "dismiss jumper", new Object[0]);
        if (this.lWJ.get() != null) {
            ((FaceDetectPrepareUI) this.lWJ.get()).runOnUiThread(new 2(this));
        }
        AppMethodBeat.o(510);
    }

    public final void M(Bitmap bitmap) {
        AppMethodBeat.i(511);
        this.lYf.setImageBitmap(bitmap);
        AppMethodBeat.o(511);
    }

    public final void resetAll() {
        AppMethodBeat.i(com.tencent.mm.plugin.appbrand.jsapi.container.b.CTRL_INDEX);
        this.lYg.setVisibility(8);
        this.lYh.setVisibility(8);
        this.lYi.setVisibility(8);
        this.lWE.setVisibility(8);
        this.lWG.setVisibility(8);
        this.lWA.setVisibility(8);
        AppMethodBeat.o(com.tencent.mm.plugin.appbrand.jsapi.container.b.CTRL_INDEX);
    }

    public final boolean aFF() {
        AppMethodBeat.i(513);
        if (this.lYe.getVisibility() == 0) {
            AppMethodBeat.o(513);
            return true;
        }
        AppMethodBeat.o(513);
        return false;
    }
}
