package com.bytedance.ies.bullet.ui.common;

import X.0HH;
import X.1hK;
import X.7he;
import X.C0984KOx;
import X.C1157KVo;
import X.C1278Ka5;
import X.C1421KcO;
import X.C1422KcP;
import X.C1424KcR;
import X.C1431KcY;
import X.C1599KfG;
import X.C1603KfK;
import X.C1610KfR;
import X.C1896Kk3;
import X.C1903KkA;
import X.C1906KkD;
import X.Crj;
import X.KFR;
import X.KLZ;
import X.KQA;
import X.KSD;
import X.KT7;
import X.M12;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.res.Configuration;
import android.net.Uri;
import android.os.Bundle;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import com.bytedance.covode.number.Covode;
import com.bytedance.frameworks.apm.trace.MethodCollector;
import com.bytedance.ies.uikit.base.AbsFragment;
import java.util.HashMap;
import java.util.List;
import kotlin.h.b.n;

public final class BulletContainerFragment extends AbsFragment implements C1422KcP, C1610KfR, C1603KfK {
    public KFR LIZ;
    public C1903KkA LIZIZ;
    public KQA LIZJ;
    public String LIZLLL;
    public C1599KfG LJ;
    public Uri LJIIIZ;
    public Bundle LJIIJ;
    public View LJIIJJI;
    public final Crj LJIIL = 7he.LIZ(new C1906KkD(this));
    public HashMap LJIILIIL;

    static {
        Covode.recordClassIndex(28936);
    }

    public final C1431KcY getLoggerWrapper() {
        return (C1431KcY) this.LJIIL.getValue();
    }

    public final void LIZ(View view, int i, int i2, int i3, int i4, int i5) {
        M12.LIZ((Object) view);
        FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(-2, -2);
        layoutParams.leftMargin = i2;
        layoutParams.rightMargin = i4;
        layoutParams.topMargin = i3;
        layoutParams.bottomMargin = i5;
        layoutParams.gravity = i;
        view.setLayoutParams(layoutParams);
        this.LJIIJJI = view;
    }

    public final void LIZ(List<? extends C1278Ka5<? extends View>> list, Uri uri, C0984KOx kOx, boolean z) {
        M12.LIZ(list, uri, kOx);
        C1421KcO.LIZ(this, "fragment onLoadKitInstanceSuccess", (C1424KcR) null, (String) null, 6);
        C1903KkA kkA = this.LIZIZ;
        if (kkA != null) {
            kkA.LIZ(list, uri, kOx, z);
        }
    }

    public final void LIZ(View view, Uri uri, C0984KOx kOx) {
        M12.LIZ(view, uri, kOx);
        C1421KcO.LIZ(this, "fragment onLoadUriSuccess", (C1424KcR) null, (String) null, 6);
        C1903KkA kkA = this.LIZIZ;
        if (kkA != null) {
            kkA.LIZ(view, uri, kOx);
        }
    }

    public final C1903KkA LIZIZ() {
        if (this.LIZIZ == null) {
            C1421KcO.LIZ(this, "fragment init rootContainer failed!!!", (C1424KcR) null, (String) null, 6);
        }
        return this.LIZIZ;
    }

    public final /* synthetic */ void onDestroyView() {
        super.onDestroyView();
        HashMap hashMap = this.LJIILIIL;
        if (hashMap != null) {
            hashMap.clear();
        }
    }

    private final void LIZJ() {
        View view = this.LJIIJJI;
        if (view != null) {
            C1599KfG kfG = this.LJ;
            if (kfG == null) {
                n.LIZ("");
            }
            kfG.setLoadingViewInternal$bullet_ui_common_release(view);
        }
    }

    public final void onDestroy() {
        KFR kfr;
        super.onDestroy();
        1hK activity = getActivity();
        if (!(activity == null || (kfr = this.LIZ) == null)) {
            n.LIZ(activity, "");
            kfr.LIZLLL(activity);
        }
        LIZ();
    }

