package com.bytedance.android.livesdk.adminsetting.fastaddblockwords;

import X.0AP;
import X.0CH;
import X.0dK;
import X.2FV;
import X.2He;
import X.7s1;
import X.7vl;
import X.8jA;
import X.C0978Ftj;
import X.C0980Ftl;
import X.C0981Ftm;
import X.C0982Ftn;
import X.C0983Fto;
import X.C0985Ftq;
import X.C0986Ftr;
import X.C1044Fun;
import X.C1056Fuz;
import X.C2453GcQ;
import X.C2463Gca;
import X.Crj;
import X.M12;
import android.app.Dialog;
import android.content.ClipboardManager;
import android.content.Context;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
import android.os.Looper;
import android.view.View;
import android.view.Window;
import android.view.inputmethod.InputMethodManager;
import com.bytedance.android.livesdk.LiveDialogFragment;
import com.bytedance.covode.number.Covode;
import com.bytedance.frameworks.apm.trace.MethodCollector;
import com.bytedance.ies.sdk.datachannel.DataChannel;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import kotlin.h.b.n;

public final class LiveFastAddBlockKeywordsDialog extends LiveDialogFragment {
    public static final C0985Ftq LIZJ = new C0985Ftq((byte) 0);
    public final Crj LIZ = 7vl.LIZ(C0983Fto.LIZ);
    public List<String> LIZIZ;
    public final Crj LIZLLL = 7vl.LIZ(new C0978Ftj(this));
    public HashMap LJ;

    static {
        Covode.recordClassIndex(11379);
    }

    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 LiveFastAddBlockKeywordsFragment LIZLLL() {
        return (LiveFastAddBlockKeywordsFragment) this.LIZLLL.getValue();
    }

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

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

    public final C1044Fun LIZ() {
        C1044Fun fun = new C1044Fun(2131561624);
        fun.LIZIZ = 2131887251;
        fun.LIZ = 0;
        fun.LJIIJJI = 18;
        fun.LJI = 80;
        fun.LJII = -1;
        fun.LJIIIIZZ = -2;
        return fun;
    }

    public final void dismiss() {
        Object obj;
        Context context = getContext();
        IBinder iBinder = null;
        if (context != null) {
            obj = LIZ(context, "input_method");
        } else {
            obj = null;
        }
        if (!(obj instanceof InputMethodManager)) {
            obj = null;
        }
        InputMethodManager inputMethodManager = (InputMethodManager) obj;
        if (inputMethodManager != null) {
            View view = getView();
            if (view != null) {
                iBinder = view.getWindowToken();
            }
            inputMethodManager.hideSoftInputFromWindow(iBinder, 0);
        }
        super.dismiss();
    }

    public static Object LIZ(Context context, String str) {
        Object obj;
        MethodCollector.i(6210);
        if (Build.VERSION.SDK_INT > 27 || !"clipboard".equals(str)) {
            if (!2FV.LIZIZ && "connectivity".equals(str)) {
                try {
                    new 7s1().LIZ();
                    2FV.LIZIZ = true;
                    obj = context.getSystemService(str);
                } catch (Throwable unused) {
                }
            }
            obj = context.getSystemService(str);
        } else if (2FV.LIZ) {
            synchronized (ClipboardManager.class) {
                try {
                    obj = context.getSystemService(str);
                    if (Thread.currentThread() != Looper.getMainLooper().getThread()) {
                        Field declaredField = ClipboardManager.class.getDeclaredField("mHandler");
                        declaredField.setAccessible(true);
                        declaredField.set(obj, new 2He((Handler) declaredField.get(obj)));
                    }
                } catch (Exception e) {
                    8jA.LIZ(e, "ClipboardManager Handler Reflect Fail");
                } catch (Throwable th) {
                    MethodCollector.o(6210);
                    throw th;
                }
                2FV.LIZ = false;
            }
        } else {
            obj = context.getSystemService(str);
        }
        MethodCollector.o(6210);
        return obj;
    }

    public final void onViewCreated(View view, Bundle bundle) {
        ArrayList<String> stringArrayList;
        Window window;
        M12.LIZ(view);
        super.onViewCreated(view, bundle);
        Bundle arguments = getArguments();
        if (arguments != null && (stringArrayList = arguments.getStringArrayList("key_block_keywords_list")) != null) {
            this.LIZIZ = stringArrayList;
            LIZ(2131367585).setWindowInsetsEnable(true);
            LIZ(2131372939).setOnClickListener(new C0982Ftn(this));
            0AP LIZ2 = getChildFragmentManager().LIZ();
            LIZ2.LIZ(2131363673, LIZLLL());
            LIZ2.LIZIZ();
            DataChannel dataChannel = this.LJIILIIL;
            if (dataChannel != null) {
                dataChannel.LIZ((0CH) this, C2463Gca.class, new C0980Ftl(this));
            }
            DataChannel dataChannel2 = this.LJIILIIL;
            if (dataChannel2 != null) {
                dataChannel2.LIZ((0CH) this, C1056Fuz.class, new C0986Ftr(this));
                dataChannel2.LIZ((0CH) this, C2453GcQ.class, new C0981Ftm(this));
            }
            Dialog dialog = getDialog();
            if (dialog != null && (window = dialog.getWindow()) != null) {
                0dK.LIZ(window);
                window.addFlags(Integer.MIN_VALUE);
                n.LIZIZ(window, "");
                window.setStatusBarColor(0);
                window.setNavigationBarColor(-1);
            }
        }
    }
}
