导航菜单

页面标题

页面副标题

Top浏览器 v4.6.16 - VideoActivity.java 源代码

正在查看: Top浏览器 v4.6.16 应用的 VideoActivity.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.pocket.topbrowser.browser.av;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.drawable.GradientDrawable;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.provider.Settings;
import android.text.TextUtils;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.MimeTypeMap;
import android.widget.CompoundButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.fragment.app.DialogFragment;
import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModel;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import c.t.a.d.n;
import c.t.a.s.f;
import c.t.a.u.a;
import c.t.a.w.r0;
import c.t.a.w.s0;
import c.t.a.x.i.o;
import c.t.a.x.i.r;
import c.t.c.j.b1.j0;
import c.t.c.j.b1.k0;
import c.t.c.j.x0;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.fm.ui.cell.YaCellView;
import com.fm.ui.file_path.SelectFilePathActivity;
import com.google.android.material.snackbar.Snackbar;
import com.pocket.common.base.BaseDialogFragment;
import com.pocket.common.base.BaseViewModelActivity;
import com.pocket.common.dialog.confirm.ConfirmDialog;
import com.pocket.common.dialog.list.ListDialog;
import com.pocket.common.dialog.list.ListSelectDialog;
import com.pocket.common.download.DownloadDialog;
import com.pocket.common.view.video.TimesSpeedSettingDialog;
import com.pocket.common.view.video.TopVideoController;
import com.pocket.common.view.video.TopVideoView;
import com.pocket.topbrowser.browser.R$color;
import com.pocket.topbrowser.browser.R$id;
import com.pocket.topbrowser.browser.R$layout;
import com.pocket.topbrowser.browser.R$mipmap;
import com.pocket.topbrowser.browser.R$string;
import com.pocket.topbrowser.browser.av.DLNACastActivity;
import com.pocket.topbrowser.browser.av.VideoActivity;
import com.pocket.topbrowser.browser.download.DownloadActivity;
import com.pocket.topbrowser.browser.sniffing.VideoCatalogueEntitySubList;
import com.pocket.topbrowser.browser.sniffing.VideoCatalogueEntitySubListItem;
import h.b0.c.l;
import h.b0.c.p;
import h.b0.c.q;
import h.b0.d.m;
import h.i0.t;
import h.u;
import h.w.s;
import i.a.n0;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.adblockplus.libadblockplus.android.settings.Utils;
import xyz.doikki.videoplayer.controller.BaseVideoController;

public final class VideoActivity extends BaseViewModelActivity {
    public static final a a = new a(null);
    public TextView A;
    public LinearLayout B;
    public YaCellView C;
    public YaCellView D;
    public ListSelectDialog b;

    public VideoViewModel f806c;

    public SnifferVideoInfo f807d;

    public String f811h;

    public VideoUrlAdapter f813j;

    public b f814k;

    public TextView f815l;

    public ImageView f816m;
    public TextView n;
    public LinearLayout o;
    public ImageView p;
    public TextView q;
    public LinearLayout r;
    public ImageView s;
    public TextView t;
    public LinearLayout u;
    public ImageView v;
    public TextView w;
    public LinearLayout x;
    public ImageView y;
    public TextView z;

    public int f808e = c.h.b.i.c.e("kernel_index", 0);

    public int f809f = 2;

    public float f810g = 1.0f;

    public boolean f812i = true;

    public static final class a {
        public a() {
        }

        public a(h.b0.d.g gVar) {
            this();
        }

        public final void a(Activity activity) {
            h.b0.d.l.f(activity, "activity");
            activity.startActivity(new Intent(activity, (Class<?>) VideoActivity.class));
        }
    }

    public static final class b extends BaseQuickAdapter<VideoCatalogueEntitySubListItem, BaseViewHolder> {
        public GradientDrawable D;
        public GradientDrawable E;
        public int F;

        public b() {
            super(R$layout.browser_av_video_episode_item, (List) null, 2, (h.b0.d.g) null);
            this.F = -1;
        }

        public void r(BaseViewHolder baseViewHolder, VideoCatalogueEntitySubListItem videoCatalogueEntitySubListItem) {
            h.b0.d.l.f(baseViewHolder, "holder");
            h.b0.d.l.f(videoCatalogueEntitySubListItem, "item");
            TextView textView = (TextView) baseViewHolder.getView(R$id.tv_episode);
            textView.setText(videoCatalogueEntitySubListItem.getText());
            textView.setBackground(baseViewHolder.getAdapterPosition() == this.F ? y0() : x0());
        }

        public final int w0() {
            return this.F;
        }

        public final GradientDrawable x0() {
            if (this.E == null) {
                GradientDrawable gradientDrawable = new GradientDrawable();
                this.E = gradientDrawable;
                h.b0.d.l.d(gradientDrawable);
                gradientDrawable.setCornerRadius(c.t.a.k.f.a(5));
                GradientDrawable gradientDrawable2 = this.E;
                h.b0.d.l.d(gradientDrawable2);
                gradientDrawable2.setStroke(c.t.a.k.f.a(1), Color.parseColor(c.t.a.u.a.a.b() ? "#333333" : "#cccccc"), 0.0f, 0.0f);
            }
            GradientDrawable gradientDrawable3 = this.E;
            h.b0.d.l.d(gradientDrawable3);
            return gradientDrawable3;
        }

        public final GradientDrawable y0() {
            if (this.D == null) {
                GradientDrawable gradientDrawable = new GradientDrawable();
                this.D = gradientDrawable;
                h.b0.d.l.d(gradientDrawable);
                gradientDrawable.setCornerRadius(c.t.a.k.f.a(5));
                GradientDrawable gradientDrawable2 = this.D;
                h.b0.d.l.d(gradientDrawable2);
                int a = c.t.a.k.f.a(1);
                a.b bVar = c.t.a.u.a.a;
                gradientDrawable2.setStroke(a, Color.parseColor(bVar.b() ? "#cccccc" : "#333333"), 0.0f, 0.0f);
                GradientDrawable gradientDrawable3 = this.D;
                h.b0.d.l.d(gradientDrawable3);
                gradientDrawable3.setColor(Color.parseColor(bVar.b() ? "#333333" : "#dddddd"));
            }
            GradientDrawable gradientDrawable4 = this.D;
            h.b0.d.l.d(gradientDrawable4);
            return gradientDrawable4;
        }

        public final void z0(int i2) {
            View T;
            View T2;
            int i3 = this.F;
            if (i3 >= 0 && (T2 = T(i3, R$id.tv_episode)) != null) {
                T2.setBackground(x0());
            }
            if (i2 >= 0 && (T = T(i2 + 1, R$id.tv_episode)) != null) {
                T.setBackground(y0());
            }
            this.F = i2 + 1;
        }
    }