    public final void onPause() {
        KFR kfr;
        super.onPause();
        1hK activity = getActivity();
        if (activity != null && (kfr = this.LIZ) != null) {
            n.LIZ(activity, "");
            kfr.LIZJ(activity);
        }
    }

    public final void onResume() {
        KFR kfr;
        super.onResume();
        1hK activity = getActivity();
        if (activity != null && (kfr = this.LIZ) != null) {
            n.LIZ(activity, "");
            kfr.LIZIZ(activity);
        }
    }

    public final void onStart() {
        KFR kfr;
        BulletContainerFragment.super.onStart();
        1hK activity = getActivity();
        if (activity != null && (kfr = this.LIZ) != null) {
            n.LIZ(activity, "");
            kfr.LJ(activity);
        }
    }

    public final void onStop() {
        KFR kfr;
        super.onStop();
        1hK activity = getActivity();
        if (activity != null && (kfr = this.LIZ) != null) {
            n.LIZ(activity, "");
            kfr.LJFF(activity);
        }
    }

    public final void LIZ() {
        if (this.LJ != null) {
            C1599KfG kfG = this.LJ;
            if (kfG == null) {
                n.LIZ("");
            }
            kfG.LIZ();
        }
    }

    public final void onCreate(Bundle bundle) {
        super.onCreate(bundle);
    }

    public final void LIZ(KQA kqa) {
        M12.LIZ((Object) kqa);
        this.LIZJ = kqa;
    }

    public final void onEvent(KLZ klz) {
        M12.LIZ((Object) klz);
        C1599KfG kfG = this.LJ;
        if (kfG == null) {
            n.LIZ("");
        }
        kfG.onEvent(klz);
    }

    public final <T extends KSD<?, ?, ?, ?>> C0984KOx LIZ(Class<? extends T> cls) {
        M12.LIZ((Object) cls);
        C1599KfG kfG = this.LJ;
        if (kfG == null) {
            n.LIZ("");
        }
        return kfG.LIZ(cls);
    }

    public final void onActivityCreated(Bundle bundle) {
        KFR kfr;
        BulletContainerFragment.super.onActivityCreated(bundle);
        Uri uri = this.LJIIIZ;
        if (uri != null) {
            LIZ(uri, this.LJIIJ, (C1603KfK) this);
        }
        1hK activity = getActivity();
        if (activity != null && (kfr = this.LIZ) != null) {
            n.LIZ(activity, "");
            kfr.LIZ((Activity) activity, bundle);
        }
    }

    public final void onConfigurationChanged(Configuration configuration) {
        KFR kfr;
        BulletContainerFragment.super.onConfigurationChanged(configuration);
        1hK activity = getActivity();
        if (activity != null && (kfr = this.LIZ) != null) {
            n.LIZ(activity, "");
            kfr.LIZ((Activity) activity, configuration);
        }
    }

    public final C0984KOx LIZ(String str) {
        M12.LIZ((Object) str);
        C1599KfG kfG = this.LJ;
        if (kfG == null) {
            n.LIZ("");
        }
        return kfG.LIZ(str);
    }

    public final void LIZ(Uri uri) {
        M12.LIZ((Object) uri);
        C1421KcO.LIZ(this, "fragment onLoadStart", (C1424KcR) null, (String) null, 6);
        C1903KkA kkA = this.LIZIZ;
        if (kkA != null) {
            kkA.LIZ(uri);
        }
    }

    public final void printReject(Throwable th, String str) {
        M12.LIZ((Object) th, (Object) str);
        C1421KcO.LIZ(this, th, str);
    }

    public final void LIZ(Uri uri, Throwable th) {
        M12.LIZ((Object) uri, (Object) th);
        C1421KcO.LIZ(this, "fragment onLoadFail", (C1424KcR) null, (String) null, 6);
        C1903KkA kkA = this.LIZIZ;
        if (kkA != null) {
            kkA.LIZ(uri, th);
        }
    }

    public final void printLog(String str, C1424KcR kcR, String str2) {
        M12.LIZ(str, kcR, str2);
        C1421KcO.LIZ(this, str, kcR, str2);
    }

