package com.bytedance.android.livesdk.impl.revenue.subscription.ui;

import X.0AA;
import X.0AP;
import X.0HH;
import X.0cm;
import X.1hK;
import X.3Tp;
import X.BRR;
import X.C1430G2l;
import X.C1887GKa;
import X.C5629HmY;
import X.C5633Hmc;
import X.K4r;
import X.M12;
import android.content.Context;
import android.net.Uri;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.bytedance.android.live.actionhandler.IActionHandlerService;
import com.bytedance.android.livesdk.LiveDialogFragment;
import com.bytedance.android.livesdk.api.revenue.subscription.ISubscribeService;
import com.bytedance.android.livesdk.livesetting.watchlive.LiveSubscribeLynxUrl;
import com.bytedance.android.livesdk.ui.BaseFragment;
import com.bytedance.android.livesdkapi.host.IHostSubscription;
import com.bytedance.covode.number.Covode;
import java.util.HashMap;
import java.util.List;
import kotlin.h.b.n;

public final class SubscribeInfoListFragment extends BaseFragment implements C5633Hmc {
    public static final C1887GKa LIZ = new C1887GKa((byte) 0);
    public String LIZIZ = "";
    public HashMap LIZJ;

    static {
        Covode.recordClassIndex(16907);
    }

    public final void onDestroy() {
        C5629HmY.LIZIZ("open_native_subscription_settings", (C5633Hmc) this);
        super.onDestroy();
    }

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

    public final void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        Bundle arguments = getArguments();
        if (arguments != null) {
            String string = arguments.getString("enter_from");
            if (string == null) {
                n.LIZIZ();
            }
            this.LIZIZ = string;
        }
    }

    public final void LIZ(BRR brr) {
        List<LiveDialogFragment> LJFF;
        0AA fragmentManager;
        M12.LIZ(brr);
        String str = brr.LIZ;
        if (str.hashCode() == -1710760782 && str.equals("open_native_subscription_settings")) {
            IHostSubscription LIZ2 = 0cm.LIZ(IHostSubscription.class);
            K4r k4r = brr.LIZIZ;
            String str2 = null;
            if (k4r != null) {
                str2 = k4r.LJFF("type");
            }
            if (str2 != null) {
                int hashCode = str2.hashCode();
                if (hashCode != 106852524) {
                    if (hashCode == 110066619 && str2.equals("fullscreen")) {
                        1hK activity = getActivity();
                        if (activity != null && LIZ2 != null) {
                            n.LIZIZ(activity, "");
                            Context baseContext = activity.getBaseContext();
                            n.LIZIZ(baseContext, "");
                            LIZ2.LIZ(baseContext);
                            return;
                        }
                        return;
                    }
                } else if (str2.equals("popup")) {
                    boolean z = false;
                    LiveDialogFragment previewSubscriptionSettingDialog = 0cm.LIZ(ISubscribeService.class).getPreviewSubscriptionSettingDialog(0, "live_take_page");
                    0AA fragmentManager2 = getFragmentManager();
                    if (!(fragmentManager2 == null || (LJFF = fragmentManager2.LJFF()) == null)) {
                        for (LiveDialogFragment liveDialogFragment : LJFF) {
                            if (liveDialogFragment instanceof PreviewSubscriptionSettingDialog) {
                                if (!liveDialogFragment.LJIIJ() && (fragmentManager = getFragmentManager()) != null) {
                                    0AP LIZ3 = fragmentManager.LIZ();
                                    LIZ3.LIZJ(liveDialogFragment);
                                    LIZ3.LIZJ();
                                }
                            } else if (!(liveDialogFragment instanceof SubscriptionSettingFragment)) {
                            }
                            z = true;
                        }
                        if (z) {
                            return;
                        }
                    }
                    0AA fragmentManager3 = getFragmentManager();
                    if (fragmentManager3 != null && previewSubscriptionSettingDialog != null) {
                        n.LIZIZ(fragmentManager3, "");
                        C1430G2l.LIZ(previewSubscriptionSettingDialog, fragmentManager3, "");
                        return;
                    }
                    return;
                }
            }
            1hK activity2 = getActivity();
            if (activity2 != null && LIZ2 != null) {
                n.LIZIZ(activity2, "");
                Context baseContext2 = activity2.getBaseContext();
                n.LIZIZ(baseContext2, "");
                LIZ2.LIZ(baseContext2);
            }
        }
    }

    public final void onViewCreated(View view, Bundle bundle) {
        M12.LIZ(view);
        super.onViewCreated(view, bundle);
        C5629HmY.LIZ("open_native_subscription_settings", (C5633Hmc) this);
        3Tp r2 = new 3Tp(LiveSubscribeLynxUrl.INSTANCE.getValue().getUser_subscribe_list());
        r2.LIZ("show_entrance", this.LIZIZ);
        Uri parse = Uri.parse(r2.LIZ());
        n.LIZIZ(parse, "");
        0cm.LIZ(IActionHandlerService.class).handle(getContext(), parse);
    }

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