    public static final class c extends m implements h.b0.c.a<u> {
        public c() {
            super(0);
        }

        public static final void a(VideoActivity videoActivity, View view) {
            h.b0.d.l.f(videoActivity, "this$0");
            videoActivity.startActivity(DownloadActivity.class);
        }

        @Override
        public u invoke() {
            invoke2();
            return u.a;
        }

        public final void invoke2() {
            Snackbar make = Snackbar.make((RelativeLayout) VideoActivity.this.findViewById(R$id.rl_container), "开始下载,请在下载管理查看", -1);
            final VideoActivity videoActivity = VideoActivity.this;
            make.setAction("查看", new View.OnClickListener() {
                @Override
                public final void onClick(View view) {
                    VideoActivity.c.a(VideoActivity.this, view);
                }
            }).show();
        }
    }

    public static final class d extends m implements h.b0.c.a<u> {
        public d() {
            super(0);
        }

        @Override
        public u invoke() {
            invoke2();
            return u.a;
        }

        public final void invoke2() {
            Intent intent = new Intent("android.settings.action.MANAGE_OVERLAY_PERMISSION", Uri.parse("package:com.pocket.topbrowser"));
            intent.addFlags(268435456);
            VideoActivity.this.startActivityForResult(intent, 2223);
        }
    }

    public static final class e extends m implements h.b0.c.l<String, u> {
        public e() {
            super(1);
        }

        public final void a(String str) {
            h.b0.d.l.f(str, "it");
            VideoActivity.this.M(true);
        }

        @Override
        public u invoke(String str) {
            a(str);
            return u.a;
        }
    }

    public static final class f extends m implements h.b0.c.l<String, u> {
        public f() {
            super(1);
        }

        public final void a(String str) {
            h.b0.d.l.f(str, "it");
            ArrayList arrayList = new ArrayList();
            Set<Map.Entry> entrySet = c.t.a.s.h.f().e().entrySet();
            h.b0.d.l.e(entrySet, "foundVideoInfoMap.entries");
            BaseViewModelActivity baseViewModelActivity = VideoActivity.this;
            for (Map.Entry entry : entrySet) {
                CharSequence title = baseViewModelActivity.getTitle();
                h.b0.d.l.e(title, Utils.SUBSCRIPTION_FIELD_TITLE);
                if (title.length() == 0) {
                    baseViewModelActivity.setTitle(((c.t.a.s.f) entry.getValue()).c());
                }
                String e2 = ((c.t.a.s.f) entry.getValue()).e();
                h.b0.d.l.e(e2, "it.value.url");
                arrayList.add(e2);
            }
            List A = s.A(arrayList);
            VideoUrlAdapter videoUrlAdapter = VideoActivity.this.f813j;
            if (videoUrlAdapter == null) {
                h.b0.d.l.u("adapter");
                videoUrlAdapter = null;
            }
            videoUrlAdapter.o0(A);
        }

        @Override
        public u invoke(String str) {
            a(str);
            return u.a;
        }
    }

    public static final class g extends m implements h.b0.c.l<c.t.a.s.f, u> {
        public g() {
            super(1);
        }

        public final void a(c.t.a.s.f fVar) {
            h.b0.d.l.f(fVar, "it");
            VideoActivity.this.hideLoadingDialog();
            SnifferVideoInfo snifferVideoInfo = VideoActivity.this.f807d;
            VideoUrlAdapter videoUrlAdapter = null;
            if (h.b0.d.l.b(snifferVideoInfo == null ? null : snifferVideoInfo.getUrl(), fVar.d())) {
                VideoUrlAdapter videoUrlAdapter2 = VideoActivity.this.f813j;
                if (videoUrlAdapter2 == null) {
                    h.b0.d.l.u("adapter");
                } else {
                    videoUrlAdapter = videoUrlAdapter2;
                }
                String e2 = fVar.e();
                h.b0.d.l.e(e2, "it.url");
                videoUrlAdapter.g(e2);
                return;
            }
            SnifferVideoInfo snifferVideoInfo2 = VideoActivity.this.f807d;
            if (snifferVideoInfo2 != null) {
                snifferVideoInfo2.setUrl(fVar.d());
            }
            SnifferVideoInfo snifferVideoInfo3 = VideoActivity.this.f807d;
            if (snifferVideoInfo3 != null) {
                String c2 = fVar.c();
                h.b0.d.l.e(c2, "it.sourcePageTitle");
                snifferVideoInfo3.setTitle(c2);
            }
            TopVideoView O = VideoActivity.this.O();
            if (O == null) {
                return;
            }
            VideoActivity videoActivity = VideoActivity.this;
            TextView textView = videoActivity.f815l;
            if (textView == null) {
                h.b0.d.l.u("videoTitleTv");
                textView = null;
            }
            textView.setText(fVar.c());
            VideoUrlAdapter videoUrlAdapter3 = videoActivity.f813j;
            if (videoUrlAdapter3 == null) {
                h.b0.d.l.u("adapter");
            } else {
                videoUrlAdapter = videoUrlAdapter3;
            }
            videoUrlAdapter.o0(h.w.j.b(fVar.e()));
            if (TextUtils.equals(O.getUrl(), fVar.e())) {
                return;
            }
            O.release();
            O.setUrl(fVar.e());
            O.setTitle(fVar.c());
            O.start();
        }

        @Override
        public u invoke(c.t.a.s.f fVar) {
            a(fVar);
            return u.a;
        }
    }

    @h.y.j.a.f(c = "com.pocket.topbrowser.browser.av.VideoActivity$selectEpisode$1$a$1", f = "VideoActivity.kt", l = {458}, m = "invokeSuspend")
    public static final class h extends h.y.j.a.l implements p<n0, h.y.d<? super c.t.c.o.s.n.k>, Object> {
        public int a;
        public final VideoCatalogueEntitySubListItem b;

        public static final class a extends m implements q<String, String, String, u> {
            public static final a a = new a();

            public a() {
                super(3);
            }

            public final void a(String str, String str2, String str3) {
                String fileExtensionFromUrl;
                h.b0.d.l.f(str, Utils.SUBSCRIPTION_FIELD_URL);
                h.b0.d.l.f(str2, "currentUrl");
                h.b0.d.l.f(str3, Utils.SUBSCRIPTION_FIELD_TITLE);
                int W = t.W(str, "?", 0, false, 6, null);
                if (W > 0) {
                    String substring = str.substring(0, W);
                    h.b0.d.l.e(substring, "(this as java.lang.Strin…ing(startIndex, endIndex)");
                    fileExtensionFromUrl = MimeTypeMap.getFileExtensionFromUrl(substring);
                } else {
                    fileExtensionFromUrl = MimeTypeMap.getFileExtensionFromUrl(str);
                }
                if ((c.t.a.s.l.e.a(fileExtensionFromUrl) || TextUtils.isEmpty(fileExtensionFromUrl)) && c.h.b.i.c.b("open_av_model", false)) {
                    c.t.a.s.h.f().b(str2, str, str3, true);
                }
            }

