LINE.apk(点击下载) / PlayerFragment.java


package com.linecorp.inlinelive.ui.player;

import a42.c;
import android.animation.ValueAnimator;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.graphics.SurfaceTexture;
import android.media.AudioManager;
import android.net.ConnectivityManager;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.SystemClock;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.FrameLayout;
import androidx.appcompat.widget.AppCompatImageButton;
import androidx.fragment.app.FragmentManager;
import b32.u;
import bq.c0;
import bq.d0;
import bq.g0;
import bq.k0;
import bq.l0;
import bq.o0;
import bq.p0;
import bq.q0;
import bq.r0;
import bq.t;
import bq.v;
import com.linecorp.inlinelive.ui.player.dialog.ReportReasonSelectDialogFragment;
import com.linecorp.inlinelive.ui.player.dialog.profile.ChannelProfileDialogFragment;
import com.linecorp.inlinelive.ui.player.dialog.profile.ViewerProfileDialogFragment;
import com.linecorp.linelive.apiclient.api.CommerceApi;
import com.linecorp.linelive.apiclient.api.inline.InLineAuthenticationApi;
import com.linecorp.linelive.apiclient.api.inline.InLineBillingApi;
import com.linecorp.linelive.apiclient.api.inline.InLineBurstApi;
import com.linecorp.linelive.apiclient.api.inline.InLineChannelApi;
import com.linecorp.linelive.apiclient.model.Badge;
import com.linecorp.linelive.apiclient.model.BirthdayBadge;
import com.linecorp.linelive.apiclient.model.BlocklistAddingPayload;
import com.linecorp.linelive.apiclient.model.BroadcastDetailResponse;
import com.linecorp.linelive.apiclient.model.BroadcastLiveStatusResponse;
import com.linecorp.linelive.apiclient.model.BroadcastPromptlyStatsResponse;
import com.linecorp.linelive.apiclient.model.BroadcastResponse;
import com.linecorp.linelive.apiclient.model.BroadcastStatusResponse;
import com.linecorp.linelive.apiclient.model.ChallengeGaugeBadge;
import com.linecorp.linelive.apiclient.model.ChannelDetailResponse;
import com.linecorp.linelive.apiclient.model.ChatPatterns;
import com.linecorp.linelive.apiclient.model.CommerceSetting;
import com.linecorp.linelive.apiclient.model.inline.ChatCommerce;
import com.linecorp.linelive.apiclient.model.inline.GiftSettingResponse;
import com.linecorp.linelive.apiclient.model.inline.LinkIconData;
import com.linecorp.linelive.chat.model.data.User;
import com.linecorp.linelive.player.component.BasePlayerFragment;
import com.linecorp.linelive.player.component.chat.BaseChatFragment;
import com.linecorp.linelive.player.component.chat.LiveChatFragment;
import com.linecorp.linelive.player.component.util.AlertDialogFragment;
import com.linecorp.videoplayer.widget.VideoTextureView;
import dm3.p;
import em3.q;
import em3.s;
import g32.c;
import g42.x;
import g42.y;
import h32.a;
import hq.d;
import hq.i;
import java.io.Serializable;
import java.lang.ref.WeakReference;
import java.util.List;
import java.util.Objects;
import jp.naver.line.android.R;
import kotlin.Lazy;
import kotlin.LazyKt;
import kotlin.Metadata;
import kotlin.Unit;
import nx2.w;
import op.e0;
import op.h0;
import op.m0;
import s32.b;
import sm3.r;
import u22.i0;
import yv2.z;
import zw2.a0;
import zw2.f0;

@Metadata(bv = {}, d1 = {"\u0000\u001c\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\u0018\u00002\u00020\u00012\u00020\u00022\u00020\u00032\u00020\u00042\u00020\u0005B\u0007¢\u0006\u0004\b\u0006\u0010\u0007¨\u0006\b"}, d2 = {"Lcom/linecorp/inlinelive/ui/player/PlayerFragment;", "Lcom/linecorp/linelive/player/component/BasePlayerFragment;", "Lcom/linecorp/inlinelive/ui/player/dialog/profile/ViewerProfileDialogFragment$a;", "Lcom/linecorp/inlinelive/ui/player/dialog/profile/ChannelProfileDialogFragment$b;", "Lhq/d$b;", "Ll42/e$b;", "<init>", "()V", "inlinelive_productionRelease"}, k = 1, mv = {1, 6, 0})
public final class PlayerFragment extends BasePlayerFragment implements ViewerProfileDialogFragment.a, ChannelProfileDialogFragment.b, d.b {

    /* renamed from: x  reason: collision with root package name */
    public static final /* synthetic */ int f32890x = 0;

    /* renamed from: b  reason: collision with root package name */
    public final Lazy f32891b = LazyKt.lazy(new o(this));

    /* renamed from: c  reason: collision with root package name */
    public lp.a f32892c;

    /* renamed from: d  reason: collision with root package name */
    public hq.d f32893d;

    /* renamed from: e  reason: collision with root package name */
    public h0 f32894e;

    /* renamed from: f  reason: collision with root package name */
    public vp.b f32895f;

    /* renamed from: g  reason: collision with root package name */
    public InLineChannelApi f32896g;

    /* renamed from: h  reason: collision with root package name */
    public InLineAuthenticationApi f32897h;

    /* renamed from: i  reason: collision with root package name */
    public iq.f f32898i;

    /* renamed from: j  reason: collision with root package name */
    public ChannelDetailResponse f32899j;

    /* renamed from: k  reason: collision with root package name */
    public hq.i f32900k;

    /* renamed from: l  reason: collision with root package name */
    public String f32901l;

    /* renamed from: m  reason: collision with root package name */
    public final r32.j f32902m = new r32.j();

    /* renamed from: n  reason: collision with root package name */
    public final Lazy f32903n = LazyKt.lazy(new d(this));

    /* renamed from: o  reason: collision with root package name */
    public final Lazy f32904o = LazyKt.lazy(c.f32914b);

    /* renamed from: p  reason: collision with root package name */
    public h32.d f32905p;

    /* renamed from: q  reason: collision with root package name */
    public h32.a f32906q;

    /* renamed from: r  reason: collision with root package name */
    public ValueAnimator f32907r;

    /* renamed from: s  reason: collision with root package name */
    public View f32908s;

    /* renamed from: t  reason: collision with root package name */
    public int f32909t;

    /* renamed from: u  reason: collision with root package name */
    public final r32.j f32910u = new r32.j();

    /* renamed from: v  reason: collision with root package name */
    public final n f32911v = new n(this);

    /* renamed from: w  reason: collision with root package name */
    public final g f32912w = new g(this);

    public /* synthetic */ class a {
        public static final /* synthetic */ int[] $EnumSwitchMapping$0;

        static {
            int[] iArr = new int[d.a.values().length];
            iArr[d.a.LOVE.ordinal()] = 1;
            iArr[d.a.COMMENT.ordinal()] = 2;
            iArr[d.a.REPLY.ordinal()] = 3;
            iArr[d.a.SHARE.ordinal()] = 4;
            iArr[d.a.GIFT.ordinal()] = 5;
            $EnumSwitchMapping$0 = iArr;
        }
    }

    public static final class b extends s implements p<Long, Long, BroadcastLiveStatusResponse> {

        /* renamed from: b  reason: collision with root package name */
        public final /* synthetic */ PlayerFragment f32913b;

        /* JADX INFO: super call moved to the top of the method (can break code semantics) */
        public b(PlayerFragment playerFragment) {
            super(2);
            this.f32913b = playerFragment;
        }

