package com.ss.android.ugc.aweme.commercialize.adsetting;

import X.0HH;
import X.M12;
import X.TSt;
import android.app.Dialog;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import androidx.fragment.app.DialogFragment;
import com.bytedance.covode.number.Covode;
import java.util.HashMap;

public abstract class AdBaseDialogFragment extends DialogFragment {
    public HashMap LIZ;

    static {
        Covode.recordClassIndex(58263);
    }

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

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

    public /* synthetic */ void onDestroyView() {
        AdBaseDialogFragment.super.onDestroyView();
        LIZ();
    }

    public void dismiss() {
        try {
            AdBaseDialogFragment.super.dismiss();
        } catch (Exception e) {
            TSt.LIZ(e);
        }
    }

    public void onCreate(Bundle bundle) {
        AdBaseDialogFragment.super.onCreate(bundle);
        setStyle(1, 2131886315);
    }

    public void onViewCreated(View view, Bundle bundle) {
        Window window;
        M12.LIZ(view);
        AdBaseDialogFragment.super.onViewCreated(view, bundle);
        Dialog dialog = getDialog();
        if (dialog != null && (window = dialog.getWindow()) != null) {
            window.getDecorView().setPadding(0, 0, 0, 0);
            window.setGravity(80);
            window.setLayout(-1, -2);
        }
    }

    public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
        M12.LIZ(layoutInflater);
        return 0HH.LIZ(layoutInflater, 2131559538, viewGroup, false);
    }
}