            @Override
            public u c(String str, String str2, String str3) {
                a(str, str2, str3);
                return u.a;
            }
        }

        public h(VideoCatalogueEntitySubListItem videoCatalogueEntitySubListItem, h.y.d<? super h> dVar) {
            super(2, dVar);
            this.b = videoCatalogueEntitySubListItem;
        }

        @Override
        public final h.y.d<u> create(Object obj, h.y.d<?> dVar) {
            return new h(this.b, dVar);
        }

        @Override
        public final Object invoke(n0 n0Var, h.y.d<? super c.t.c.o.s.n.k> dVar) {
            return ((h) create(n0Var, dVar)).invokeSuspend(u.a);
        }

        @Override
        public final Object invokeSuspend(Object obj) {
            Object c2 = h.y.i.c.c();
            int i2 = this.a;
            if (i2 == 0) {
                h.m.b(obj);
                c.t.c.o.s.n.e eVar = new c.t.c.o.s.n.e(this.b.getUrl(), null, null, null, null, null, null, a.a, 126, null);
                this.a = 1;
                obj = eVar.p(this);
                if (obj == c2) {
                    return c2;
                }
            } else {
                if (i2 != 1) {
                    throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                }
                h.m.b(obj);
            }
            return obj;
        }
    }

    public static final class i extends m implements h.b0.c.l<Integer, u> {
        public i() {
            super(1);
        }

        public static final void b(VideoActivity videoActivity, int i2) {
            h.b0.d.l.f(videoActivity, "this$0");
            Integer[] N = videoActivity.N();
            b bVar = null;
            if (N[0].intValue() == i2) {
                b bVar2 = videoActivity.f814k;
                if (bVar2 == null) {
                    h.b0.d.l.u("episodeAdapter");
                } else {
                    bVar = bVar2;
                }
                bVar.z0(N[1].intValue());
                return;
            }
            b bVar3 = videoActivity.f814k;
            if (bVar3 == null) {
                h.b0.d.l.u("episodeAdapter");
            } else {
                bVar = bVar3;
            }
            bVar.z0(-1);
        }

        public final void a(final int i2) {
            YaCellView yaCellView = VideoActivity.this.D;
            if (yaCellView == null) {
                h.b0.d.l.u("avLineCv");
                yaCellView = null;
            }
            yaCellView.setValueText(h.b0.d.l.m("线路", Integer.valueOf(i2 + 1)));
            VideoActivity videoActivity = VideoActivity.this;
            SnifferVideoInfo snifferVideoInfo = videoActivity.f807d;
            h.b0.d.l.d(snifferVideoInfo);
            VideoCatalogueEntitySubList videoCatalogueEntitySubList = snifferVideoInfo.getEpisode().get(i2);
            h.b0.d.l.e(videoCatalogueEntitySubList, "videoInfo!!.episode[index]");
            videoActivity.m0(videoCatalogueEntitySubList);
            final VideoActivity videoActivity2 = VideoActivity.this;
            c.h.b.o.i.c(new Runnable() {
                @Override
                public final void run() {
                    VideoActivity.i.b(VideoActivity.this, i2);
                }
            }, 100L);
        }

        @Override
        public u invoke(Integer num) {
            a(num.intValue());
            return u.a;
        }
    }

    public static final class j implements r {
        public j() {
        }

        public void a() {
            TopVideoView O = VideoActivity.this.O();
            if (O == null) {
                return;
            }
            O.setSpeed(VideoActivity.this.f810g);
        }

        public void b() {
            TopVideoView O = VideoActivity.this.O();
            VideoActivity.this.f810g = O == null ? 1.0f : O.getSpeed();
            if (O == null) {
                return;
            }
            O.setSpeed(2.0f);
        }
    }

    public static final class k implements TimesSpeedSettingDialog.a {
        public k() {
        }

        public void a(float f2, int i2) {
            VideoActivity.this.f809f = i2;
            TopVideoView O = VideoActivity.this.O();
            TextView textView = null;
            BaseVideoController videoController = O == null ? null : O.getVideoController();
            if (videoController instanceof TopVideoController) {
                ((TopVideoController) videoController).setTimesSpeedTv(f2);
            }
            if (O != null) {
                O.setSpeed(f2);
            }
            TextView textView2 = VideoActivity.this.z;
            if (textView2 == null) {
                h.b0.d.l.u("tsTv");
            } else {
                textView = textView2;
            }
            StringBuilder sb = new StringBuilder();
            sb.append(f2);
            sb.append('X');
            textView.setText(sb.toString());
        }
    }

    public static final class l extends m implements h.b0.c.l<Integer, u> {
        public final TopVideoView b;

        public static final class a implements r {
            public final VideoActivity a;
            public final TopVideoView b;

            public a(VideoActivity videoActivity, TopVideoView topVideoView) {
                this.a = videoActivity;
                this.b = topVideoView;
            }

            public void a() {
                this.b.setSpeed(this.a.f810g);
            }

            public void b() {
                this.a.f810g = this.b.getSpeed();
                this.b.setSpeed(2.0f);
            }
        }

        public l(TopVideoView topVideoView) {
            super(1);
            this.b = topVideoView;
        }

        public final void a(int i2) {
            DialogFragment dialogFragment = VideoActivity.this.b;
            TextView textView = null;
            if (dialogFragment == null) {
                h.b0.d.l.u("listSelectDialog");
                dialogFragment = null;
            }
            dialogFragment.dismiss();
            VideoActivity.this.f808e = i2;
            c.h.b.i.c.k("kernel_index", i2);
            TextView textView2 = VideoActivity.this.z;
            if (textView2 == null) {
                h.b0.d.l.u("tsTv");
            } else {
                textView = textView2;
            }
            textView.setText("1.0X");
            SnifferVideoInfo snifferVideoInfo = VideoActivity.this.f807d;
            if (snifferVideoInfo != null) {
                TopVideoView topVideoView = this.b;
                ?? r3 = VideoActivity.this;
                topVideoView.release();
                TopVideoController topVideoController = new TopVideoController((Context) r3);
                topVideoController.setVideoLongClickListener(new a(r3, topVideoView));
                topVideoController.a(snifferVideoInfo.getTitle(), false, true);
                topVideoView.setVideoController(topVideoController);
            }
            if (i2 == 0) {
                j0.c(this.b);
            } else if (i2 == 1) {
                j0.b(this.b);
            } else if (i2 == 2) {
                j0.a(this.b);
            }
            this.b.start();
        }