        /* Return type fixed from 'java.lang.Object' to match base method */
        /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object, java.lang.Object] */
        @Override // dm3.p
        public BroadcastLiveStatusResponse invoke(Long l14, Long l15) {
            BroadcastLiveStatusResponse i14 = ((InLineBurstApi) this.f32913b.n6().c(InLineBurstApi.class)).getLiveStatus(l14.longValue(), l15.longValue()).i();
            q.e(i14, "contextManager.getApi(In…roadcastId).blockingGet()");
            return i14;
        }
    }

    public static final class c extends s implements dm3.a<AccelerateDecelerateInterpolator> {

        /* renamed from: b  reason: collision with root package name */
        public static final c f32914b = new c();

        public c() {
            super(0);
        }

        /* Return type fixed from 'java.lang.Object' to match base method */
        @Override // dm3.a
        public AccelerateDecelerateInterpolator invoke() {
            return new AccelerateDecelerateInterpolator();
        }
    }

    public static final class d extends s implements dm3.a<h32.b> {

        /* renamed from: b  reason: collision with root package name */
        public final /* synthetic */ PlayerFragment f32915b;

        /* JADX INFO: super call moved to the top of the method (can break code semantics) */
        public d(PlayerFragment playerFragment) {
            super(0);
            this.f32915b = playerFragment;
        }

        /* Return type fixed from 'java.lang.Object' to match base method */
        @Override // dm3.a
        public h32.b invoke() {
            View view = this.f32915b.f32908s;
            if (view != null) {
                return new h32.b(view);
            }
            q.l("commerceProductView");
            throw null;
        }
    }

    public static final class e extends s implements dm3.a<a0<ChannelDetailResponse>> {

        /* renamed from: b  reason: collision with root package name */
        public final /* synthetic */ PlayerFragment f32916b;

        /* renamed from: c  reason: collision with root package name */
        public final /* synthetic */ long f32917c;

        /* JADX INFO: super call moved to the top of the method (can break code semantics) */
        public e(PlayerFragment playerFragment, long j14) {
            super(0);
            this.f32916b = playerFragment;
            this.f32917c = j14;
        }

        /* Return type fixed from 'java.lang.Object' to match base method */
        @Override // dm3.a
        public a0<ChannelDetailResponse> invoke() {
            return this.f32916b.k6().getChannel(this.f32917c);
        }
    }

    public static final class f extends s implements dm3.a<Boolean> {

        /* renamed from: b  reason: collision with root package name */
        public final /* synthetic */ PlayerFragment f32918b;

        /* JADX INFO: super call moved to the top of the method (can break code semantics) */
        public f(PlayerFragment playerFragment) {
            super(0);
            this.f32918b = playerFragment;
        }

        /* Return type fixed from 'java.lang.Object' to match base method */
        @Override // dm3.a
        public Boolean invoke() {
            return Boolean.valueOf(this.f32918b.isAdFinished() && this.f32918b.isPlayingLiveStreaming() && !this.f32918b.getBroadcast().getBroadcastResponse().getChannel().isOfficialAccount());
        }
    }

    public static final class g implements i.a {

        /* renamed from: a  reason: collision with root package name */
        public final /* synthetic */ PlayerFragment f32919a;

        public g(PlayerFragment playerFragment) {
            this.f32919a = playerFragment;
        }

        @Override // hq.i.a
        public void a(int i14) {
            x.show$default(this.f32919a.getToastUtils(), i14, 0, false, 6, (Object) null);
        }

        @Override // hq.i.a
        public void b(i.b bVar) {
            boolean z14 = bVar == i.b.SUBSCRIBE;
            ChannelDetailResponse channelDetailResponse = this.f32919a.f32899j;
            if (channelDetailResponse != null) {
                channelDetailResponse.setNotificationEnabled(z14);
            }
        }

        @Override // hq.i.a
        public void c(op.e eVar) {
            ((bq.c) this.f32919a.getPlayerDialogHelper()).a(this.f32919a, eVar);
        }

        @Override // hq.i.a
        public void c0(boolean z14) {
        }

        @Override // hq.i.a
        public void d() {
            PlayerFragment playerFragment = this.f32919a;
            int i14 = PlayerFragment.f32890x;
            playerFragment.getBinding().playerHeader.btnFollow.setVisibility(0);
        }

        @Override // hq.i.a
        public void e() {
            PlayerFragment playerFragment = this.f32919a;
            int i14 = PlayerFragment.f32890x;
            playerFragment.getBinding().playerHeader.btnFollow.setVisibility(8);
        }

        @Override // hq.i.a
        public void f(int i14) {
            c.a.show$default(a42.c.Companion, this.f32919a.requireContext(), i14, null, 4, null);
        }

        @Override // hq.i.a
        public Context getContext() {
            Context requireContext = this.f32919a.requireContext();
            q.e(requireContext, "this@PlayerFragment.requireContext()");
            return requireContext;
        }
    }

    public static final class h implements e0<m0> {

        /* renamed from: a  reason: collision with root package name */
        public final /* synthetic */ PlayerFragment f32920a;

        public /* synthetic */ class a {
            public static final /* synthetic */ int[] $EnumSwitchMapping$0;

            static {
                int[] iArr = new int[m0.values().length];
                iArr[m0.SHARE_TO_CHAT.ordinal()] = 1;
                iArr[m0.SHARE_TO_TIMELINE.ordinal()] = 2;
                iArr[m0.SHARE_TO_APP.ordinal()] = 3;
                iArr[m0.COPY_TO_CLIPBOARD.ordinal()] = 4;
                $EnumSwitchMapping$0 = iArr;
            }
        }

        public h(PlayerFragment playerFragment) {
            this.f32920a = playerFragment;
        }

        @Override // op.e0
        public void a(op.l lVar) {
            q.f(lVar, "e");
            pq3.a.c(lVar);
        }

        /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
        @Override // op.e0
        public void onSuccess(m0 m0Var) {
            m0 m0Var2 = m0Var;
            q.f(m0Var2, "value");
            int i14 = a.$EnumSwitchMapping$0[m0Var2.ordinal()];
            if (i14 == 1 || i14 == 2 || i14 == 3) {
                PlayerFragment playerFragment = this.f32920a;
                int i15 = PlayerFragment.f32890x;
                LiveChatFragment t64 = playerFragment.t6();
                if (t64 != null) {
                    t64.sendShareEvent(null);
                }
            } else if (i14 == 4) {
                c.a.show$default(a42.c.Companion, this.f32920a.requireContext(), R.string.recording_share_urlcopy_toast, null, 4, null);
            }
        }
    }

    public static final class i extends np.b<BroadcastStatusResponse> {

        /* renamed from: f  reason: collision with root package name */
        public final /* synthetic */ PlayerFragment f32921f;

        /* JADX INFO: super call moved to the top of the method (can break code semantics) */
        public i(PlayerFragment playerFragment) {
            super(playerFragment);
            this.f32921f = playerFragment;
        }

        @Override // np.a
        public boolean a(l22.o oVar) {
            this.f32921f.getPlayerDialogHelper().showNetworkErrorDialog(this.f32921f);
            return true;
        }

        @Override // np.a
        public boolean b(l22.p pVar) {
            x.show$default(this.f32921f.getToastUtils(), (int) R.string.player_error_no_broadcast, 0, false, 6, (Object) null);
            PlayerFragment playerFragment = this.f32921f;
            int i14 = PlayerFragment.f32890x;
            playerFragment.closePlayerDelayed(300);
            return true;
        }

        @Override // np.a
        public void e(Throwable th4) {
            q.f(th4, "e");
            pq3.a.f128905c.k("Failed to load BroadcastDetailResponse. %s", th4.getMessage());
            int i14 = PlayerFragment.f32890x;
            this.f32921f.handleErrorAndClosePlayer("Failed to load BroadcastDetailResponse. " + th4.getMessage());
        }

        /* JADX DEBUG: Method arguments types fixed to match base method, original types: [com.linecorp.linelive.apiclient.model.ApiResponseInterface] */
        @Override // np.b
        public void g(BroadcastStatusResponse broadcastStatusResponse) {
            BroadcastStatusResponse broadcastStatusResponse2 = broadcastStatusResponse;
            q.f(broadcastStatusResponse2, "response");
            PlayerFragment playerFragment = this.f32921f;
            int i14 = PlayerFragment.f32890x;
            playerFragment.updateBroadcastWithBroadcastStatus(broadcastStatusResponse2);
            this.f32921f.preparePlayer();
        }
    }

    public /* synthetic */ class j extends em3.n implements dm3.l<m32.e, Unit> {
        public j(Object obj) {
            super(1, obj, n.class, "onReloadPlayerEvent", "onReloadPlayerEvent(Lcom/linecorp/linelive/player/component/model/event/ReloadPlayerEvent;)V", 0);
        }

        /* Return type fixed from 'java.lang.Object' to match base method */
        /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
        @Override // dm3.l
        public Unit invoke(m32.e eVar) {
            q.f(eVar, "p0");
            n nVar = (n) this.receiver;
            Objects.requireNonNull(nVar);
            nVar.f32922a.preparePlayerWithBroadcastStatus();
            return Unit.INSTANCE;
        }
    }

    public /* synthetic */ class k extends em3.n implements dm3.l<m32.b, Unit> {
        public k(Object obj) {
            super(1, obj, n.class, "onChatBackgroundClickEvent", "onChatBackgroundClickEvent(Lcom/linecorp/linelive/player/component/model/event/ChatBackgroundClickEvent;)V", 0);
        }

        /* Return type fixed from 'java.lang.Object' to match base method */
        /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
        @Override // dm3.l
        public Unit invoke(m32.b bVar) {
            q.f(bVar, "p0");
            n nVar = (n) this.receiver;
            Objects.requireNonNull(nVar);
            PlayerFragment playerFragment = nVar.f32922a;
            int i14 = PlayerFragment.f32890x;
            if (playerFragment.getScreenState().isFullScreen()) {
                nVar.f32922a.getControllerVisibilityHelper().toggle();
            }
            return Unit.INSTANCE;
        }
    }

    public /* synthetic */ class l extends em3.n implements dm3.l<yp.b, Unit> {
        public l(Object obj) {
            super(1, obj, n.class, "onNotificationSubscription", "onNotificationSubscription(Lcom/linecorp/inlinelive/model/event/NotificationSubscriptionEvent;)V", 0);
        }

        /* Return type fixed from 'java.lang.Object' to match base method */
        /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
        @Override // dm3.l
        public Unit invoke(yp.b bVar) {
            yp.b bVar2 = bVar;
            q.f(bVar2, "p0");
            n nVar = (n) this.receiver;
            Objects.requireNonNull(nVar);
            PlayerFragment playerFragment = nVar.f32922a;
            int i14 = PlayerFragment.f32890x;
            if (playerFragment.u6().isValid()) {
                nVar.f32922a.getBinding().playerHeader.btnFollow.setVisibility(bVar2.f195570b ? 8 : 0);
            }
            return Unit.INSTANCE;
        }
    }

    public /* synthetic */ class m extends em3.n implements dm3.l<yp.a, Unit> {
        public m(Object obj) {
            super(1, obj, n.class, "onAudioMuteChanged", "onAudioMuteChanged(Lcom/linecorp/inlinelive/model/event/AudioMuteChangedEvent;)V", 0);
        }

        /* Return type fixed from 'java.lang.Object' to match base method */
        /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
        @Override // dm3.l
        public Unit invoke(yp.a aVar) {
            yp.a aVar2 = aVar;
            q.f(aVar2, "p0");
            n nVar = (n) this.receiver;
            Objects.requireNonNull(nVar);
            PlayerFragment playerFragment = nVar.f32922a;
            int i14 = PlayerFragment.f32890x;
            if (playerFragment.u6().isValid()) {
                nVar.f32922a.getBinding().bottomContainer.btnSound.setChecked(aVar2.f195568a);
                nVar.f32922a.getBinding().btnAdSound.setChecked(aVar2.f195568a);
            }
            return Unit.INSTANCE;
        }
    }

    public static final class n {

        /* renamed from: a  reason: collision with root package name */
        public final /* synthetic */ PlayerFragment f32922a;

        public n(PlayerFragment playerFragment) {
            this.f32922a = playerFragment;
        }
    }

    public static final class o extends s implements dm3.a<k42.d<?>> {

        /* renamed from: b  reason: collision with root package name */
        public final /* synthetic */ PlayerFragment f32923b;

        /* JADX INFO: super call moved to the top of the method (can break code semantics) */
        public o(PlayerFragment playerFragment) {
            super(0);
            this.f32923b = playerFragment;
        }

        /* Return type fixed from 'java.lang.Object' to match base method */
        @Override // dm3.a
        public k42.d<?> invoke() {
            return k42.e.createInstance(this.f32923b);
        }
    }

    public static void h6(PlayerFragment playerFragment, String str) {
        q.f(playerFragment, "this$0");
        super.startPromptlyStatsUpdater();
    }

    @Override // com.linecorp.linelive.player.component.BasePlayerFragment
    public void adjustChatLayout(i0 i0Var, boolean z14, int i14) {
        ValueAnimator valueAnimator;
        q.f(i0Var, "screenState");
        ValueAnimator valueAnimator2 = this.f32907r;
        boolean z15 = true;
        if (valueAnimator2 == null || !valueAnimator2.isRunning()) {
            z15 = false;
        }
        if (z15 && (valueAnimator = this.f32907r) != null) {
            valueAnimator.cancel();
        }
        super.adjustChatLayout(i0Var, z14, i14);
    }

    @Override // com.linecorp.linelive.player.component.BasePlayerFragment
    public void adjustPlayerViewLayout(i0 i0Var) {
        q.f(i0Var, "screenState");
        super.adjustPlayerViewLayout(i0Var);
        if (g42.n.isInMultiWindow(this)) {
            ViewGroup.LayoutParams layoutParams = getBinding().playerView.getLayoutParams();
            Objects.requireNonNull(layoutParams, "null cannot be cast to non-null type android.widget.FrameLayout.LayoutParams");
            FrameLayout.LayoutParams layoutParams2 = (FrameLayout.LayoutParams) layoutParams;
            layoutParams2.gravity = 1;
            getBinding().playerView.setLayoutParams(layoutParams2);
        }
    }

    @Override // com.linecorp.inlinelive.ui.player.dialog.profile.ViewerProfileDialogFragment.a
    public void b2(BlocklistAddingPayload blocklistAddingPayload) {
        v22.e blockListManager;
        q.f(blocklistAddingPayload, "payload");
        BaseChatFragment chatFragment = getChatFragment();
        if (chatFragment != null && (blockListManager = chatFragment.getBlockListManager()) != null) {
            blockListManager.addBlockedUser(blocklistAddingPayload);
        }
    }

    @Override // com.linecorp.linelive.player.component.BasePlayerFragment
    public void bindViewsWithBroadcast(BroadcastDetailResponse broadcastDetailResponse) {
        a0<GiftSettingResponse> a0Var;
        q.f(broadcastDetailResponse, BasePlayerFragment.KEY_BROADCAST);
        super.bindViewsWithBroadcast(broadcastDetailResponse);
        LinkIconData linkIcon = broadcastDetailResponse.getLinkIcon();
        if (linkIcon != null && linkIcon.getEnabled()) {
            h32.d dVar = this.f32905p;
            if (dVar == null) {
                AppCompatImageButton appCompatImageButton = getBinding().bottomContainer.btnLiveCommerce;
                q.e(appCompatImageButton, "binding.bottomContainer.btnLiveCommerce");
                h32.e liveCommercePlayerPlaybackManager = getLiveCommercePlayerPlaybackManager();
                Context requireContext = requireContext();
                q.e(requireContext, "requireContext()");
                dVar = new h32.d(appCompatImageButton, liveCommercePlayerPlaybackManager, new iq.i(requireContext, n6().f107781b));
            }
            this.f32905p = dVar;
            dVar.updateButton(linkIcon);
        }
        ChatCommerce chatCommerce = broadcastDetailResponse.getChatCommerce();
        CommerceSetting commerceSetting = null;
        String id4 = chatCommerce != null ? chatCommerce.getId() : null;
        boolean z14 = true;
        if (!(id4 == null || r.u(id4))) {
            h32.a aVar = this.f32906q;
            if (aVar == null) {
                Bundle arguments = getArguments();
                String string = arguments != null ? arguments.getString("arg_chat_commerce_server_endpoint") : null;
                lp.a n64 = n6();
                k22.e eVar = n64.f107785f;
                if (eVar == null) {
                    if (string != null && !r.u(string)) {
                        z14 = false;
                    }
                    if (!z14) {
                        eVar = new k22.e(string);
                    } else {
                        String string2 = n64.f107780a.getString(n64.f107781b.j() == 2 ? R.string.tw_commerce_real_url : R.string.tw_commerce_beta_url);
                        q.e(string2, "context.getString(endpointResId)");
                        eVar = new k22.e(string2);
                    }
                }
                n64.f107785f = eVar;
                k22.g gVar = new k22.g((CommerceApi) eVar.f100343b.b(CommerceApi.class));
                String str = "Bearer " + n6().f107788i.f107801a;
                Bundle arguments2 = getArguments();
                Serializable serializable = arguments2 != null ? arguments2.getSerializable("arg_chat_commerce_developer_data") : null;
                if ((serializable instanceof op.b ? (op.b) serializable : null) != null) {
                    commerceSetting = new CommerceSetting(false, new ChatPatterns(null, null, false), 0);
                }
                aVar = new h32.a(id4, str, gVar, commerceSetting);
            }
            aVar.getCommerceProductLiveData().observe(this, new p0(this));
            aVar.startPollingCommerceData();
            this.f32906q = aVar;
        }
        String broadcastSecretToken = broadcastDetailResponse.getBroadcastResponse().getBroadcastSecretToken();
        if (broadcastSecretToken == null) {
            a0Var = k6().getBroadcastGiftSetting(broadcastDetailResponse.getBroadcastResponse().getChannelId(), broadcastDetailResponse.getBroadcastResponse().getId());
        } else {
            a0Var = k6().getSecretBroadcastGiftSetting(broadcastSecretToken);
        }
        c0 c0Var = c0.f14117b;
        Objects.requireNonNull(a0Var);
        ((z) ((yv2.g) yv2.h.a(this)).a(new w(a0Var, c0Var).E(zy2.a.f202073c).z(ax2.a.a()))).a(new v(this), new bq.x(this, broadcastDetailResponse));
    }

    @Override // com.linecorp.inlinelive.ui.player.dialog.profile.ChannelProfileDialogFragment.b
    public void c0(boolean z14) {
        bq.e eVar = (bq.e) getTrackingHelper();
        g32.c cVar = eVar.f14119a;
        c.a aVar = g32.c.Companion;
        cVar.sendClickPlayerCasterInfoToggleNotification(aVar.getTsParamLiveStatus(eVar.f14120b.isBroadcastingNow()), eVar.f14120b.getId(), eVar.f14120b.getChannelId(), aVar.getTsParamToggleStatus(z14, true));
    }

    @Override // com.linecorp.inlinelive.ui.player.dialog.profile.ChannelProfileDialogFragment.b
    public void c2() {
        if (u6().isValid()) {
            long channelId = getBroadcast().getBroadcastResponse().getChannelId();
            long id4 = getBroadcast().getBroadcastResponse().getId();
            Objects.requireNonNull((bq.c) getPlayerDialogHelper());
            ReportReasonSelectDialogFragment reportReasonSelectDialogFragment = new ReportReasonSelectDialogFragment();
            Bundle bundle = new Bundle();
            bundle.putLong("extra.channel_id", channelId);
            bundle.putLong("extra.broadcast_id", id4);
            reportReasonSelectDialogFragment.setArguments(bundle);
            reportReasonSelectDialogFragment.setTargetFragment(this, 701);
            FragmentManager parentFragmentManager = getParentFragmentManager();
            q.e(parentFragmentManager, "targetFragment.parentFragmentManager");
            androidx.fragment.app.a aVar = new androidx.fragment.app.a(parentFragmentManager);
            aVar.l(0, reportReasonSelectDialogFragment, null, 1);
            aVar.g();
        }
    }

    @Override // hq.d.b
    public void e1(d.a aVar) {
        q.f(aVar, "actionType");
        int i14 = a.$EnumSwitchMapping$0[aVar.ordinal()];
        if (i14 == 1) {
            getBinding().bottomContainer.btnLove.callOnClick();
        } else if (i14 == 2 || i14 == 3) {
            onClickCommentButton();
        } else if (i14 == 4) {
            onClickShareButton();
        } else if (i14 == 5) {
            onClickGiftButton();
        }
    }

    @Override // com.linecorp.inlinelive.ui.player.dialog.profile.ViewerProfileDialogFragment.a
    public void e4(String str) {
        q.f(str, "name");
        getTrackingHelper().sendClickPlayerViewerInfoTapReply(str);
        new Handler(Looper.getMainLooper()).postDelayed(new l0(this, str), 500);
    }

    @Override // com.linecorp.linelive.player.component.BasePlayerFragment
    public void finishBroadcast() {
        super.finishBroadcast();
        showFinishedBroadcastDialog();
    }

    @Override // com.linecorp.linelive.player.component.BasePlayerFragment
    public int getBottomExtraViewHeight() {
        if (!v6()) {
            return 0;
        }
        return m6().getVisibleViewHeight();
    }

    @Override // com.linecorp.linelive.player.component.BasePlayerFragment
    public p<Long, Long, BroadcastLiveStatusResponse> getBroadcastLiveStatusResponseGetter() {
        return new b(this);
    }

    @Override // com.linecorp.linelive.player.component.BasePlayerFragment
    public l32.a getDefaultVideoQuality() {
        return l32.a.AUTO;
    }

    @Override // com.linecorp.linelive.player.component.BasePlayerFragment
    public void handlePromptlyStatsUpdate(BroadcastPromptlyStatsResponse broadcastPromptlyStatsResponse) {
        q.f(broadcastPromptlyStatsResponse, "promptlyStats");
        super.handlePromptlyStatsUpdate(broadcastPromptlyStatsResponse);
        if (u6().isValid()) {
            List<Badge> badges = broadcastPromptlyStatsResponse.getBadges();
            if (!q.b("JP", this.f32901l) && badges != null) {
                badges = (List) new mx2.h0(badges).y(g0.f14130b).h0().i();
            }
            updateBadges(badges);
            updateChallengeGaugeHelper(badges);
        }
    }

    @Override // com.linecorp.linelive.player.component.BasePlayerFragment, f32.e.a
    public void hideController() {
        if (u6().isValid()) {
            if (v6() && getScreenState().isFullScreen()) {
                m6().hideView();
            }
            super.hideController();
        }
    }

    @Override // com.linecorp.linelive.player.component.BasePlayerFragment
    public void hideControllerForAd(boolean z14) {
        if (u6().isValid()) {
            if (z14) {
                g42.p.fadeOutView$default(getBinding().bottomContainer.getRoot(), 0, 2, null);
                g42.p.fadeOutView$default(getBinding().playerHeader.headerChannelInfoGroup, 0, 2, null);
                g42.p.fadeOutView$default(getBinding().playerHeader.headerButtonGroup, 0, 2, null);
                g42.p.fadeOutView$default(getBinding().playerHeader.badgeContainer, 0, 2, null);
                g42.p.fadeOutView$default(getBinding().playerHeader.challengeDescriptionTextView, 0, 2, null);
                g42.p.fadeOutView$default(getBinding().playerGradationGroup, 0, 2, null);
                g42.p.fadeOutView(getBinding().chatContent, 4);
                if (isPlayingLiveStreaming()) {
                    if (getScreenState().isFullScreen()) {
                        g42.p.fadeOutView$default(getBinding().bottomContainer.inputHint, 0, 2, null);
                        g42.p.fadeOutView$default(getBinding().bottomContainer.divider, 0, 2, null);
                    }
                    getBinding().playerControllerContainer.getRoot().setVisibility(8);
                } else {
                    g42.p.fadeOutView$default(getBinding().playerControllerContainer.getRoot(), 0, 2, null);
                }
            } else {
                getBinding().bottomContainer.getRoot().setVisibility(8);
                getBinding().playerHeader.headerChannelInfoGroup.setVisibility(8);
                getBinding().playerHeader.headerButtonGroup.setVisibility(8);
                showBadgeIfExist(false);
                getBinding().playerGradationGroup.setVisibility(8);
                getBinding().chatContent.setVisibility(4);
                getBinding().playerControllerContainer.getRoot().setVisibility(8);
                if (isPlayingLiveStreaming() && getScreenState().isFullScreen()) {
                    getBinding().bottomContainer.inputHint.setVisibility(8);
                    getBinding().bottomContainer.divider.setVisibility(8);
                }
            }
            hideInputViews();
        }
    }

    @Override // com.linecorp.linelive.player.component.BasePlayerFragment
    public void hideMuteButtonForAd() {
        g42.p.fadeOutView$default(getBinding().btnAdSound, 0, 2, null);
    }

    @Override // com.linecorp.linelive.player.component.BasePlayerFragment
    public void initAudioMuter(Bundle bundle) {
        Object systemService = requireContext().getSystemService("audio");
        Objects.requireNonNull(systemService, "null cannot be cast to non-null type android.media.AudioManager");
        setAudioMuter(new g42.d((AudioManager) systemService));
        if (bundle != null) {
            if (bundle.getBoolean("is_mute")) {
                getAudioMuter().mute();
            } else {
                getAudioMuter().unmute();
            }
        } else if (requireArguments().getBoolean("arg_is_mute", true)) {
            getAudioMuter().mute();
        } else {
            getAudioMuter().unmute();
        }
    }

    @Override // com.linecorp.linelive.player.component.BasePlayerFragment
    @SuppressLint({"ClickableViewAccessibility"})
    public void initViews() {
        super.initViews();
        getBinding().playerControllerContainer.seekbar.setOnSeekBarChangeListener(null);
        getBinding().playerControllerContainer.seekbar.setOnSeekBarChangeListener(getOnSeekBarChangeListener());
        getBinding().playerControllerContainer.seekbar.setOnTouchListener(new o0(this));
        if (getScreenState().getVideoAspectRatio() != null) {
            VideoTextureView videoTextureView = getBinding().playerView;
            Float videoAspectRatio = getScreenState().getVideoAspectRatio();
            q.d(videoAspectRatio);
            videoTextureView.setVideoWidthHeightRatio(videoAspectRatio.floatValue());
            x6(g42.n.isInMultiWindow(this));
        }
    }

    @Override // com.linecorp.linelive.player.component.BasePlayerFragment
    public void initWithBroadcast(BroadcastDetailResponse broadcastDetailResponse, Bundle bundle) {
        q.f(broadcastDetailResponse, BasePlayerFragment.KEY_BROADCAST);
        super.initWithBroadcast(broadcastDetailResponse, bundle);
        long channelId = broadcastDetailResponse.getBroadcastResponse().getChannelId();
        if (bundle == null) {
            getEventApiHelper().sendOpenEvent(l32.a.AUTO);
        } else {
            getEventApiHelper().restoreInstanceState(bundle);
        }
        e eVar = new e(this, channelId);
        Context requireContext = requireContext();
        q.e(requireContext, "requireContext()");
        setChannelProfileToast(new f32.d(eVar, requireContext, this, new f(this), getToastUtils()));
    }

    @Override // com.linecorp.linelive.player.component.BasePlayerFragment
    public void initializeGiftNavigator() {
        FragmentManager childFragmentManager = getChildFragmentManager();
        q.e(childFragmentManager, "childFragmentManager");
        sp.a aVar = new sp.a((InLineBillingApi) n6().c(InLineBillingApi.class), n6().f107783d);
        u uVar = n6().f107786g;
        x xVar = n6().f107782c;
        BroadcastDetailResponse broadcast = getBroadcast();
        op.k kVar = n6().f107781b;
        iq.f fVar = this.f32898i;
        if (fVar != null) {
            setGiftNavigator(new bq.b(R.id.gift_content, childFragmentManager, aVar, uVar, xVar, this, broadcast, kVar, fVar));
        } else {
            q.l("preferencesUtils");
            throw null;
        }
    }

    @Override // com.linecorp.linelive.player.component.BasePlayerFragment
    public void initializeTracking(long j14, long j15) {
        vp.b bVar = this.f32895f;
        if (bVar != null) {
            setTrackingHelper(new bq.e(bVar, getBroadcast().getBroadcastResponse(), null, 4));
            setEventApiHelper(new j32.b(new tp.c(k6(), j14, j15, getConnectivityHelper(), this), getPlayerController(), new k0(this)));
            return;
        }
        q.l("trackingUtils");
        throw null;
    }

    @Override // com.linecorp.linelive.player.component.BasePlayerFragment
    public boolean isActiveNetworkMetered() {
        return ((ConnectivityManager) requireActivity().getSystemService("connectivity")).isActiveNetworkMetered();
    }

    @Override // com.linecorp.linelive.player.component.BasePlayerFragment
    public boolean isAdFinished() {
        return !getPlayerController().isAdDisplaying() && getPlayerController().isFirstAdFinished();
    }

    @Override // com.linecorp.linelive.player.component.BasePlayerFragment
    public boolean isLinkIconEnabled() {
        LinkIconData linkIcon = getBroadcast().getLinkIcon();
        if (linkIcon != null) {
            return linkIcon.getEnabled();
        }
        return false;
    }

    @Override // com.linecorp.linelive.player.component.BasePlayerFragment
    public boolean isPipMode() {
        return false;
    }

    public final hq.d j6() {
        hq.d dVar = this.f32893d;
        if (dVar != null) {
            return dVar;
        }
        q.l("agreementRequiredActionHandler");
        throw null;
    }

    public final InLineChannelApi k6() {
        InLineChannelApi inLineChannelApi = this.f32896g;
        if (inLineChannelApi != null) {
            return inLineChannelApi;
        }
        q.l("channelApi");
        throw null;
    }

    public final h32.b m6() {
        return (h32.b) this.f32903n.getValue();
    }

    public final lp.a n6() {
        lp.a aVar = this.f32892c;
        if (aVar != null) {
            return aVar;
        }
        q.l("contextManager");
        throw null;
    }

    @Override // com.linecorp.linelive.player.component.BasePlayerFragment, com.linecorp.linelive.player.component.util.AlertDialogFragment.a
    public void onAlertDialogCancel(AlertDialogFragment alertDialogFragment, int i14) {
        q.f(alertDialogFragment, "dialogFragment");
    }

    @Override // com.linecorp.linelive.player.component.BasePlayerFragment, com.linecorp.linelive.player.component.util.AlertDialogFragment.a
    public void onAlertDialogClick(AlertDialogFragment alertDialogFragment, int i14, int i15, boolean z14, Intent intent) {
        q.f(alertDialogFragment, "dialogFragment");
        boolean z15 = true;
        if (i14 != 500) {
            if (i14 == 702) {
                hq.i iVar = this.f32900k;
                q.d(iVar);
                if (i15 != -1) {
                    z15 = false;
                }
                iVar.b(z15);
            }
        } else if (intent != null) {
            hq.d j64 = j6();
            if (i15 == -1) {
                j64.f82666d.f88666a.edit().putBoolean("key.has_agreement", true).apply();
                Serializable serializableExtra = intent.getSerializableExtra("extra.arg_trigger_action");
                Objects.requireNonNull(serializableExtra, "null cannot be cast to non-null type com.linecorp.inlinelive.ui.player.helper.AgreementRequiredActionHandler.ActionType");
                hq.f fVar = new hq.f(j64, (d.a) serializableExtra);
                hq.e eVar = hq.e.f82669b;
                Object h14 = j64.a().h(yv2.h.a(this));
                q.c(h14, "this.`as`(AutoDispose.autoDisposable(provider))");
                ((z) h14).a(new hq.a(fVar), new hq.b(j64, eVar));
            }
        }
    }

    @Override // com.linecorp.linelive.player.component.BasePlayerFragment, g42.u.a
    public void onChangeKeyboardLayout(boolean z14, int i14) {
        if (u6().isValid()) {
            if ((!z14 || getBinding().commentInputView.getEditText().hasFocus()) && !g42.n.isInMultiWindow(this)) {
                showCommentView(z14, i14);
                this.f32909t = z14 ? i14 : 0;
                if (v6()) {
                    m6().endAnimation();
                    m6().updatePositionY(i14 > 0 ? -((float) i14) : 0.0f);
                    if (getScreenState().isPortraitScreen() || !z14) {
                        m6().showView(false);
                    } else {
                        m6().hideView();
                    }
                }
            }
        }
    }

    @Override // v22.n0, com.linecorp.linelive.player.component.BasePlayerFragment
    public void onChatDisconnected() {
        super.onChatDisconnected();
        u6().isValid();
    }

    @Override // com.linecorp.linelive.player.component.BasePlayerFragment, com.linecorp.linelive.player.component.ui.common.badge.BadgesFragment.b
    public void onClickBirthdayBadge(BirthdayBadge birthdayBadge) {
        getTrackingHelper().sendClickPlayerDefaultTapBirthdayBadge();
        showGiftViews();
    }

    @Override // com.linecorp.linelive.player.component.BasePlayerFragment
    public void onClickBlockingView() {
        super.onClickBlockingView();
        if (g42.n.isInMultiWindow(this)) {
            showCommentView(false, 0);
        }
    }

    @Override // com.linecorp.linelive.player.component.BasePlayerFragment, v22.n
    public void onClickCasterMessage(String str) {
        q.f(str, "casterMessage");
        List<String> extractUrls = y.extractUrls(str);
        if (g42.e.Companion.isEmpty(extractUrls)) {
            showChannelDialog();
            return;
        }
        op.k kVar = n6().f107781b;
        Context requireContext = requireContext();
        q.e(requireContext, "requireContext()");
        kVar.e(requireContext, extractUrls.get(0), null);
    }

    @Override // com.linecorp.linelive.player.component.BasePlayerFragment
    public void onClickCommentButton() {
        if (isRestricted()) {
            s32.b playerDialogHelper = getPlayerDialogHelper();
            n32.b bVar = n32.b.CHAT;
            n32.a restrictionData = getRestrictionData();
            q.d(restrictionData);
            playerDialogHelper.showRestrictionDialog(this, bVar, restrictionData);
        } else if (!j6().b()) {
            j6().c(this, 500, d.a.COMMENT);
        } else {
            hq.d j64 = j6();
            Context requireContext = requireContext();
            q.e(requireContext, "requireContext()");
            j64.d(requireContext);
            getControllerVisibilityHelper().show();
            z6();
        }
    }

    @Override // com.linecorp.linelive.player.component.BasePlayerFragment, com.linecorp.linelive.player.component.ui.common.badge.BadgesFragment.b
    public void onClickEventBadge(long j14, String str) {
        q.f(str, "destinationUrl");
        getTrackingHelper().sendClickPlayerDefaultTapEventIcon(j14);
        op.k kVar = n6().f107781b;
        androidx.fragment.app.n requireActivity = requireActivity();
        q.e(requireActivity, "requireActivity()");
        kVar.e(requireActivity, str + "?channelId=" + getBroadcast().getBroadcastResponse().getChannelId(), null);
    }

    @Override // com.linecorp.linelive.player.component.BasePlayerFragment, com.linecorp.linelive.player.component.ui.common.badge.BadgesFragment.b
    public void onClickFestivalEventBadge(long j14, String str) {
        q.f(str, "destinationUrl");
        getTrackingHelper().sendClickPlayerDefaultTapFestivalIcon(j14);
        if (getBroadcast().getBroadcastResponse().isBroadcastingNow()) {
            getGiftItemViewModel().setEventIdFromEventBadge(Long.valueOf(j14));
            showGiftViews();
            return;
        }
        op.k kVar = n6().f107781b;
        androidx.fragment.app.n requireActivity = requireActivity();
        q.e(requireActivity, "requireActivity()");
        kVar.e(requireActivity, str + "?channelId=" + getBroadcast().getBroadcastResponse().getChannelId(), null);
    }

    @Override // com.linecorp.linelive.player.component.BasePlayerFragment
    public void onClickFollow() {
        String mid;
        super.onClickFollow();
        ChannelDetailResponse channelDetailResponse = this.f32899j;
        if (channelDetailResponse == null) {
            return;
        }
        if (channelDetailResponse.isOfficialAccount()) {
            ChannelDetailResponse channelDetailResponse2 = this.f32899j;
            if (channelDetailResponse2 != null && (mid = channelDetailResponse2.getMid()) != null) {
                getBinding().playerHeader.btnFollow.setVisibility(8);
                Object h14 = p6().a(mid).h(yv2.h.a(this));
                q.c(h14, "this.`as`(AutoDispose.autoDisposable(provider))");
                ((z) h14).a(bq.y.f14178b, new bq.m(this, 0));
                return;
            }
            return;
        }
        hq.i iVar = this.f32900k;
        if (iVar != null) {
            iVar.c();
        }
    }

    @Override // com.linecorp.linelive.player.component.BasePlayerFragment
    public void onClickHeader() {
        showChannelDialog();
    }

    @Override // com.linecorp.linelive.player.component.BasePlayerFragment
    public void onClickLoveButton() {
    }

    @Override // com.linecorp.linelive.player.component.BasePlayerFragment
    public void onClickPlayer() {
        if (!getPlayerController().isAdDisplaying()) {
            getControllerVisibilityHelper().toggle();
        }
    }

    @Override // com.linecorp.linelive.player.component.BasePlayerFragment, com.linecorp.linelive.player.component.chat.CommentInputView.b
    public void onClickSendButton(EditText editText) {
        q.f(editText, "editText");
        if (u6().isValid()) {
            String obj = editText.getText().toString();
            h32.a aVar = this.f32906q;
            if (aVar != null) {
                aVar.sendChatMessage(obj);
            }
            super.onClickSendButton(editText);
        }
    }

    @Override // com.linecorp.linelive.player.component.BasePlayerFragment
    public void onClickShareButton() {
        super.onClickShareButton();
        if (!j6().b()) {
            j6().c(this, 500, d.a.SHARE);
            return;
        }
        hq.d j64 = j6();
        Context requireContext = requireContext();
        q.e(requireContext, "requireContext()");
        j64.d(requireContext);
        String shareURL = getBroadcast().getBroadcastResponse().getShareURL();
        String string = getString(R.string.player_share_description, getBroadcast().getBroadcastResponse().getChannel().getName(), getBroadcast().getBroadcastResponse().getTitle(), shareURL);
        q.e(string, "getString(\n            R…       shareUrl\n        )");
        op.k kVar = n6().f107781b;
        androidx.fragment.app.n requireActivity = requireActivity();
        q.e(requireActivity, "requireActivity()");
        FragmentManager childFragmentManager = getChildFragmentManager();
        q.e(childFragmentManager, "childFragmentManager");
        q.d(shareURL);
        kVar.c(requireActivity, childFragmentManager, shareURL, string, new h(this));
    }

    @Override // com.linecorp.linelive.player.component.BasePlayerFragment, com.linecorp.linelive.player.component.ui.common.badge.BadgesFragment.b
    public void onClickSupportGaugeBadge(ChallengeGaugeBadge challengeGaugeBadge) {
        getTrackingHelper().sendClickPlayerDefaultTapChallengeGauge();
    }

    @Override // com.linecorp.linelive.player.component.BasePlayerFragment
    public void onClickTitleView() {
        BroadcastPromptlyStatsResponse.PinnedMessage pinnedMessage = getPinnedMessage();
        String url = pinnedMessage != null ? pinnedMessage.getUrl() : null;
        if (url != null) {
            op.k kVar = n6().f107781b;
            androidx.fragment.app.n requireActivity = requireActivity();
            q.e(requireActivity, "requireActivity()");
            kVar.e(requireActivity, url, null);
            return;
        }
        showChannelDialog();
    }

    @Override // com.linecorp.linelive.player.component.BasePlayerFragment
    public void onCompletionCallback() {
        getEventApiHelper().pauseContent();
        if (u6().isValid()) {
            if (isPlayingLiveStreaming()) {
                getPlayerController().releasePlayer();
                BasePlayerFragment.startLiveStatusChecker$default(this, false, null, 3, null);
            } else {
                getPlayerController().seekTo(0);
                l42.g.pause$default(getPlayerController(), false, 1, null);
            }
            getControllerVisibilityHelper().show();
            v22.d archiveVideoPlayerListenerInstance = getArchiveVideoPlayerListenerInstance();
            if (archiveVideoPlayerListenerInstance != null) {
                archiveVideoPlayerListenerInstance.onVideoStop();
            }
        }
    }

    @Override // com.linecorp.linelive.player.component.BasePlayerFragment, s32.b.c
    public void onConfirmTwitterLogin() {
    }

    @Override // com.linecorp.linelive.player.component.BasePlayerFragment, com.linecorp.linelive.player.component.rx.AutoDisposeV4Fragment, androidx.fragment.app.Fragment
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        initAudioMuter(bundle);
        az2.d<lp.b> dVar = n6().f107788i.f107805e;
        Objects.requireNonNull(dVar);
        Object f14 = new mx2.l0(dVar).O(ax2.a.a()).f(yv2.h.a(this));
        q.c(f14, "this.`as`(AutoDispose.autoDisposable(provider))");
        ((yv2.v) f14).b(new bq.q(this));
        Bundle arguments = getArguments();
        BroadcastDetailResponse broadcastDetailResponse = null;
        if (bundle != null) {
            Serializable serializable = bundle.getSerializable(BasePlayerFragment.KEY_BROADCAST);
            if (serializable instanceof BroadcastDetailResponse) {
                broadcastDetailResponse = (BroadcastDetailResponse) serializable;
            }
            j6().f82668f = bundle.getBoolean("state.is_first_action", true);
        } else if (arguments != null) {
            Serializable serializable2 = arguments.getSerializable(BasePlayerFragment.ARG_BROADCAST);
            if (serializable2 instanceof BroadcastDetailResponse) {
                broadcastDetailResponse = (BroadcastDetailResponse) serializable2;
            }
        }
        if (broadcastDetailResponse != null) {
            super.initWithBroadcast(broadcastDetailResponse, bundle);
            long channelId = broadcastDetailResponse.getBroadcastResponse().getChannelId();
            if (bundle == null) {
                getEventApiHelper().sendOpenEvent(l32.a.AUTO);
            } else {
                getEventApiHelper().restoreInstanceState(bundle);
            }
            e eVar = new e(this, channelId);
            Context requireContext = requireContext();
            q.e(requireContext, "requireContext()");
            setChannelProfileToast(new f32.d(eVar, requireContext, this, new f(this), getToastUtils()));
        }
    }

    @Override // com.linecorp.linelive.player.component.BasePlayerFragment, androidx.fragment.app.Fragment
    public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
        q.f(layoutInflater, "inflater");
        View onCreateView = super.onCreateView(layoutInflater, viewGroup, bundle);
        nx2.a aVar = new nx2.a(new nx2.m(k6().getChannel(getBroadcast().getBroadcastResponse().getChannelId()).z(ax2.a.a()).E(zy2.a.f202073c), new r0(this, 0)));
        getBinding().playerHeader.btnFollow.setVisibility(8);
        ((z) ((yv2.g) yv2.h.a(this)).a(aVar)).a(new bq.n(this, 0), new bq.p(this));
        getBinding().suspendedErrorMessage.setOnClickListener(new bq.s(this));
        getBinding().btnAdSound.setOnClickListener(new d0(this));
        getBinding().bottomContainer.btnSound.setVisibility(0);
        getBinding().bottomContainer.btnSound.setOnClickListener(new bq.m0(this));
        boolean isMute = getAudioMuter().isMute();
        getBinding().btnAdSound.setChecked(isMute);
        getBinding().bottomContainer.btnSound.setChecked(isMute);
        return onCreateView;
    }

    @Override // com.linecorp.linelive.player.component.BasePlayerFragment, com.linecorp.linelive.player.component.rx.AutoDisposeV4Fragment, androidx.fragment.app.Fragment
    public void onDestroyView() {
        hq.i iVar = this.f32900k;
        if (iVar != null) {
            iVar.f82681h = null;
        }
        getBinding().playerControllerContainer.seekbar.setOnSeekBarChangeListener(null);
        this.f32910u.dispose();
        getBinding().unbind();
        super.onDestroyView();
    }

    @Override // androidx.fragment.app.Fragment
    public void onMultiWindowModeChanged(boolean z14) {
        super.onMultiWindowModeChanged(z14);
        x6(z14);
        showCommentView(false, 0);
        if (z14) {
            iq.c.a(requireActivity());
        } else {
            iq.c.b(requireActivity());
        }
    }

    @Override // com.linecorp.linelive.player.component.BasePlayerFragment, g42.f.a
    public void onNetworkConnect() {
    }

    @Override // com.linecorp.linelive.player.component.BasePlayerFragment, androidx.fragment.app.Fragment
    public void onSaveInstanceState(Bundle bundle) {
        q.f(bundle, "outState");
        super.onSaveInstanceState(bundle);
        bundle.putSerializable("channel", this.f32899j);
        bundle.putBoolean("state.is_first_action", j6().f82668f);
    }

    @Override // com.linecorp.linelive.player.component.BasePlayerFragment, s32.b.c
    public void onShownCommentShareCautionDialog() {
    }

    @Override // com.linecorp.linelive.player.component.rx.AutoDisposeV4Fragment, androidx.fragment.app.Fragment
    public void onStart() {
        super.onStart();
        h32.a aVar = this.f32906q;
        if (aVar != null) {
            aVar.startPollingCommerceData();
        }
    }

    @Override // com.linecorp.linelive.player.component.rx.AutoDisposeV4Fragment, androidx.fragment.app.Fragment
    public void onStop() {
        super.onStop();
        h32.a aVar = this.f32906q;
        if (aVar != null) {
            aVar.stopPollingData();
        }
        if (v6()) {
            m6().cancelAnimation();
        }
        ValueAnimator valueAnimator = this.f32907r;
        if (valueAnimator != null) {
            valueAnimator.cancel();
        }
    }

    @Override // com.linecorp.linelive.player.component.BasePlayerFragment, l42.e.b
    public void onSurfaceTextureSizeChanged(SurfaceTexture surfaceTexture, int i14, int i15) {
        if (!g42.n.isInMultiWindow(this)) {
            super.onSurfaceTextureSizeChanged(surfaceTexture, i14, i15);
        }
    }

    @Override // com.linecorp.inlinelive.ui.player.dialog.profile.ChannelProfileDialogFragment.b
    public void p2() {
        bq.e eVar = (bq.e) getTrackingHelper();
        eVar.f14119a.sendClickPlayerCasterInfoTapLaunchLiveApp(g32.c.Companion.getTsParamLiveStatus(eVar.f14120b.isBroadcastingNow()), eVar.f14120b.getId(), eVar.f14120b.getChannelId());
    }

    public final h0 p6() {
        h0 h0Var = this.f32894e;
        if (h0Var != null) {
            return h0Var;
        }
        q.l("lineLiveHandler");
        throw null;
    }

    @Override // com.linecorp.linelive.player.component.BasePlayerFragment
    public void pausePlayer() {
        iq.a aVar = n6().f107789j;
        androidx.fragment.app.n requireActivity = requireActivity();
        Objects.requireNonNull(aVar);
        requireActivity.unregisterReceiver(aVar);
        aVar.f88658d = aVar.f88657c;
        if (n6().f107789j.f88657c) {
            iq.a aVar2 = n6().f107789j;
            aVar2.f88656b.removeCallbacks(aVar2.f88660f);
            aVar2.f88656b.postDelayed(aVar2.f88660f, 500);
        }
        getEventApiHelper().pauseContent();
        getEventApiHelper().pauseAd();
        super.pausePlayer();
    }

    @Override // com.linecorp.linelive.player.component.BasePlayerFragment
    public void preparePlayerWithBroadcastStatus() {
        i iVar = new i(this);
        BroadcastResponse broadcastResponse = getBroadcast().getBroadcastResponse();
        String broadcastSecretToken = broadcastResponse.getBroadcastSecretToken();
        if (broadcastSecretToken != null) {
            r32.j jVar = this.f32902m;
            Object h14 = k6().getSecretBroadcastStatus(broadcastSecretToken).z(ax2.a.a()).E(zy2.a.f202073c).h(yv2.h.a(this));
            q.c(h14, "this.`as`(AutoDispose.autoDisposable(provider))");
            zw2.d0 f14 = ((z) h14).f(iVar);
            q.e(f14, "channelApi.getSecretBroa…ber\n                    )");
            jVar.add((bx2.c) f14);
            return;
        }
        r32.j jVar2 = this.f32902m;
        Object h15 = k6().getBroadcastStatus(broadcastResponse.getChannelId(), broadcastResponse.getId()).z(ax2.a.a()).E(zy2.a.f202073c).h(yv2.h.a(this));
        q.c(h15, "this.`as`(AutoDispose.autoDisposable(provider))");
        zw2.d0 f15 = ((z) h15).f(iVar);
        q.e(f15, "channelApi.getBroadcastS…ber\n                    )");
        jVar2.add((bx2.c) f15);
    }

    @Override // com.linecorp.linelive.player.component.BasePlayerFragment
    public void requestFullScreen(Activity activity) {
        q.f(activity, "activity");
        if (!g42.n.isInMultiWindow(this)) {
            iq.c.b(activity);
        }
    }

    @Override // com.linecorp.linelive.player.component.BasePlayerFragment
    public void setupTwitterIcon() {
        getBinding().commentInputView.setTwitterIconVisibility(false);
    }

    @Override // com.linecorp.linelive.player.component.BasePlayerFragment
    public void showChallengeDescription() {
        if (q.b("JP", this.f32901l)) {
            super.showChallengeDescription();
        }
    }

    @Override // com.linecorp.linelive.player.component.BasePlayerFragment
    public void showChannelDialog() {
        super.showChannelDialog();
        ChannelDetailResponse channelDetailResponse = this.f32899j;
        if (channelDetailResponse == null || getChildFragmentManager().J(BasePlayerFragment.DIALOG_TAG_CHANNEL_PROFILE) != null) {
            return;
        }
        if (channelDetailResponse.isOfficialAccount()) {
            String mid = channelDetailResponse.getMid();
            if (mid != null) {
                getTrackingHelper().sendScreenPlayerCasterInfo();
                Object d14 = yv2.h.a(this).d(new ix2.c(new op.i0(p6(), new WeakReference(requireContext()), mid)));
                q.c(d14, "this.`as`(AutoDispose.au…isposable<Any>(provider))");
                ((yv2.s) d14).e(new q0(this));
                return;
            }
            return;
        }
        androidx.fragment.app.a aVar = new androidx.fragment.app.a(getChildFragmentManager());
        BroadcastDetailResponse broadcast = getBroadcast();
        int i14 = ChannelProfileDialogFragment.f32970m;
        Bundle bundle = new Bundle();
        bundle.putSerializable("arg.channel", channelDetailResponse);
        bundle.putSerializable("arg.broadcast", broadcast);
        ChannelProfileDialogFragment channelProfileDialogFragment = new ChannelProfileDialogFragment();
        channelProfileDialogFragment.setArguments(bundle);
        aVar.l(0, channelProfileDialogFragment, BasePlayerFragment.DIALOG_TAG_CHANNEL_PROFILE, 1);
        aVar.g();
    }

    public final void showCommentView(boolean z14, int i14) {
        adjustChatLayout(getScreenState(), z14, i14);
        if (z14) {
            adjustInputViewLayout(i14);
            getBinding().commentInputView.setVisibility(0);
            getBinding().clickBlockingView.setVisibility(0);
            getBinding().bottomContainer.getRoot().setVisibility(8);
            return;
        }
        getBinding().commentInputView.setVisibility(8);
        getBinding().clickBlockingView.setVisibility(8);
        if (isAdFinished() && (getScreenState().isPortraitScreen() || getControllerVisibilityHelper().isVisible())) {
            getBinding().bottomContainer.getRoot().setVisibility(0);
        }
        LiveChatFragment t64 = t6();
        if (t64 != null) {
            t64.scrollToEnd();
        }
    }

    @Override // com.linecorp.linelive.player.component.BasePlayerFragment, f32.e.a
    public void showController() {
        if (u6().isValid()) {
            if (v6()) {
                m6().showView(true);
            }
            super.showController();
        }
    }

    @Override // com.linecorp.linelive.player.component.BasePlayerFragment
    public void showControllerForAd(boolean z14) {
        if (u6().isValid() && isAdFinished()) {
            g42.p.fadeInView(getBinding().bottomContainer.getRoot());
            g42.p.fadeInView(getBinding().playerHeader.headerChannelInfoGroup);
            g42.p.fadeInView(getBinding().playerHeader.headerButtonGroup);
            g42.p.fadeInView(getBinding().playerGradationGroup);
            g42.p.fadeInView(getBinding().chatContent);
            if (isBadgeVisible()) {
                showBadgeIfExist(true);
                g42.p.fadeInView(getBinding().playerHeader.badgeContainer);
            }
            if (isPlayingLiveStreaming()) {
                g42.p.fadeInView(getBinding().bottomContainer.inputHint);
                g42.p.fadeInView(getBinding().bottomContainer.divider);
                getBinding().playerControllerContainer.getRoot().setVisibility(8);
                return;
            }
            g42.p.fadeInView(getBinding().playerControllerContainer.getRoot());
        }
    }

    @Override // com.linecorp.linelive.player.component.BasePlayerFragment
    public void showFinishedBroadcastDialog() {
        f0 f0Var;
        bq.c cVar = (bq.c) getPlayerDialogHelper();
        Objects.requireNonNull(cVar);
        if (!b.C2680b.isShownDialog(cVar, this, "dialog_finished_broadcast")) {
            ChannelDetailResponse channelDetailResponse = this.f32899j;
            if (channelDetailResponse == null) {
                f0Var = new nx2.a(new nx2.m(k6().getChannel(getBroadcast().getBroadcastResponse().getChannelId()).z(ax2.a.a()).E(zy2.a.f202073c), new bq.r(this)));
            } else {
                f0Var = new nx2.v(channelDetailResponse);
            }
            ((yv2.u) ((yv2.g) yv2.h.a(this)).e(new kx2.o(new kx2.k(f0Var, bq.h0.f14133b), new bq.a0(this)))).a(new bq.w(this), new bq.j(this, 0));
            ((yv2.u) ((yv2.g) yv2.h.a(this)).e(new kx2.k(f0Var, bq.i0.f14136b))).a(new bq.l(this, 0), new bq.k(this, 0));
        }
    }

    @Override // com.linecorp.linelive.player.component.BasePlayerFragment
    public void showGiftViews() {
        if (!j6().b()) {
            j6().c(this, 500, d.a.GIFT);
            return;
        }
        hq.d j64 = j6();
        Context requireContext = requireContext();
        q.e(requireContext, "requireContext()");
        j64.d(requireContext);
        d42.m giftNavigator = getGiftNavigator();
        if (giftNavigator != null) {
            giftNavigator.showGiftItemList();
        }
    }

    @Override // com.linecorp.linelive.player.component.BasePlayerFragment
    public void showMuteButtonForAd() {
        g42.p.fadeInView(getBinding().btnAdSound);
    }

    @Override // com.linecorp.linelive.player.component.BasePlayerFragment
    public void showUserDialog(User user, BlocklistAddingPayload blocklistAddingPayload, ChannelDetailResponse channelDetailResponse) {
        q.f(user, "user");
        getTrackingHelper().sendScreenPlayerViewerInfo();
        if (!n6().f107788i.a(user.getId()) && getChildFragmentManager().J(BasePlayerFragment.DIALOG_TAG_VIEWER_PROFILE) == null) {
            boolean isBroadcastingNow = getBroadcast().getBroadcastResponse().isBroadcastingNow();
            androidx.fragment.app.a aVar = new androidx.fragment.app.a(getChildFragmentManager());
            int i14 = ViewerProfileDialogFragment.f32982e;
            Bundle bundle = new Bundle();
            bundle.putSerializable("arg.user", user);
            bundle.putSerializable("arg.block_payload", blocklistAddingPayload);
            bundle.putBoolean("arg.can_reply", isBroadcastingNow);
            ViewerProfileDialogFragment viewerProfileDialogFragment = new ViewerProfileDialogFragment();
            viewerProfileDialogFragment.setArguments(bundle);
            aVar.l(0, viewerProfileDialogFragment, BasePlayerFragment.DIALOG_TAG_VIEWER_PROFILE, 1);
            aVar.g();
        }
    }

    @Override // com.linecorp.linelive.player.component.BasePlayerFragment
    public void startPlayer() {
        super.startPlayer();
        iq.a aVar = n6().f107789j;
        androidx.fragment.app.n requireActivity = requireActivity();
        Objects.requireNonNull(aVar);
        requireActivity.registerReceiver(aVar, new IntentFilter("android.media.RINGER_MODE_CHANGED"));
        iq.a aVar2 = n6().f107789j;
        if (aVar2.f88658d) {
            aVar2.f88656b.removeCallbacks(aVar2.f88660f);
            aVar2.f88655a.adjustStreamVolume(3, -100, 0);
            aVar2.a(true);
            aVar2.f88659e = SystemClock.elapsedRealtime();
        }
    }

    @Override // com.linecorp.linelive.player.component.BasePlayerFragment
    public void startPromptlyStatsUpdater() {
        ((z) ((yv2.g) yv2.h.a(this)).a(new nx2.m(new w(a0.x(p6().f124145a.b()), bq.e0.f14122b), new t(this)))).a(new bq.i(this, 0), bq.z.f14179b);
    }

    @Override // com.linecorp.linelive.player.component.BasePlayerFragment
    public void subscribeViewEventBus() {
        r32.j jVar = this.f32910u;
        g42.r rVar = g42.r.INSTANCE;
        jVar.addAll(g42.r.subscribe$default(rVar, null, false, m32.e.class, new j(this.f32911v), 3, null), g42.r.subscribe$default(rVar, null, false, m32.b.class, new k(this.f32911v), 3, null), g42.r.subscribe$default(rVar, null, false, yp.b.class, new l(this.f32911v), 3, null), g42.r.subscribe$default(rVar, null, false, yp.a.class, new m(this.f32911v), 3, null));
    }

    public final LiveChatFragment t6() {
        BaseChatFragment chatFragment = getChatFragment();
        if (chatFragment instanceof LiveChatFragment) {
            return (LiveChatFragment) chatFragment;
        }
        return null;
    }

    public final k42.d<?> u6() {
        return (k42.d) this.f32891b.getValue();
    }

    public final boolean v6() {
        h32.a aVar = this.f32906q;
        if (aVar == null) {
            return false;
        }
        boolean z14 = aVar.getCommerceState() == a.EnumC1124a.ENABLED;
        Objects.requireNonNull(getBinding().commerceProductViewStub);
        boolean a14 = getBinding().commerceProductViewStub.a();
        if (!z14 || !a14) {
            return false;
        }
        return true;
    }

    public final void w6(View view) {
        CompoundButton compoundButton = (CompoundButton) view;
        boolean isChecked = compoundButton.isChecked();
        if (isChecked) {
            getAudioMuter().mute();
        } else {
            getAudioMuter().unmute();
        }
        getBinding().btnAdSound.setChecked(isChecked);
        getBinding().bottomContainer.btnSound.setChecked(isChecked);
        int id4 = compoundButton.getId();
        if (id4 == R.id.btn_ad_sound) {
            bq.e eVar = (bq.e) getTrackingHelper();
            g32.c cVar = eVar.f14119a;
            c.a aVar = g32.c.Companion;
            cVar.sendClickPlayerDefaultToggleAdSound(aVar.getTsParamLiveStatus(eVar.f14120b.isBroadcastingNow()), eVar.f14120b.getId(), eVar.f14120b.getChannelId(), aVar.getTsParamToggleStatus(!isChecked, true));
        } else if (id4 == R.id.btn_sound) {
            getTrackingHelper().sendClickPlayerDefaultToggleSound(!isChecked);
        }
    }

    public final void x6(boolean z14) {
        if (z14) {
            getBinding().playerView.setNoGapFitMode(false);
            getBinding().playerView.setRotationTransformEnabled(false);
            return;
        }
        getBinding().playerView.setNoGapFitMode(false);
        getBinding().playerView.setRotationTransformEnabled(getScreenState().isPortraitVideo());
    }

    public final void z6() {
        getBinding().clickBlockingView.setVisibility(0);
        getBinding().commentInputView.showKeyboard();
        if (g42.n.isInMultiWindow(this)) {
            showCommentView(true, 0);
        }
    }
}