package com.bytedance.android.livesdk.share;

import X.0b0;
import X.0cm;
import X.0dh;
import X.7AW;
import X.C0536Fjq;
import X.C1044Fun;
import X.C1128Fw9;
import X.C2704GgT;
import X.HFX;
import X.J7M;
import X.M12;
import android.app.Dialog;
import android.content.res.Configuration;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.Window;
import com.bytedance.android.live.share.IShareService;
import com.bytedance.android.livesdk.LiveDialogFragment;
import com.bytedance.covode.number.Covode;
import com.bytedance.ies.sdk.datachannel.DataChannel;
import java.util.HashMap;
import kotlin.h.b.n;

public final class LiveShareDialog extends LiveDialogFragment {
    public static final C1128Fw9 LIZJ = new C1128Fw9((byte) 0);
    public C2704GgT LIZ;
    public J7M LIZIZ;
    public boolean LIZLLL;
    public HashMap LJ;

    static {
        Covode.recordClassIndex(20762);
    }

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

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

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

    public LiveShareDialog() {
        this.LIZLLL = true;
    }

    public final C1044Fun LIZ() {
        boolean z;
        int i;
        int i2;
        int LIZ2;
        Boolean bool;
        DataChannel dataChannel = this.LJIILIIL;
        if (dataChannel == null || (bool = (Boolean) dataChannel.LIZIZ(HFX.class)) == null) {
            z = true;
        } else {
            z = bool.booleanValue();
        }
        this.LIZLLL = z;
        if (z) {
            i = 2131887269;
            if (z) {
                i2 = 80;
            } else {
                if (z) {
                    throw new 7AW();
                }
                i2 = 5;
            }
        } else {
            i = 2131887270;
            i2 = 5;
        }
        if (z) {
            LIZ2 = -1;
        } else if (!z) {
            LIZ2 = (int) C0536Fjq.LIZ(getContext(), 490.0f);
        } else {
            throw new 7AW();
        }
        boolean z2 = this.LIZLLL;
        if (z2 || !z2) {
            C1044Fun fun = new C1044Fun(2131561568);
            fun.LIZIZ = i;
            fun.LJI = i2;
            fun.LJII = LIZ2;
            fun.LJIIIIZZ = -1;
            return fun;
        }
        throw new 7AW();
    }

    public /* synthetic */ LiveShareDialog(byte b) {
        this();
    }

    public final void onConfigurationChanged(Configuration configuration) {
        M12.LIZ(configuration);
        LiveShareDialog.super.onConfigurationChanged(configuration);
        if (LJIIJ()) {
            dismiss();
        }
    }

    public final LayoutInflater onGetLayoutInflater(Bundle bundle) {
        LayoutInflater cloneInContext = LiveShareDialog.super.onGetLayoutInflater(bundle).cloneInContext(0dh.LIZ(getActivity()));
        n.LIZIZ(cloneInContext, "");
        return cloneInContext;
    }

    public final Dialog LIZ(Bundle bundle) {
        if (this.LIZ == null || this.LIZIZ == null) {
            return super.LIZ(bundle);
        }
        return 0cm.LIZ(IShareService.class).share().LIZIZ(getActivity(), this.LIZ, this.LIZIZ);
    }

    public static final LiveShareDialog LIZ(C2704GgT ggT, J7M j7m) {
        M12.LIZ(ggT, j7m);
        LiveShareDialog liveShareDialog = new LiveShareDialog((byte) 0);
        liveShareDialog.LIZ = ggT;
        liveShareDialog.LIZIZ = j7m;
        return liveShareDialog;
    }

    public final void onViewCreated(View view, Bundle bundle) {
        Dialog dialog;
        Window window;
        M12.LIZ(view);
        super.onViewCreated(view, bundle);
        if (this.LIZLLL && (dialog = getDialog()) != null && (window = dialog.getWindow()) != null) {
            window.setStatusBarColor(0b0.LIZIZ(2131100577));
        }
    }
}