        @Override
        public u invoke(Integer num) {
            a(num.intValue());
            return u.a;
        }
    }

    public static final void I(String str, c.t.a.s.e eVar, String str2, VideoActivity videoActivity) {
        h.b0.d.l.f(str, "$title");
        h.b0.d.l.f(str2, "$url");
        h.b0.d.l.f(videoActivity, "this$0");
        DownloadDialog a2 = DownloadDialog.p.a(str + '.' + ((Object) eVar.b()), str2);
        a2.I(videoActivity.new c());
        a2.q(videoActivity.getSupportFragmentManager());
    }

    public static final void K(VideoActivity videoActivity) {
        h.b0.d.l.f(videoActivity, "this$0");
        TopVideoView O = videoActivity.O();
        if (O == null) {
            return;
        }
        String url = O.getUrl();
        if (url == null || url.length() == 0) {
            return;
        }
        String title = O.getTitle();
        if (title == null || title.length() == 0) {
            return;
        }
        String url2 = O.getUrl();
        h.b0.d.l.e(url2, "vv.url");
        String title2 = O.getTitle();
        h.b0.d.l.e(title2, "vv.title");
        videoActivity.H(url2, title2);
    }

    public static final void h0(TopVideoView topVideoView) {
        c.t.a.x.i.q.h(topVideoView, true, false);
        o.c().j(topVideoView);
    }

    public static final void i0(VideoActivity videoActivity, Float f2) {
        h.b0.d.l.f(videoActivity, "this$0");
        if (h.b0.d.l.a(f2, 0.5f)) {
            videoActivity.f809f = 0;
        } else if (h.b0.d.l.a(f2, 0.75f)) {
            videoActivity.f809f = 1;
        } else if (h.b0.d.l.a(f2, 1.0f)) {
            videoActivity.f809f = 2;
        } else if (h.b0.d.l.a(f2, 1.25f)) {
            videoActivity.f809f = 3;
        } else if (h.b0.d.l.a(f2, 1.5f)) {
            videoActivity.f809f = 4;
        } else if (h.b0.d.l.a(f2, 2.0f)) {
            videoActivity.f809f = 5;
        }
        TextView textView = videoActivity.z;
        if (textView == null) {
            h.b0.d.l.u("tsTv");
            textView = null;
        }
        textView.setText(f2 + " X");
    }

    public static final void j0(VideoActivity videoActivity, View view) {
        h.b0.d.l.f(videoActivity, "this$0");
        if (!videoActivity.f812i) {
            videoActivity.f812i = true;
            videoActivity.findViewById(R$id.recycler_view).smoothScrollToPosition(0);
            ((ImageView) videoActivity.findViewById(R$id.iv_stick)).setImageResource(R$mipmap.common_ic_down);
            return;
        }
        videoActivity.f812i = false;
        RecyclerView findViewById = videoActivity.findViewById(R$id.recycler_view);
        b bVar = videoActivity.f814k;
        if (bVar == null) {
            h.b0.d.l.u("episodeAdapter");
            bVar = null;
        }
        findViewById.smoothScrollToPosition(bVar.w0());
        ((ImageView) videoActivity.findViewById(R$id.iv_stick)).setImageResource(R$mipmap.common_ic_up);
    }

    public static final void l0(VideoCatalogueEntitySubListItem videoCatalogueEntitySubListItem) {
        Object b2;
        h.b0.d.l.f(videoCatalogueEntitySubListItem, "$item");
        b2 = i.a.k.b(null, new h(videoCatalogueEntitySubListItem, null), 1, null);
    }

    public static final void o0(VideoActivity videoActivity, View view) {
        h.b0.d.l.f(videoActivity, "this$0");
        videoActivity.L();
    }

    public static final void p0(VideoActivity videoActivity, View view) {
        h.b0.d.l.f(videoActivity, "this$0");
        TimesSpeedSettingDialog timesSpeedSettingDialog = new TimesSpeedSettingDialog(videoActivity.f809f);
        timesSpeedSettingDialog.G(videoActivity.new k());
        timesSpeedSettingDialog.q(videoActivity.getSupportFragmentManager());
    }

    public static final void q0(VideoActivity videoActivity, View view) {
        h.b0.d.l.f(videoActivity, "this$0");
        TopVideoView O = videoActivity.O();
        if (O == null) {
            return;
        }
        if (o.c().d()) {
            o.c().k(false);
        }
        O.startFullScreen();
    }

    public static final void r0(VideoActivity videoActivity, View view) {
        h.b0.d.l.f(videoActivity, "this$0");
        videoActivity.A0();
    }

    public static final void s0(VideoActivity videoActivity, View view) {
        h.b0.d.l.f(videoActivity, "this$0");
        TopVideoView O = videoActivity.O();
        if (O == null) {
            return;
        }
        o.c().k(true);
        DLNACastActivity.Companion companion = DLNACastActivity.a;
        String url = O.getUrl();
        h.b0.d.l.e(url, "it.url");
        String title = O.getTitle();
        h.b0.d.l.e(title, "it.title");
        companion.start(videoActivity, url, title);
    }

    public static final void t0(VideoActivity videoActivity, Integer[] numArr) {
        h.b0.d.l.f(videoActivity, "this$0");
        h.b0.d.l.f(numArr, "$lineAndEpisode");
        b bVar = videoActivity.f814k;
        if (bVar == null) {
            h.b0.d.l.u("episodeAdapter");
            bVar = null;
        }
        bVar.z0(numArr[1].intValue());
    }

    public static final void u0(VideoActivity videoActivity, BaseQuickAdapter baseQuickAdapter, View view, int i2) {
        h.b0.d.l.f(videoActivity, "this$0");
        h.b0.d.l.f(baseQuickAdapter, "$noName_0");
        h.b0.d.l.f(view, "$noName_1");
        videoActivity.k0(i2);
    }

    public static final boolean v0(VideoActivity videoActivity, BaseQuickAdapter baseQuickAdapter, View view, int i2) {
        h.b0.d.l.f(videoActivity, "this$0");
        h.b0.d.l.f(baseQuickAdapter, "$noName_0");
        h.b0.d.l.f(view, "$noName_1");
        b bVar = videoActivity.f814k;
        if (bVar == null) {
            h.b0.d.l.u("episodeAdapter");
            bVar = null;
        }
        c.t.a.w.p.a(((VideoCatalogueEntitySubListItem) bVar.z().get(i2)).getUrl());
        videoActivity.showToast(videoActivity.getString(R$string.browser_copy_tips));
        return true;
    }