    public final <T extends C1157KVo> T LIZ(Uri uri, Bundle bundle, T t) {
        M12.LIZ((Object) t);
        C1896Kk3.LIZ.LIZ(uri, bundle, t);
        C1903KkA kkA = this.LIZIZ;
        if (kkA != null) {
            kkA.LIZ((C1157KVo) t);
        }
        return t;
    }

    public final void onActivityResult(int i, int i2, Intent intent) {
        KFR kfr;
        1hK activity = getActivity();
        if (activity != null && (kfr = this.LIZ) != null) {
            n.LIZ(activity, "");
            kfr.LIZ((Activity) activity, i, i2, intent);
        }
    }

    public final void onRequestPermissionsResult(int i, String[] strArr, int[] iArr) {
        KFR kfr;
        M12.LIZ((Object) strArr, (Object) iArr);
        BulletContainerFragment.super.onRequestPermissionsResult(i, strArr, iArr);
        1hK activity = getActivity();
        if (activity != null && (kfr = this.LIZ) != null) {
            n.LIZ(activity, "");
            kfr.LIZ((Activity) activity, i, strArr, iArr);
        }
    }

    public final View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
        MethodCollector.i(6829);
        M12.LIZ((Object) layoutInflater);
        1hK activity = getActivity();
        if (activity != null) {
            if (this.LIZ == null) {
                n.LIZ(activity, "");
                this.LIZ = new BulletActivityWrapper(activity);
            }
            C1903KkA kkA = this.LIZIZ;
            if (kkA != null) {
                n.LIZ(activity, "");
                ViewGroup LIZ2 = kkA.LIZ((Context) activity);
                n.LIZ(activity, "");
                this.LJ = new C1599KfG(activity, (AttributeSet) null, 6, (byte) 0);
                ViewGroup LIZ3 = kkA.LIZ();
                C1599KfG kfG = this.LJ;
                if (kfG == null) {
                    n.LIZ("");
                }
                LIZ3.addView(kfG);
                KFR kfr = this.LIZ;
                if (kfr != null) {
                    kfr.LIZ(kkA.LIZIZ());
                }
                LIZJ();
                MethodCollector.o(6829);
                return LIZ2;
            }
        }
        View LIZ4 = 0HH.LIZ(layoutInflater, 2131558936, viewGroup, false);
        C1599KfG kfG2 = (C1599KfG) LIZ4.findViewById(2131363071);
        n.LIZ(kfG2, "");
        this.LJ = kfG2;
        LIZJ();
        MethodCollector.o(6829);
        return LIZ4;
    }

    public final void LIZ(C0984KOx kOx, Uri uri, C1157KVo kVo) {
        M12.LIZ(kOx, uri, kVo);
        C1421KcO.LIZ(this, "fragment onLoadParamsSuccess", (C1424KcR) null, (String) null, 6);
        C1903KkA kkA = this.LIZIZ;
        if (kkA != null) {
            kkA.LIZ(kOx, uri, kVo);
        }
    }

    public final void LIZ(Uri uri, Bundle bundle, C1603KfK kfK) {
        KFR kfr;
        M12.LIZ((Object) uri);
        KQA kqa = this.LIZJ;
        if (kqa != null && (kfr = this.LIZ) != null) {
            C1599KfG kfG = this.LJ;
            if (kfG == null) {
                n.LIZ("");
            }
            C1903KkA kkA = this.LIZIZ;
            if (kkA != null) {
                kfG.getProviderFactory().LIZ(C1903KkA.class, kkA);
            }
            kfG.LIZ(kqa);
            kfG.setActivityWrapper(kfr);
            C1903KkA kkA2 = this.LIZIZ;
            if (kkA2 != null) {
                Context context = kfG.getContext();
                n.LIZ(context, "");
                kkA2.LIZIZ(context);
            }
            kfG.LIZ(uri, bundle, (KT7) null, kfK);
        }
    }
}
