package com.bytedance.android.livesdk.dialogv2.widget.banner.group;

import X.0Ul;
import X.0b0;
import X.0bg;
import X.0bh;
import X.1jk;
import X.C1044Fun;
import X.C2385GbK;
import X.C4178HAd;
import X.C4179HAe;
import X.C4180HAf;
import X.C4181HAg;
import X.M12;
import android.app.Dialog;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.widget.ImageView;
import com.bytedance.android.live.base.model.ImageModel;
import com.bytedance.android.live.base.model.user.User;
import com.bytedance.android.livesdk.LiveDialogFragment;
import com.bytedance.android.livesdk.model.Gift;
import com.bytedance.android.livesdk.service.assets.GiftManager;
import com.bytedance.covode.number.Covode;
import java.util.HashMap;

public final class LiveGiftGroupSendConfirmDialog extends LiveDialogFragment {
    public boolean LIZ;
    public long LIZIZ;
    public View LIZJ;
    public User LIZLLL;
    public int LJ;
    public C4181HAg LJFF;
    public ImageView LJI;
    public View LJII;
    public View LJIIIIZZ;
    public 1jk LJIIIZ;
    public 1jk LJIIJ;
    public 1jk LJIIJJI;
    public HashMap LJIIZILJ;

    static {
        Covode.recordClassIndex(15781);
    }

    public final View LIZ(int i) {
        if (this.LJIIZILJ == null) {
            this.LJIIZILJ = new HashMap();
        }
        View view = (View) this.LJIIZILJ.get(Integer.valueOf(i));
        if (view != null) {
            return view;
        }
        View view2 = getView();
        if (view2 == null) {
            return null;
        }
        View findViewById = view2.findViewById(i);
        this.LJIIZILJ.put(Integer.valueOf(i), findViewById);
        return findViewById;
    }

    public final /* synthetic */ void onDestroyView() {
        super.onDestroyView();
        z_();
    }

    public final void z_() {
        HashMap hashMap = this.LJIIZILJ;
        if (hashMap != null) {
            hashMap.clear();
        }
    }

    public final C1044Fun LIZ() {
        C1044Fun fun = new C1044Fun(2131561600);
        fun.LJIIJJI = 48;
        fun.LJI = 17;
        return fun;
    }

    public final void onStart() {
        Window window;
        super.onStart();
        Dialog dialog = getDialog();
        if (dialog != null && (window = dialog.getWindow()) != null) {
            window.setLayout(-1, -1);
        }
    }

    public final void onViewCreated(View view, Bundle bundle) {
        ImageModel imageModel;
        int i;
        int i2;
        String string;
        String str;
        String str2;
        String str3;
        String str4;
        int i3;
        M12.LIZ(view);
        super.onViewCreated(view, bundle);
        this.LJI = (ImageView) view.findViewById(2131365323);
        this.LJII = view.findViewById(2131370090);
        this.LIZJ = view.findViewById(2131370031);
        this.LJIIIIZZ = view.findViewById(2131363126);
        this.LJIIIZ = view.findViewById(2131365433);
        this.LJIIJ = view.findViewById(2131365431);
        this.LJIIJJI = view.findViewById(2131365432);
        1jk r8 = this.LJIIJ;
        String str5 = "";
        if (r8 != null) {
            Object[] objArr = new Object[4];
            User user = this.LIZLLL;
            if (user == null || (str3 = 0Ul.LIZ(user)) == null) {
                str3 = str5;
            }
            objArr[0] = str3;
            Gift findGiftById = GiftManager.inst().findGiftById(this.LIZIZ);
            if (findGiftById == null || (str4 = findGiftById.LIZ) == null) {
                str4 = str5;
            }
            objArr[1] = str4;
            objArr[2] = String.valueOf(this.LJ);
            int i4 = this.LJ;
            Gift findGiftById2 = GiftManager.inst().findGiftById(this.LIZIZ);
            if (findGiftById2 != null) {
                i3 = findGiftById2.LJFF;
            } else {
                i3 = 0;
            }
            objArr[3] = String.valueOf(i4 * i3);
            r8.setText(getString(2131828864, objArr));
        }
        1jk r6 = this.LJIIIZ;
        if (r6 != null) {
            if (0b0.LJI()) {
                Object[] objArr2 = new Object[2];
                Gift findGiftById3 = GiftManager.inst().findGiftById(this.LIZIZ);
                if (!(findGiftById3 == null || (str2 = findGiftById3.LIZ) == null)) {
                    str5 = str2;
                }
                objArr2[0] = str5;
                objArr2[1] = String.valueOf(this.LJ);
                string = getString(2131829000, objArr2);
            } else {
                Object[] objArr3 = new Object[2];
                Gift findGiftById4 = GiftManager.inst().findGiftById(this.LIZIZ);
                if (!(findGiftById4 == null || (str = findGiftById4.LIZ) == null)) {
                    str5 = str;
                }
                objArr3[0] = str5;
                objArr3[1] = String.valueOf(this.LJ);
                string = getString(2131828999, objArr3);
            }
            r6.setText(string);
        }
        C2385GbK LIZ2 = 0bg.LIZ();
        Gift findGiftById5 = GiftManager.inst().findGiftById(this.LIZIZ);
        if (findGiftById5 != null) {
            imageModel = findGiftById5.LIZIZ;
        } else {
            imageModel = null;
        }
        0bh.LIZ(LIZ2, imageModel);
        ImageView imageView = this.LJI;
        if (imageView != null) {
            i = imageView.getWidth();
        } else {
            i = 0;
        }
        ImageView imageView2 = this.LJI;
        if (imageView2 != null) {
            i2 = imageView2.getHeight();
        } else {
            i2 = 0;
        }
        LIZ2.LIZ(i, i2);
        LIZ2.LIZ((View) this.LJI);
        View view2 = this.LIZJ;
        if (view2 != null) {
            view2.setOnClickListener(new C4180HAf(this));
        }
        setCancelable(false);
        View view3 = this.LJIIIIZZ;
        if (view3 != null) {
            view3.setOnClickListener(new C4178HAd(this));
        }
        View view4 = this.LJII;
        if (view4 != null) {
            view4.setOnClickListener(new C4179HAe(this));
        }
    }
}