    public static final void w0(VideoActivity videoActivity, View view) {
        h.b0.d.l.f(videoActivity, "this$0");
        ListDialog.a aVar = new ListDialog.a();
        SnifferVideoInfo snifferVideoInfo = videoActivity.f807d;
        h.b0.d.l.d(snifferVideoInfo);
        int i2 = 0;
        for (VideoCatalogueEntitySubList videoCatalogueEntitySubList : snifferVideoInfo.getEpisode()) {
            int i3 = i2 + 1;
            if (i2 < 0) {
                h.w.k.p();
            }
            ListDialog.a.b(aVar, h.b0.d.l.m("线路", Integer.valueOf(i3)), (h.b0.c.a) null, 2, (Object) null);
            i2 = i3;
        }
        aVar.h(videoActivity.new i()).d().q(videoActivity.getSupportFragmentManager());
    }

    public static final void x0(VideoActivity videoActivity) {
        h.b0.d.l.f(videoActivity, "this$0");
        VideoUrlAdapter videoUrlAdapter = videoActivity.f813j;
        if (videoUrlAdapter == null) {
            h.b0.d.l.u("adapter");
            videoUrlAdapter = null;
        }
        videoUrlAdapter.w0(0);
    }

    public static final void y0(VideoActivity videoActivity, CompoundButton compoundButton, boolean z) {
        h.b0.d.l.f(videoActivity, "this$0");
        c.h.b.i.c.n("open_av_model", z);
        if (z) {
            videoActivity.showToast("影音模式已开启");
        } else {
            videoActivity.showToast("影音模式已关闭");
        }
    }

    public static final void z0(VideoActivity videoActivity, View view) {
        h.b0.d.l.f(videoActivity, "this$0");
        videoActivity.J();
    }

    public final void A0() {
        TopVideoView O = O();
        if (O == null) {
            return;
        }
        BaseDialogFragment b2 = new ListSelectDialog.a().q("选择播放器核心").a("IjkPlayer解码").a("ExoMediaPlayer解码").a("AndroidMediaPlayer解码(默认)").m(this.f808e).k(new l(O)).b();
        this.b = b2;
        if (b2 == null) {
            h.b0.d.l.u("listSelectDialog");
            b2 = null;
        }
        b2.q(getSupportFragmentManager());
    }

    public final void B0() {
        TopVideoView O = O();
        if (O == null) {
            return;
        }
        o.c().i(O);
        o.c().h(true);
    }

    public final void H(final String str, final String str2) {
        final c.t.a.s.e b2;
        try {
            Map a2 = c.t.a.s.l.b.c(str).a();
            if (a2 == null || !a2.containsKey("Content-Type") || (b2 = c.t.a.s.l.e.b(str, String.valueOf(a2.get("Content-Type")))) == null) {
                return;
            }
            c.h.b.o.i.b(new Runnable() {
                @Override
                public final void run() {
                    VideoActivity.I(str2, b2, str, this);
                }
            });
        } catch (Exception e2) {
            e2.printStackTrace();
        }
    }

    public final void J() {
        if (this.f807d == null) {
            return;
        }
        c.h.b.n.b.g().f(new Runnable() {
            @Override
            public final void run() {
                VideoActivity.K(VideoActivity.this);
            }
        });
    }

    public final void L() {
        try {
            if (Build.VERSION.SDK_INT < 23) {
                B0();
            } else if (Settings.canDrawOverlays(this)) {
                B0();
            } else {
                new ConfirmDialog.a().v("提示").r("视频悬浮需要应用显示悬浮窗权限").k("取消").n("去设置").m(new d()).a().q(getSupportFragmentManager());
            }
        } catch (Exception e2) {
            e2.printStackTrace();
        }
    }

    public final void M(boolean z) {
        int b2 = r0.a.b(z ? R$color.c_333 : R$color.c_999);
        ImageView imageView = this.f816m;
        LinearLayout linearLayout = null;
        if (imageView == null) {
            h.b0.d.l.u("floatingPlayIv");
            imageView = null;
        }
        imageView.setColorFilter(b2);
        TextView textView = this.n;
        if (textView == null) {
            h.b0.d.l.u("floatingPlayTv");
            textView = null;
        }
        textView.setTextColor(b2);
        LinearLayout linearLayout2 = this.o;
        if (linearLayout2 == null) {
            h.b0.d.l.u("floatingPlayLl");
            linearLayout2 = null;
        }
        linearLayout2.setEnabled(z);
        ImageView imageView2 = this.p;
        if (imageView2 == null) {
            h.b0.d.l.u("portraitScreenPlayIv");
            imageView2 = null;
        }
        imageView2.setColorFilter(b2);
        TextView textView2 = this.q;
        if (textView2 == null) {
            h.b0.d.l.u("portraitScreenPlayTv");
            textView2 = null;
        }
        textView2.setTextColor(b2);
        LinearLayout linearLayout3 = this.r;
        if (linearLayout3 == null) {
            h.b0.d.l.u("portraitScreenPlayLl");
            linearLayout3 = null;
        }
        linearLayout3.setEnabled(z);
        ImageView imageView3 = this.s;
        if (imageView3 == null) {
            h.b0.d.l.u("kernelSwitchIv");
            imageView3 = null;
        }
        imageView3.setColorFilter(b2);
        TextView textView3 = this.t;
        if (textView3 == null) {
            h.b0.d.l.u("kernelSwitchTv");
            textView3 = null;
        }
        textView3.setTextColor(b2);
        LinearLayout linearLayout4 = this.u;
        if (linearLayout4 == null) {
            h.b0.d.l.u("kernelSwitchLl");
            linearLayout4 = null;
        }
        linearLayout4.setEnabled(z);
        ImageView imageView4 = this.v;
        if (imageView4 == null) {
            h.b0.d.l.u("dlnaScreenIv");
            imageView4 = null;
        }
        imageView4.setColorFilter(b2);
        TextView textView4 = this.w;
        if (textView4 == null) {
            h.b0.d.l.u("dlnaScreenTv");
            textView4 = null;
        }
        textView4.setTextColor(b2);
        LinearLayout linearLayout5 = this.x;
        if (linearLayout5 == null) {
            h.b0.d.l.u("dlnaScreenLl");
            linearLayout5 = null;
        }
        linearLayout5.setEnabled(z);
        ImageView imageView5 = this.y;
        if (imageView5 == null) {
            h.b0.d.l.u("tsIv");
            imageView5 = null;
        }
        imageView5.setColorFilter(b2);
        TextView textView5 = this.z;
        if (textView5 == null) {
            h.b0.d.l.u("tsTv");
            textView5 = null;
        }
        textView5.setTextColor(b2);
        TextView textView6 = this.A;
        if (textView6 == null) {
            h.b0.d.l.u("tsTipsTv");
            textView6 = null;
        }
        textView6.setTextColor(b2);
        LinearLayout linearLayout6 = this.B;
        if (linearLayout6 == null) {
            h.b0.d.l.u("timesSpeedLl");
        } else {
            linearLayout = linearLayout6;
        }
        linearLayout.setEnabled(z);
    }

    public final Integer[] N() {
        SnifferVideoInfo snifferVideoInfo = this.f807d;
        if (snifferVideoInfo == null) {
            return new Integer[]{-1, -1};
        }
        h.b0.d.l.d(snifferVideoInfo);
        int i2 = 0;
        for (VideoCatalogueEntitySubList videoCatalogueEntitySubList : snifferVideoInfo.getEpisode()) {
            int i3 = i2 + 1;
            if (i2 < 0) {
                h.w.k.p();
            }
            int i4 = 0;
            for (VideoCatalogueEntitySubListItem videoCatalogueEntitySubListItem : videoCatalogueEntitySubList) {
                int i5 = i4 + 1;
                if (i4 < 0) {
                    h.w.k.p();
                }
                String url = videoCatalogueEntitySubListItem.getUrl();
                SnifferVideoInfo snifferVideoInfo2 = this.f807d;
                h.b0.d.l.d(snifferVideoInfo2);
                if (TextUtils.equals(url, snifferVideoInfo2.getUrl())) {
                    return new Integer[]{Integer.valueOf(i2), Integer.valueOf(i4)};
                }
                i4 = i5;
            }
            i2 = i3;
        }
        return new Integer[]{-1, -1};
    }

    public final TopVideoView O() {
        TopVideoView b2 = s0.b(s0.d(this), TopVideoView.class.getCanonicalName());
        if (b2 instanceof TopVideoView) {
            return b2;
        }
        TopVideoView a2 = o.c().a();
        return a2 == null ? o.c().b() : a2;
    }

    public n getDataBindingConfig() {
        int i2 = R$layout.browser_av_video_activity;
        int i3 = x0.f126c;
        ViewModel viewModel = this.f806c;
        if (viewModel == null) {
            h.b0.d.l.u("viewModel");
            viewModel = null;
        }
        return new n(i2, i3, viewModel);
    }

    public void initViewModel() {
        VideoViewModel activityScopeViewModel = getActivityScopeViewModel(VideoViewModel.class);
        h.b0.d.l.e(activityScopeViewModel, "getActivityScopeViewMode…deoViewModel::class.java)");
        this.f806c = activityScopeViewModel;
    }

    public final void k0(int i2) {
        b bVar = this.f814k;
        b bVar2 = null;
        if (bVar == null) {
            h.b0.d.l.u("episodeAdapter");
            bVar = null;
        }
        final VideoCatalogueEntitySubListItem videoCatalogueEntitySubListItem = (VideoCatalogueEntitySubListItem) bVar.getItem(i2);
        b bVar3 = this.f814k;
        if (bVar3 == null) {
            h.b0.d.l.u("episodeAdapter");
        } else {
            bVar2 = bVar3;
        }
        bVar2.z0(i2);
        showLoadingDialog();
        c.h.b.n.b.g().f(new Runnable() {
            @Override
            public final void run() {
                VideoActivity.l0(VideoCatalogueEntitySubListItem.this);
            }
        });
    }

    public final void m0(List<VideoCatalogueEntitySubListItem> list) {
        b bVar = this.f814k;
        if (bVar == null) {
            h.b0.d.l.u("episodeAdapter");
            bVar = null;
        }
        bVar.o0(h.w.k.g());
    }

    public final void n0() {
        b bVar;
        b bVar2 = new b();
        this.f814k = bVar2;
        bVar2.setOnItemClickListener(new c.f.a.a.a.g.d() {
            public final void a(BaseQuickAdapter baseQuickAdapter, View view, int i2) {
                VideoActivity.u0(VideoActivity.this, baseQuickAdapter, view, i2);
            }
        });
        b bVar3 = this.f814k;
        if (bVar3 == null) {
            h.b0.d.l.u("episodeAdapter");
            bVar3 = null;
        }
        bVar3.setOnItemLongClickListener(new c.f.a.a.a.g.f() {
            public final boolean a(BaseQuickAdapter baseQuickAdapter, View view, int i2) {
                boolean v0;
                v0 = VideoActivity.v0(VideoActivity.this, baseQuickAdapter, view, i2);
                return v0;
            }
        });
        int i2 = R$id.recycler_view;
        findViewById(i2).setLayoutManager(new GridLayoutManager(this, 5));
        RecyclerView findViewById = findViewById(i2);
        RecyclerView.Adapter adapter = this.f814k;
        if (adapter == null) {
            h.b0.d.l.u("episodeAdapter");
            adapter = null;
        }
        findViewById.setAdapter(adapter);
        View inflate = LayoutInflater.from(this).inflate(R$layout.browser_av_video_head_layout, (ViewGroup) findViewById(i2), false);
        View findViewById2 = inflate.findViewById(R$id.iv_floating_play);
        h.b0.d.l.e(findViewById2, "headView.findViewById(R.id.iv_floating_play)");
        this.f816m = (ImageView) findViewById2;
        View findViewById3 = inflate.findViewById(R$id.tv_floating_play);
        h.b0.d.l.e(findViewById3, "headView.findViewById(R.id.tv_floating_play)");
        this.n = (TextView) findViewById3;
        int i3 = R$id.ll_floating_play;
        View findViewById4 = inflate.findViewById(i3);
        h.b0.d.l.e(findViewById4, "headView.findViewById(R.id.ll_floating_play)");
        this.o = (LinearLayout) findViewById4;
        View findViewById5 = inflate.findViewById(R$id.iv_portrait_screen_play);
        h.b0.d.l.e(findViewById5, "headView.findViewById(R.….iv_portrait_screen_play)");
        this.p = (ImageView) findViewById5;
        View findViewById6 = inflate.findViewById(R$id.tv_portrait_screen_play);
        h.b0.d.l.e(findViewById6, "headView.findViewById(R.….tv_portrait_screen_play)");
        this.q = (TextView) findViewById6;
        int i4 = R$id.ll_portrait_screen_play;
        View findViewById7 = inflate.findViewById(i4);
        h.b0.d.l.e(findViewById7, "headView.findViewById(R.….ll_portrait_screen_play)");
        this.r = (LinearLayout) findViewById7;
        View findViewById8 = inflate.findViewById(R$id.iv_kernel_switch);
        h.b0.d.l.e(findViewById8, "headView.findViewById(R.id.iv_kernel_switch)");
        this.s = (ImageView) findViewById8;
        View findViewById9 = inflate.findViewById(R$id.tv_kernel_switch);
        h.b0.d.l.e(findViewById9, "headView.findViewById(R.id.tv_kernel_switch)");
        this.t = (TextView) findViewById9;
        int i5 = R$id.ll_kernel_switch;
        View findViewById10 = inflate.findViewById(i5);
        h.b0.d.l.e(findViewById10, "headView.findViewById(R.id.ll_kernel_switch)");
        this.u = (LinearLayout) findViewById10;
        View findViewById11 = inflate.findViewById(R$id.iv_dlna_screen);
        h.b0.d.l.e(findViewById11, "headView.findViewById(R.id.iv_dlna_screen)");
        this.v = (ImageView) findViewById11;
        View findViewById12 = inflate.findViewById(R$id.tv_dlna_screen);
        h.b0.d.l.e(findViewById12, "headView.findViewById(R.id.tv_dlna_screen)");
        this.w = (TextView) findViewById12;
        int i6 = R$id.ll_dlna_screen;
        View findViewById13 = inflate.findViewById(i6);
        h.b0.d.l.e(findViewById13, "headView.findViewById(R.id.ll_dlna_screen)");
        this.x = (LinearLayout) findViewById13;
        View findViewById14 = inflate.findViewById(R$id.iv_ts);
        h.b0.d.l.e(findViewById14, "headView.findViewById(R.id.iv_ts)");
        this.y = (ImageView) findViewById14;
        View findViewById15 = inflate.findViewById(R$id.tv_ts);
        h.b0.d.l.e(findViewById15, "headView.findViewById(R.id.tv_ts)");
        this.z = (TextView) findViewById15;
        View findViewById16 = inflate.findViewById(R$id.tv_ts_tips);
        h.b0.d.l.e(findViewById16, "headView.findViewById(R.id.tv_ts_tips)");
        this.A = (TextView) findViewById16;
        int i7 = R$id.ll_times_speed;
        View findViewById17 = inflate.findViewById(i7);
        h.b0.d.l.e(findViewById17, "headView.findViewById(R.id.ll_times_speed)");
        this.B = (LinearLayout) findViewById17;
        YaCellView findViewById18 = inflate.findViewById(R$id.cv_av_line);
        h.b0.d.l.e(findViewById18, "headView.findViewById(R.id.cv_av_line)");
        this.D = findViewById18;
        View findViewById19 = inflate.findViewById(R$id.tv_video_title);
        h.b0.d.l.e(findViewById19, "headView.findViewById(R.id.tv_video_title)");
        this.f815l = (TextView) findViewById19;
        RecyclerView findViewById20 = inflate.findViewById(R$id.url_rv);
        int i8 = R$id.video_view;
        findViewById(i8).setAvLl((LinearLayout) findViewById(R$id.fl_video));
        SnifferVideoInfo snifferVideoInfo = this.f807d;
        if (snifferVideoInfo != null) {
            this.f811h = snifferVideoInfo.getTitle();
            TextView textView = this.f815l;
            if (textView == null) {
                h.b0.d.l.u("videoTitleTv");
                textView = null;
            }
            textView.setText(snifferVideoInfo.getTitle());
            YaCellView yaCellView = this.D;
            if (yaCellView == null) {
                h.b0.d.l.u("avLineCv");
                yaCellView = null;
            }
            yaCellView.setValueText(h.b0.d.l.m("线路", Integer.valueOf(N()[0].intValue() + 1)));
            RelativeLayout relativeLayout = this.D;
            if (relativeLayout == null) {
                h.b0.d.l.u("avLineCv");
                relativeLayout = null;
            }
            relativeLayout.setOnClickListener(new View.OnClickListener() {
                @Override
                public final void onClick(View view) {
                    VideoActivity.w0(VideoActivity.this, view);
                }
            });
            TopVideoController topVideoController = new TopVideoController(this);
            topVideoController.setVideoLongClickListener(new j());
            topVideoController.a(snifferVideoInfo.getTitle(), false, true);
            findViewById(i8).setVideoController(topVideoController);
            if (!snifferVideoInfo.getUrlList().isEmpty()) {
                findViewById(i8).setTitle(snifferVideoInfo.getTitle().length() == 0 ? String.valueOf(System.currentTimeMillis()) : snifferVideoInfo.getTitle());
                findViewById(i8).setUrl((String) s.D(snifferVideoInfo.getUrlList()));
                int i9 = this.f808e;
                if (i9 == 0) {
                    j0.c(findViewById(i8));
                } else if (i9 == 1) {
                    j0.b(findViewById(i8));
                } else if (i9 == 2) {
                    j0.a(findViewById(i8));
                }
                findViewById(i8).start();
            }
            this.f813j = new VideoUrlAdapter(this.f811h);
            String url = snifferVideoInfo.getUrl();
            if (url == null || url.length() == 0) {
                VideoUrlAdapter videoUrlAdapter = this.f813j;
                if (videoUrlAdapter == null) {
                    h.b0.d.l.u("adapter");
                    videoUrlAdapter = null;
                }
                videoUrlAdapter.o0(h.w.j.b(""));
            } else {
                VideoUrlAdapter videoUrlAdapter2 = this.f813j;
                if (videoUrlAdapter2 == null) {
                    h.b0.d.l.u("adapter");
                    videoUrlAdapter2 = null;
                }
                String url2 = snifferVideoInfo.getUrl();
                h.b0.d.l.d(url2);
                videoUrlAdapter2.o0(h.w.j.b(url2));
            }
            findViewById20.setLayoutManager(new LinearLayoutManager(this, 1, false));
            RecyclerView.Adapter adapter2 = this.f813j;
            if (adapter2 == null) {
                h.b0.d.l.u("adapter");
                adapter2 = null;
            }
            findViewById20.setAdapter(adapter2);
            c.h.b.o.i.c(new Runnable() {
                @Override
                public final void run() {
                    VideoActivity.x0(VideoActivity.this);
                }
            }, 50L);
        }
        YaCellView findViewById21 = inflate.findViewById(R$id.cv_av_mode);
        h.b0.d.l.e(findViewById21, "headView.findViewById(R.id.cv_av_mode)");
        YaCellView yaCellView2 = findViewById21;
        this.C = yaCellView2;
        if (yaCellView2 == null) {
            h.b0.d.l.u("avModeCv");
            yaCellView2 = null;
        }
        yaCellView2.setSwitchChecked(c.h.b.i.c.b("open_av_model", false));
        YaCellView yaCellView3 = this.C;
        if (yaCellView3 == null) {
            h.b0.d.l.u("avModeCv");
            yaCellView3 = null;
        }
        yaCellView3.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public final void onCheckedChanged(CompoundButton compoundButton, boolean z) {
                VideoActivity.y0(VideoActivity.this, compoundButton, z);
            }
        });
        inflate.findViewById(R$id.ll_download).setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                VideoActivity.z0(VideoActivity.this, view);
            }
        });
        inflate.findViewById(i3).setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                VideoActivity.o0(VideoActivity.this, view);
            }
        });
        inflate.findViewById(i7).setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                VideoActivity.p0(VideoActivity.this, view);
            }
        });
        inflate.findViewById(i4).setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                VideoActivity.q0(VideoActivity.this, view);
            }
        });
        inflate.findViewById(i5).setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                VideoActivity.r0(VideoActivity.this, view);
            }
        });
        inflate.findViewById(i6).setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                VideoActivity.s0(VideoActivity.this, view);
            }
        });
        b bVar4 = this.f814k;
        if (bVar4 == null) {
            h.b0.d.l.u("episodeAdapter");
            bVar = null;
        } else {
            bVar = bVar4;
        }
        h.b0.d.l.e(inflate, "headView");
        BaseQuickAdapter.n0(bVar, inflate, 0, 0, 6, (Object) null);
        SnifferVideoInfo snifferVideoInfo2 = this.f807d;
        if (snifferVideoInfo2 != null && (!snifferVideoInfo2.getEpisode().isEmpty())) {
            final Integer[] N = N();
            if (snifferVideoInfo2.getEpisode().size() > 0) {
                if (N[0].intValue() < 0 || snifferVideoInfo2.getEpisode().size() <= N[0].intValue()) {
                    VideoCatalogueEntitySubList videoCatalogueEntitySubList = snifferVideoInfo2.getEpisode().get(0);
                    h.b0.d.l.e(videoCatalogueEntitySubList, "it.episode[0]");
                    m0(videoCatalogueEntitySubList);
                } else {
                    VideoCatalogueEntitySubList videoCatalogueEntitySubList2 = snifferVideoInfo2.getEpisode().get(N[0].intValue());
                    h.b0.d.l.e(videoCatalogueEntitySubList2, "it.episode[lineAndEpisode[0]]");
                    m0(videoCatalogueEntitySubList2);
                }
                c.h.b.o.i.c(new Runnable() {
                    @Override
                    public final void run() {
                        VideoActivity.t0(VideoActivity.this, N);
                    }
                }, 100L);
            }
        }
    }

    public void onActivityResult(int i2, int i3, Intent intent) {
        if (i2 == 2223) {
            if (Build.VERSION.SDK_INT < 23 || Settings.canDrawOverlays(this)) {
                B0();
                return;
            }
            return;
        }
        String A = SelectFilePathActivity.A(intent, i2, i3);
        if (A == null || A.length() == 0) {
            super/*androidx.fragment.app.FragmentActivity*/.onActivityResult(i2, i3, intent);
        } else {
            c.o.a.a.a("select_download_path").b(h.b0.d.l.m(A, "/"));
        }
    }

    @SuppressLint({"SourceLockedOrientationActivity"})
    public void onBackPressed() {
        final TopVideoView O = O();
        if (O == null || O.onBackPressed()) {
            super/*androidx.activity.ComponentActivity*/.onBackPressed();
            return;
        }
        boolean isFullScreen = O.isFullScreen();
        if (!isFullScreen) {
            super/*androidx.activity.ComponentActivity*/.onBackPressed();
            return;
        }
        setRequestedOrientation(1);
        O.stopFullScreen();
        o.c().g((TopVideoView) null);
        if (o.c().e()) {
            o.c().j(O);
        }
        if (o.c().e()) {
            c.h.b.o.i.c(new Runnable() {
                @Override
                public final void run() {
                    VideoActivity.h0(O);
                }
            }, 100L);
        } else if (isFullScreen) {
            c.t.a.x.i.q.h(O, false, O.getAvLl() != null);
        }
    }

    @SuppressLint({"SetTextI18n"})
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        c.h.a.g.a.a(this, false, -16777216, false);
        c.h.b.c.a.a("video_speed").observe(this, new Observer() {
            public final void onChanged(Object obj) {
                VideoActivity.i0(VideoActivity.this, (Float) obj);
            }
        });
        String[] strArr = {"dlna_screen_"};
        final e eVar = new e();
        Observer observer = new Observer() {
            public final void onChanged(String str) {
                l.this.invoke(str);
            }
        };
        for (int i2 = 0; i2 < 1; i2++) {
            c.o.a.b.c b2 = c.o.a.a.b(strArr[i2], String.class);
            h.b0.d.l.e(b2, "get(tag, EVENT::class.java)");
            b2.c(this, observer);
        }
        String[] strArr2 = {"sniffing_video_notification"};
        final f fVar = new f();
        Observer observer2 = new Observer() {
            public final void onChanged(String str) {
                l.this.invoke(str);
            }
        };
        for (int i3 = 0; i3 < 1; i3++) {
            c.o.a.b.c b3 = c.o.a.a.b(strArr2[i3], String.class);
            h.b0.d.l.e(b3, "get(tag, EVENT::class.java)");
            b3.c(this, observer2);
        }
        String[] strArr3 = {"av_sniffing_video"};
        final g gVar = new g();
        Observer observer3 = new Observer() {
            public final void onChanged(f fVar2) {
                l.this.invoke(fVar2);
            }
        };
        for (int i4 = 0; i4 < 1; i4++) {
            c.o.a.b.c b4 = c.o.a.a.b(strArr3[i4], c.t.a.s.f.class);
            h.b0.d.l.e(b4, "get(tag, EVENT::class.java)");
            b4.c(this, observer3);
        }
        this.f807d = k0.a;
        ((ImageView) findViewById(R$id.iv_stick)).setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                VideoActivity.j0(VideoActivity.this, view);
            }
        });
        n0();
    }

    public void onDestroy() {
        super/*com.pocket.common.base.BaseActivity*/.onDestroy();
        Log.e("=====", "VideoActivity onDestroy");
        TopVideoView O = O();
        if (O != null) {
            if (h.b0.d.l.b(o.c().b(), O)) {
                o.c().g((TopVideoView) null);
            }
            if (o.c().d()) {
                O.setAvLl((LinearLayout) null);
            } else {
                O.setAvLl((LinearLayout) null);
                O.release();
                O.setVideoController((BaseVideoController) null);
            }
        }
        c.t.a.s.h.f().d();
    }

    public void onStop() {
        TopVideoView O;
        super/*androidx.appcompat.app.AppCompatActivity*/.onStop();
        if (o.c().d() || (O = O()) == null) {
            return;
        }
        O.pause();
    }
}