影视仓 v5.0.24版本的 MD5 值为:620341689ccdc375a3b86527e140060e

以下内容为反编译后的 LivePlayActivity.java 源代码,内容仅作参考


package com.github.tvbox.osc.ui.activity;

import android.animation.IntEvaluator;
import android.animation.ObjectAnimator;
import android.content.Intent;
import android.content.ServiceConnection;
import android.net.Uri;
import android.os.Handler;
import android.text.TextUtils;
import android.util.Base64;
import android.view.KeyEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.SeekBar;
import android.widget.TextView;
import android.widget.Toast;
import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModelProvider;
import androidx.media3.exoplayer.ExoPlayer;
import androidx.media3.exoplayer.rtsp.SessionDescription;
import com.androidx.a60;
import com.androidx.b50;
import com.androidx.bo;
import com.androidx.d50;
import com.androidx.e50;
import com.androidx.et;
import com.androidx.f50;
import com.androidx.fa;
import com.androidx.g50;
import com.androidx.h50;
import com.androidx.i;
import com.androidx.i50;
import com.androidx.io;
import com.androidx.j50;
import com.androidx.k50;
import com.androidx.l1;
import com.androidx.l50;
import com.androidx.m50;
import com.androidx.n21;
import com.androidx.o0O00o00;
import com.androidx.o50;
import com.androidx.oo0oO0;
import com.androidx.or;
import com.androidx.p0;
import com.androidx.p50;
import com.androidx.q50;
import com.androidx.qp0;
import com.androidx.r50;
import com.androidx.s50;
import com.androidx.t;
import com.androidx.t40;
import com.androidx.tm;
import com.androidx.uf0;
import com.androidx.v40;
import com.androidx.ve0;
import com.androidx.y21;
import com.androidx.y40;
import com.androidx.yq;
import com.androidx.z40;
import com.androidx.z50;
import com.github.tvbox.osc.R$id;
import com.github.tvbox.osc.R$layout;
import com.github.tvbox.osc.R$raw;
import com.github.tvbox.osc.base.App;
import com.github.tvbox.osc.base.BaseActivity;
import com.github.tvbox.osc.bean.Epginfo;
import com.github.tvbox.osc.bean.LiveChannelGroup;
import com.github.tvbox.osc.bean.LiveChannelItem;
import com.github.tvbox.osc.bean.LiveDayListGroup;
import com.github.tvbox.osc.bean.LiveEpgDate;
import com.github.tvbox.osc.bean.LivePlayerManager;
import com.github.tvbox.osc.bean.LiveSettingGroup;
import com.github.tvbox.osc.bean.LiveSettingItem;
import com.github.tvbox.osc.bean.LiveSourceBean;
import com.github.tvbox.osc.player.controller.LiveController;
import com.github.tvbox.osc.ui.activity.LivePlayActivity;
import com.github.tvbox.osc.ui.tv.widget.ViewObj;
import com.owen.tvrecyclerview.widget.TvRecyclerView;
import com.owen.tvrecyclerview.widget.V7LinearLayoutManager;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import me.jessyan.autosize.utils.AutoSizeUtils;
import xyz.doikki.videoplayer.player.VideoView;
public class LivePlayActivity extends BaseActivity {
    public static int o00oO0O = 1;
    public static String o0ooOO0;
    public static int o0ooOOo;
    public VideoView OooO;
    public TextView OooOO0;
    public TextView OooOO0O;
    public View OooOO0o;
    public TvRecyclerView OooOOO;
    public TvRecyclerView OooOOO0;
    public t40 OooOOOO;
    public LinearLayout OooOOo;
    public a60 OooOOo0;
    public TvRecyclerView OooOOoo;
    public t40 OooOo0;
    public TvRecyclerView OooOo00;
    public s50 OooOo0O;
    public boolean OooOooo;
    public TextView Oooo;
    public l50 Oooo000;
    public l50 Oooo00O;
    public int Oooo00o;
    public boolean Oooo0O0;
    public View Oooo0OO;
    public LinearLayout Oooo0o;
    public View Oooo0o0;
    public TextView Oooo0oO;
    public TextView Oooo0oo;
    public TvRecyclerView OoooO;
    public TextView OoooO00;
    public TvRecyclerView OoooO0O;
    public t40 OoooOO0;
    public View Ooooo00;
    public TextView Ooooo0o;
    public TextView OooooO0;
    public SeekBar OooooOO;
    public View OooooOo;
    public LiveController Oooooo0;
    public long Ooooooo;
    public v40 o000oOoO;
    public z50 o00o0O;
    public t40 OooOOOo = new t40(1);
    public final ArrayList OooOo0o = new ArrayList();
    public final Handler OooOo = new Handler();
    public final ArrayList OooOoO0 = new ArrayList();
    public int OooOoO = -1;
    public int OooOoOO = 0;
    public LiveChannelItem OooOoo0 = new LiveChannelItem();
    public final LivePlayerManager OooOoo = new LivePlayerManager();
    public final ArrayList OooOooO = new ArrayList();
    public float Oooo0 = 0.0f;
    public final String OoooO0 = "https://epg.112114.xyz/";
    public final ArrayList OoooOOO = new ArrayList();
    public final SimpleDateFormat OoooOOo = new SimpleDateFormat("MM-dd");
    public final Date OoooOo0 = new Date();
    public boolean OoooOoO = false;
    public final SimpleDateFormat OoooOoo = new SimpleDateFormat("yyyy-MM-dd");
    public String Oooooo = "";
    public ArrayList OoooooO = new ArrayList();
    public final z40 o0OoOo0 = new Runnable(this) {
        public final LivePlayActivity OooO0o;

        {
            this.OooO0o = this;
        }

        @Override
        public final void run() {
            int i = r2;
            LivePlayActivity livePlayActivity = this.OooO0o;
            switch (i) {
                case 0:
                    int i2 = LivePlayActivity.o00oO0O;
                    livePlayActivity.OooOOoo();
                    return;
                default:
                    int i3 = LivePlayActivity.o00oO0O;
                    livePlayActivity.OooOo00();
                    return;
            }
        }
    };
    public final o50 ooOO = new o50(this);
    public final z40 o00O0O = new Runnable(this) {
        public final LivePlayActivity OooO0o;

        {
            this.OooO0o = this;
        }

        @Override
        public final void run() {
            int i = r2;
            LivePlayActivity livePlayActivity = this.OooO0o;
            switch (i) {
                case 0:
                    int i2 = LivePlayActivity.o00oO0O;
                    livePlayActivity.OooOOoo();
                    return;
                default:
                    int i3 = LivePlayActivity.o00oO0O;
                    livePlayActivity.OooOo00();
                    return;
            }
        }
    };
    public final p50 o00Oo0 = new p50(this);
    public final g50 o00Ooo = new g50(this, 0);
    public final g50 o00ooo = new g50(this, 1);
    public final g50 oo000o = new g50(this, 2);
    public final g50 o00oO0o = new g50(this, 3);

    public static void OooO(LivePlayActivity livePlayActivity, int i) {
        boolean OooOo0o;
        int OooOOOO = livePlayActivity.OooOo0.OooOOOO();
        if (OooOOOO < 4) {
            if (i != livePlayActivity.OooOo0O.OooOOOO()) {
                livePlayActivity.OooOo0O.OooOOOo(i, true, true);
            } else {
                return;
            }
        }
        if (OooOOOO != 0) {
            LivePlayerManager livePlayerManager = livePlayActivity.OooOoo;
            if (OooOOOO != 1) {
                if (OooOOOO != 2) {
                    if (OooOOOO != 3) {
                        if (OooOOOO == 4) {
                            if (i != 0) {
                                if (i != 1) {
                                    if (i != 2) {
                                        if (i != 3) {
                                            OooOo0o = false;
                                        } else {
                                            OooOo0o = true ^ i.OooOo0o("live_cross_group", Boolean.FALSE);
                                            i.OoooO0O("live_cross_group", Boolean.valueOf(OooOo0o));
                                        }
                                    } else {
                                        OooOo0o = true ^ i.OooOo0o("live_channel_reverse", Boolean.FALSE);
                                        i.OoooO0O("live_channel_reverse", Boolean.valueOf(OooOo0o));
                                    }
                                } else {
                                    OooOo0o = true ^ i.OooOo0o("live_show_net_speed", Boolean.FALSE);
                                    i.OoooO0O("live_show_net_speed", Boolean.valueOf(OooOo0o));
                                    livePlayActivity.Oooo00o();
                                }
                            } else {
                                OooOo0o = true ^ i.OooOo0o("live_show_time", Boolean.FALSE);
                                i.OoooO0O("live_show_time", Boolean.valueOf(OooOo0o));
                                livePlayActivity.Oooo0o0();
                            }
                            livePlayActivity.OooOo0O.OooOOOo(i, OooOo0o, false);
                        }
                    } else {
                        i.OoooO("live_connect_timeout", Integer.valueOf(i));
                    }
                } else {
                    livePlayActivity.OooO.OooOOO();
                    livePlayerManager.changeLivePlayerType(livePlayActivity.OooO, i, livePlayActivity.OooOoo0.getChannelName());
                    a60 a60Var = livePlayActivity.OooOOo0;
                    LiveChannelItem liveChannelItem = livePlayActivity.OooOoo0;
                    a60Var.getClass();
                    fa faVar = new fa(liveChannelItem, 1);
                    ExecutorService executorService = a60Var.OooO0O0;
                    if (executorService != null) {
                        executorService.shutdownNow();
                    }
                    ExecutorService newFixedThreadPool = Executors.newFixedThreadPool(2);
                    a60Var.OooO0O0 = newFixedThreadPool;
                    newFixedThreadPool.execute(new qp0(15, a60Var, faVar));
                }
            } else {
                livePlayerManager.changeLivePlayerScale(livePlayActivity.OooO, i, livePlayActivity.OooOoo0.getChannelName());
            }
        } else {
            livePlayActivity.OooOoo0.setSourceIndex(i);
            livePlayActivity.OooOoO(o00oO0O, livePlayActivity.OooOoO, true);
        }
        Handler handler = livePlayActivity.OooOo;
        z40 z40Var = livePlayActivity.o00O0O;
        handler.removeCallbacks(z40Var);
        handler.postDelayed(z40Var, 5000L);
    }

    public static String OooOO0o(int i) {
        int i2 = i / 1000;
        int i3 = i2 / 3600;
        int i4 = (i2 / 60) % 60;
        int i5 = i2 % 60;
        if (i3 > 0) {
            if (i4 > 9) {
                if (i5 > 9) {
                    return i3 + ":" + i4 + ":" + i5;
                }
                return i3 + ":" + i4 + ":0" + i5;
            } else if (i5 > 9) {
                return i3 + ":0" + i4 + ":" + i5;
            } else {
                return i3 + ":0" + i4 + ":0" + i5;
            }
        } else if (i4 > 9) {
            if (i5 > 9) {
                return i4 + ":" + i5;
            }
            return i4 + ":0" + i5;
        } else if (i5 > 9) {
            return SessionDescription.SUPPORTED_SDP_VERSION + i4 + ":" + i5;
        } else {
            return SessionDescription.SUPPORTED_SDP_VERSION + i4 + ":0" + i5;
        }
    }

    public static long OooOOo(String str, String str2) {
        long j;
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        long j2 = 0;
        try {
            j = simpleDateFormat.parse(str2).getTime();
        } catch (ParseException e) {
            e.printStackTrace();
            j = 0;
        }
        try {
            j2 = simpleDateFormat.parse(str).getTime();
        } catch (ParseException e2) {
            e2.printStackTrace();
        }
        return (j - j2) / 1000;
    }

    @Override
    public final int OooO0O0() {
        return R$layout.activity_live_play;
    }

    public final boolean OooOO0() {
        VideoView videoView = this.OooO;
        return videoView != null && ((double) videoView.getDuration()) > 90000.0d;
    }

    public final void OooOO0O(int i) {
        this.OooOOOo.OooOOo0(i);
        OooOoO(this.OooOOOO.OooOOOO(), i, false);
        if (this.OooOO0o.getVisibility() == 0) {
            Handler handler = this.OooOo;
            z40 z40Var = this.o0OoOo0;
            handler.removeCallbacks(z40Var);
            handler.postDelayed(z40Var, 5000L);
        }
    }

    public final int OooOOO() {
        if (t.OooOOO0(this.OoooooO)) {
            return -1;
        }
        int size = this.OoooooO.size() - 1;
        while (size >= 0 && new Date().compareTo(((Epginfo) this.OoooooO.get(size)).startdateTime) < 0) {
            size--;
        }
        if (size < 0 || new Date().compareTo(((Epginfo) this.OoooooO.get(size)).enddateTime) > 0) {
            return -1;
        }
        return size;
    }

    public final void OooOOO0(Date date) {
        String channelName = this.OooOoo0.getChannelName();
        if (TextUtils.isEmpty(channelName)) {
            return;
        }
        v40 v40Var = this.o000oOoO;
        Boolean valueOf = Boolean.valueOf(this.OooOoo0.getinclude_back());
        v40Var.getClass();
        v40Var.OooOo0 = valueOf.booleanValue();
        if (!this.OoooOoO && this.OooOoo0.getChannelName() != null) {
            this.Oooo0o.setVisibility(0);
            this.Oooo0oo.setText(this.OooOoo0.getChannelName());
            TextView textView = this.Oooo0oO;
            textView.setText("" + this.OooOoo0.getChannelNum());
            l50 l50Var = this.Oooo000;
            if (l50Var != null) {
                l50Var.cancel();
            }
            l50 l50Var2 = new l50(this, 7000L, 1);
            this.Oooo000 = l50Var2;
            l50Var2.start();
            LiveChannelItem liveChannelItem = this.OooOoo0;
            if (liveChannelItem != null && liveChannelItem.getSourceNum() > 0) {
                TextView textView2 = this.Oooo;
                textView2.setText("[线路" + (this.OooOoo0.getSourceIndex() + 1) + "/" + this.OooOoo0.getSourceNum() + "]");
            } else {
                this.Oooo.setText("1/1");
            }
            this.OoooO00.setVisibility(8);
            Handler handler = this.OooOo;
            g50 g50Var = this.oo000o;
            handler.removeCallbacks(g50Var);
            handler.post(g50Var);
        }
        uf0.OooO00o.OooO00o("epgAddress");
        ((yq) new yq(this.OoooO0 + "?ch=" + URLEncoder.encode(channelName) + "&date=" + this.OoooOoo.format(date)).tag("epgAddress")).execute(new m50(this, date));
    }

    public final ArrayList OooOOOO(int i) {
        ArrayList arrayList = this.OooOoO0;
        if (arrayList.isEmpty()) {
            return new ArrayList();
        }
        try {
            if (!OooOo(i)) {
                return ((LiveChannelGroup) arrayList.get(i)).getLiveChannels();
            }
            return new ArrayList();
        } catch (Exception unused) {
            y21.OooO0oO("接口数据异常");
            Oooo00O();
            return new ArrayList();
        }
    }

    public final Integer[] OooOOOo(int i) {
        int i2;
        int i3 = o00oO0O;
        int i4 = this.OooOoO;
        ArrayList arrayList = this.OooOoO0;
        if (i > 0) {
            i2 = i4 + 1;
            if (i2 >= OooOOOO(i3).size()) {
                if (i.OooOo0o("live_cross_group", Boolean.FALSE)) {
                    while (true) {
                        i3++;
                        if (i3 >= arrayList.size()) {
                            i3 = 0;
                        }
                        if (((LiveChannelGroup) arrayList.get(i3)).getGroupPassword().isEmpty() && i3 != o00oO0O) {
                            break;
                        }
                    }
                }
                i2 = 0;
            }
        } else {
            i2 = i4 - 1;
            if (i2 < 0) {
                if (i.OooOo0o("live_cross_group", Boolean.FALSE)) {
                    while (true) {
                        i3--;
                        if (i3 < 0) {
                            i3 = arrayList.size() - 1;
                        }
                        if (((LiveChannelGroup) arrayList.get(i3)).getGroupPassword().isEmpty() && i3 != o00oO0O) {
                            break;
                        }
                    }
                }
                i2 = OooOOOO(i3).size() - 1;
            }
        }
        return new Integer[]{Integer.valueOf(i3), Integer.valueOf(i2)};
    }

    public final String[] OooOOo0() {
        try {
            BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(getResources().openRawResource(R$raw.md5), StandardCharsets.UTF_8));
            StringBuilder sb = new StringBuilder();
            while (true) {
                String readLine = bufferedReader.readLine();
                if (readLine != null) {
                    sb.append(readLine);
                } else {
                    return sb.toString().split("==");
                }
            }
        } catch (IOException e) {
            e.printStackTrace();
            return new String[0];
        }
    }

    public final void OooOOoo() {
        if (this.OooOO0o.getVisibility() == 0) {
            ObjectAnimator ofObject = ObjectAnimator.ofObject(new ViewObj(this.OooOO0o, (ViewGroup.MarginLayoutParams) this.OooOO0o.getLayoutParams()), "marginLeft", new IntEvaluator(), 0, Integer.valueOf(-AutoSizeUtils.mm2px(this.OooO0o0, 570.0f)));
            ofObject.setDuration(200L);
            ofObject.addListener(new q50(this, 0));
            ofObject.start();
        }
    }

    public final boolean OooOo(int i) {
        boolean z;
        ArrayList arrayList = this.OooOoO0;
        if (arrayList.isEmpty() || i == -1 || or.OooOOO(OooOOo0()[0], OooOOo0()[1]).equals(this.Oooooo)) {
            return false;
        }
        try {
            if (((LiveChannelGroup) arrayList.get(i)).getGroupPassword().isEmpty()) {
                return false;
            }
            Iterator it = this.OooOooO.iterator();
            while (true) {
                if (it.hasNext()) {
                    if (((Integer) it.next()).intValue() == i) {
                        z = true;
                        break;
                    }
                } else {
                    z = false;
                    break;
                }
            }
            if (z) {
                return false;
            }
            return true;
        } catch (Exception unused) {
            y21.OooO0oO("接口数据异常");
            Oooo00O();
            return false;
        }
    }

    public final void OooOo0() {
        int i;
        String OooOooO = i.OooOooO("last_live_channel_name", "");
        ArrayList arrayList = this.OooOoO0;
        Iterator it = arrayList.iterator();
        int i2 = -1;
        int i3 = -1;
        while (it.hasNext()) {
            LiveChannelGroup liveChannelGroup = (LiveChannelGroup) it.next();
            Iterator<LiveChannelItem> it2 = liveChannelGroup.getLiveChannels().iterator();
            while (true) {
                if (it2.hasNext()) {
                    LiveChannelItem next = it2.next();
                    if (next.getChannelName().equals(OooOooO)) {
                        i2 = liveChannelGroup.getGroupIndex();
                        i3 = next.getChannelIndex();
                        continue;
                        break;
                    }
                }
            }
            if (i2 != -1) {
                break;
            }
        }
        if (i2 == -1) {
            Iterator it3 = arrayList.iterator();
            while (true) {
                if (it3.hasNext()) {
                    LiveChannelGroup liveChannelGroup2 = (LiveChannelGroup) it3.next();
                    if (liveChannelGroup2.getGroupPassword().isEmpty() && !liveChannelGroup2.getLiveChannels().isEmpty()) {
                        i = liveChannelGroup2.getGroupIndex();
                        break;
                    }
                } else {
                    i = -1;
                    break;
                }
            }
            if (i == -1) {
                i2 = 0;
            } else {
                i2 = i;
            }
            i3 = 0;
        }
        this.OooOoo.init(this.OooO);
        Oooo0o0();
        Oooo00o();
        this.OooOO0o.setVisibility(4);
        this.OooOOo.setVisibility(4);
        this.OooOOOO.OooOOO(arrayList);
        OooOooO(i2, i3, false);
    }

    public final void OooOo00() {
        ViewGroup.MarginLayoutParams marginLayoutParams = (ViewGroup.MarginLayoutParams) this.OooOOo.getLayoutParams();
        if (this.OooOOo.getVisibility() == 0) {
            ObjectAnimator ofObject = ObjectAnimator.ofObject(new ViewObj(this.OooOOo, marginLayoutParams), "marginRight", new IntEvaluator(), 0, Integer.valueOf(-this.OooOOo.getLayoutParams().width));
            ofObject.setDuration(200L);
            ofObject.addListener(new q50(this, 1));
            ofObject.start();
        }
    }

    public final boolean OooOo0O() {
        if (this.OooOoo0 == null && !OooOo(this.OooOoO)) {
            Toast.makeText(App.OooO00o(), "请先选择频道", 0).show();
            return false;
        }
        return true;
    }

    public final boolean OooOo0o() {
        boolean z;
        boolean z2;
        if (this.OooOOo.getVisibility() == 0) {
            z = true;
        } else {
            z = false;
        }
        if (z) {
            return true;
        }
        if (this.OooOO0o.getVisibility() == 0) {
            z2 = true;
        } else {
            z2 = false;
        }
        if (z2) {
            return true;
        }
        return false;
    }

    public final boolean OooOoO(int i, int i2, boolean z) {
        if ((i == o00oO0O && i2 == this.OooOoO && !z) || (z && this.OooOoo0.getSourceNum() == 1)) {
            return true;
        }
        VideoView videoView = this.OooO;
        if (videoView != null && !TextUtils.isEmpty(videoView.getPlayUrl())) {
            this.OooO.OooOOO();
        }
        if (!z) {
            o00oO0O = i;
            this.OooOoO = i2;
            if (OooOOOO(i).isEmpty()) {
                return false;
            }
            LiveChannelItem liveChannelItem = (LiveChannelItem) OooOOOO(o00oO0O).get(this.OooOoO);
            this.OooOoo0 = liveChannelItem;
            i.OoooOOO("last_live_channel_name", liveChannelItem.getChannelName());
            this.OooOoo.getLiveChannelPlayer(this.OooO, this.OooOoo0.getChannelName());
        }
        this.OoooOoO = false;
        LiveChannelItem liveChannelItem2 = this.OooOoo0;
        liveChannelItem2.setinclude_back(liveChannelItem2.getUrl().contains("PLTV/8888"));
        OooOOO0(new Date());
        a60 a60Var = this.OooOOo0;
        LiveChannelItem liveChannelItem3 = this.OooOoo0;
        a60Var.getClass();
        fa faVar = new fa(liveChannelItem3, 1);
        ExecutorService executorService = a60Var.OooO0O0;
        if (executorService != null) {
            executorService.shutdownNow();
        }
        ExecutorService newFixedThreadPool = Executors.newFixedThreadPool(2);
        a60Var.OooO0O0 = newFixedThreadPool;
        newFixedThreadPool.execute(new qp0(15, a60Var, faVar));
        return true;
    }

    public final void OooOoO0(int i, int i2) {
        this.OooOOOo.OooOOO(OooOOOO(i));
        if (i == o00oO0O) {
            int i3 = this.OooOoO;
            if (i3 > -1) {
                this.OooOOO.scrollToPosition(i3);
            }
            this.OooOOOo.OooOOo0(this.OooOoO);
        } else {
            this.OooOOO.scrollToPosition(0);
            this.OooOOOo.OooOOo0(0);
        }
        if (i2 > -1) {
            OooOO0O(i2);
            OooOoO(i, i2, false);
        }
    }

    public final void OooOoOO() {
        if (!OooOo0O()) {
            return;
        }
        Integer[] OooOOOo = OooOOOo(1);
        OooOoO(OooOOOo[0].intValue(), OooOOOo[1].intValue(), false);
    }

    public final void OooOoo() {
        if (!OooOo0O()) {
            return;
        }
        Integer[] OooOOOo = OooOOOo(-1);
        OooOoO(OooOOOo[0].intValue(), OooOOOo[1].intValue(), false);
    }

    public final void OooOoo0() {
        if (!OooOo0O()) {
            return;
        }
        this.OooOoo0.nextSource();
        OooOoO(o00oO0O, this.OooOoO, true);
    }

    public final void OooOooO(int i, int i2, boolean z) {
        try {
            this.OooOooo = ((LiveChannelGroup) this.OooOOOO.OooOOO0.get(i)).isCollected;
        } catch (Exception unused) {
            y21.OooO0oO("接口数据异常");
            Oooo00O();
        }
        if (z) {
            this.OooOOOO.OooOOOo(i);
            t40 t40Var = this.OooOOOo;
            int i3 = t40Var.OooOo00;
            t40Var.OooOo00 = -1;
            if (i3 != -1) {
                t40Var.notifyItemChanged(i3);
            }
            int i4 = t40Var.OooOo00;
            if (i4 != -1) {
                t40Var.notifyItemChanged(i4);
            } else {
                int i5 = t40Var.OooOOoo;
                if (i5 != -1) {
                    t40Var.notifyItemChanged(i5);
                }
            }
        }
        if ((i > -1 && i != this.OooOOOO.OooOOOO()) || OooOo(i)) {
            this.OooOOOO.OooOOo(i);
            if (OooOo(i)) {
                Oooo0(i, i2);
                return;
            }
            OooOoO0(i, i2);
        }
        if (this.OooOO0o.getVisibility() == 0) {
            Handler handler = this.OooOo;
            z40 z40Var = this.o0OoOo0;
            handler.removeCallbacks(z40Var);
            handler.postDelayed(z40Var, 5000L);
        }
    }

    public final void OooOooo(int i, boolean z) {
        if (z) {
            this.OooOo0.OooOOOo(i);
            s50 s50Var = this.OooOo0O;
            int i2 = s50Var.OooOOo;
            s50Var.OooOOo = -1;
            if (i2 != -1) {
                s50Var.notifyItemChanged(i2);
            }
            int i3 = s50Var.OooOOo;
            if (i3 != -1) {
                s50Var.notifyItemChanged(i3);
            }
        }
        if (i == 5) {
            Oooo00O();
        }
        if (i != this.OooOo0.OooOOOO() && i >= -1) {
            this.OooOo0.OooOOo(i);
            this.OooOo0O.OooOOO(((LiveSettingGroup) this.OooOo0o.get(i)).getLiveSettingItems());
            int i4 = 0;
            if (i != 0) {
                LivePlayerManager livePlayerManager = this.OooOoo;
                if (i != 1) {
                    if (i == 2) {
                        this.OooOo0O.OooOOOo(livePlayerManager.getLivePlayerType(), true, true);
                    }
                } else {
                    this.OooOo0O.OooOOOo(livePlayerManager.getLivePlayerScale(), true, true);
                }
            } else {
                LiveChannelItem liveChannelItem = this.OooOoo0;
                if (liveChannelItem != null) {
                    this.OooOo0O.OooOOOo(liveChannelItem.getSourceIndex(), true, false);
                }
            }
            int OooOOOO = this.OooOo0O.OooOOOO();
            if (OooOOOO >= 0) {
                i4 = OooOOOO;
            }
            this.OooOo00.scrollToPosition(i4);
            Handler handler = this.OooOo;
            z40 z40Var = this.o00O0O;
            handler.removeCallbacks(z40Var);
            handler.postDelayed(z40Var, 5000L);
        }
    }

    public final void Oooo0(int i, int i2) {
        if (!isDestroyed() && !isFinishing()) {
            if (this.OooOO0o.getVisibility() == 0) {
                this.OooOo.removeCallbacks(this.o0OoOo0);
            }
            y40 y40Var = new y40(this);
            y40Var.setOnListener(new p0(this, i, i2));
            y40Var.show();
        }
    }

    public final void Oooo000() {
        int visibility = this.OooOOo.getVisibility();
        Handler handler = this.OooOo;
        if (visibility == 0) {
            z40 z40Var = this.o00O0O;
            handler.removeCallbacks(z40Var);
            handler.post(z40Var);
        }
        if (this.OooOO0o.getVisibility() == 4) {
            this.OooOOO.setSelection(this.OooOoO);
            this.OooOOO0.setSelection(o00oO0O);
            handler.postDelayed(this.ooOO, 200L);
            return;
        }
        z40 z40Var2 = this.o0OoOo0;
        handler.removeCallbacks(z40Var2);
        handler.post(z40Var2);
    }

    public final void Oooo00O() {
        if (!isFinishing() && !isDestroyed()) {
            if (this.o00o0O == null) {
                this.o00o0O = new z50(this);
            }
            if (!this.o00o0O.isShowing()) {
                this.o00o0O.show();
            }
        }
    }

    public final void Oooo00o() {
        boolean OooOo0o = i.OooOo0o("live_show_net_speed", Boolean.FALSE);
        Handler handler = this.OooOo;
        g50 g50Var = this.oo000o;
        if (OooOo0o) {
            handler.removeCallbacks(g50Var);
            handler.post(g50Var);
            this.OooOO0O.setVisibility(0);
            return;
        }
        handler.removeCallbacks(g50Var);
        this.OooOO0O.setVisibility(8);
    }

    public final void Oooo0O0() {
        if (this.OooO.getDuration() < 90000.0d) {
            return;
        }
        this.Ooooo00.setVisibility(0);
        this.OooOo.postDelayed(this.o00oO0o, 1000L);
        this.OooooOO.setProgress((int) this.OooO.getCurrentPosition());
        this.Ooooo0o.setText(OooOO0o((int) this.OooO.getCurrentPosition()));
        l50 l50Var = this.Oooo00O;
        if (l50Var != null) {
            l50Var.cancel();
        }
        l50 l50Var2 = new l50(this, 5000L, 0);
        this.Oooo00O = l50Var2;
        l50Var2.start();
    }

    public final void Oooo0OO() {
        int visibility = this.OooOO0o.getVisibility();
        Handler handler = this.OooOo;
        if (visibility == 0) {
            z40 z40Var = this.o0OoOo0;
            handler.removeCallbacks(z40Var);
            handler.post(z40Var);
        }
        if (this.OooOOo.getVisibility() == 4) {
            LiveChannelItem liveChannelItem = this.OooOoo0;
            ArrayList arrayList = this.OooOo0o;
            if (liveChannelItem != null) {
                ArrayList<String> channelSourceNames = liveChannelItem.getChannelSourceNames();
                ArrayList<LiveSettingItem> arrayList2 = new ArrayList<>();
                for (int i = 0; i < channelSourceNames.size(); i++) {
                    LiveSettingItem liveSettingItem = new LiveSettingItem();
                    liveSettingItem.setItemIndex(i);
                    liveSettingItem.setItemName(channelSourceNames.get(i));
                    arrayList2.add(liveSettingItem);
                }
                ((LiveSettingGroup) arrayList.get(0)).setLiveSettingItems(arrayList2);
            }
            this.OooOo0.OooOOO(arrayList);
            OooOooo(0, false);
            LiveChannelItem liveChannelItem2 = this.OooOoo0;
            if (liveChannelItem2 != null) {
                this.OooOo00.scrollToPosition(liveChannelItem2.getSourceIndex());
            }
            handler.postDelayed(this.o00Oo0, 200L);
            return;
        }
        z40 z40Var2 = this.o00O0O;
        handler.removeCallbacks(z40Var2);
        handler.post(z40Var2);
    }

    public final void Oooo0o0() {
        boolean OooOo0o = i.OooOo0o("live_show_time", Boolean.FALSE);
        Handler handler = this.OooOo;
        g50 g50Var = this.o00ooo;
        if (OooOo0o) {
            handler.post(g50Var);
            this.OooOO0.setVisibility(0);
            return;
        }
        handler.removeCallbacks(g50Var);
        this.OooOO0.setVisibility(8);
    }

    public void divLoadEpgLeft(View view) {
        this.OooOOO0.setVisibility(0);
        this.OoooO.setVisibility(8);
        this.OoooO0O.setVisibility(8);
        this.Oooo0o0.setVisibility(8);
        this.Oooo0OO.setVisibility(0);
    }

    public void divLoadEpgRight(View view) {
        this.OooOOO0.setVisibility(8);
        this.OoooO.setVisibility(0);
        this.OoooO0O.setVisibility(0);
        this.Oooo0o0.setVisibility(0);
        this.Oooo0OO.setVisibility(8);
        this.o000oOoO.OooOOO(this.OoooooO);
        int OooOOO = OooOOO();
        if (OooOOO != -1) {
            this.OoooO.OooO0oo(OooOOO, 0, true, false);
        }
    }

    @Override
    public final void init() {
        SimpleDateFormat simpleDateFormat;
        int OooOoO;
        long j;
        OooO0o0(findViewById(R$id.live_root));
        OooO0oO();
        this.OooO = (VideoView) findViewById(R$id.mVideoView);
        a60 a60Var = (a60) new ViewModelProvider(this).get(a60.class);
        this.OooOOo0 = a60Var;
        a60Var.OooO00o.observe(this, new Observer(this) {
            public final LivePlayActivity OooO0O0;

            {
                this.OooO0O0 = this;
            }

            @Override
            public final void onChanged(Object obj) {
                int i = r2;
                LivePlayActivity livePlayActivity = this.OooO0O0;
                switch (i) {
                    case 0:
                        int i2 = LivePlayActivity.o00oO0O;
                        livePlayActivity.getClass();
                        if (obj instanceof String) {
                            livePlayActivity.OooO.setUrl((String) obj);
                            livePlayActivity.OooO.start();
                            return;
                        }
                        return;
                    default:
                        List list = (List) obj;
                        int i3 = LivePlayActivity.o00oO0O;
                        livePlayActivity.getClass();
                        if (list.isEmpty()) {
                            livePlayActivity.OooO0oo();
                            App app = App.OooOO0;
                            Toast.makeText(n21.OooOooo(), "频道列表为空", 0).show();
                            livePlayActivity.Oooo00O();
                            return;
                        }
                        livePlayActivity.OooO0oo();
                        ArrayList arrayList = livePlayActivity.OooOoO0;
                        arrayList.clear();
                        arrayList.addAll(list);
                        livePlayActivity.OooOo0();
                        return;
                }
            }
        });
        this.OooOOo0.OooO0OO.observe(this, new Observer(this) {
            public final LivePlayActivity OooO0O0;

            {
                this.OooO0O0 = this;
            }

            @Override
            public final void onChanged(Object obj) {
                int i = r2;
                LivePlayActivity livePlayActivity = this.OooO0O0;
                switch (i) {
                    case 0:
                        int i2 = LivePlayActivity.o00oO0O;
                        livePlayActivity.getClass();
                        if (obj instanceof String) {
                            livePlayActivity.OooO.setUrl((String) obj);
                            livePlayActivity.OooO.start();
                            return;
                        }
                        return;
                    default:
                        List list = (List) obj;
                        int i3 = LivePlayActivity.o00oO0O;
                        livePlayActivity.getClass();
                        if (list.isEmpty()) {
                            livePlayActivity.OooO0oo();
                            App app = App.OooOO0;
                            Toast.makeText(n21.OooOooo(), "频道列表为空", 0).show();
                            livePlayActivity.Oooo00O();
                            return;
                        }
                        livePlayActivity.OooO0oo();
                        ArrayList arrayList = livePlayActivity.OooOoO0;
                        arrayList.clear();
                        arrayList.addAll(list);
                        livePlayActivity.OooOo0();
                        return;
                }
            }
        });
        this.OooOO0o = findViewById(R$id.tvLeftChannnelListLayout);
        this.OooOOO0 = (TvRecyclerView) findViewById(R$id.mGroupGridView);
        this.OooOOO = (TvRecyclerView) findViewById(R$id.mChannelGridView);
        this.OooOOo = (LinearLayout) findViewById(R$id.tvRightSettingLayout);
        this.OooOOoo = (TvRecyclerView) findViewById(R$id.mSettingGroupView);
        this.OooOo00 = (TvRecyclerView) findViewById(R$id.mSettingItemView);
        this.OooOO0 = (TextView) findViewById(R$id.tvTime);
        this.OooOO0O = (TextView) findViewById(R$id.tvNetSpeed);
        this.Oooo0oo = (TextView) findViewById(R$id.tv_channel_bar_name);
        this.Oooo0oO = (TextView) findViewById(R$id.tv_channel_bottom_number);
        this.Oooo = (TextView) findViewById(R$id.tv_source);
        this.OoooO00 = (TextView) findViewById(R$id.tv_show);
        this.Oooo0o = (LinearLayout) findViewById(R$id.ll_epg);
        ViewGroup viewGroup = (ViewGroup) findViewById(R$id.live_root);
        this.Oooo0OO = findViewById(R$id.divLoadEpg);
        this.Oooo0o0 = findViewById(R$id.divLoadEpgleft);
        this.OoooO0O = (TvRecyclerView) findViewById(R$id.mEpgDateGridView);
        i.OoooOOO("now_date", this.OoooOoo.format(new Date()));
        this.OoooO = (TvRecyclerView) findViewById(R$id.lv_epg);
        this.OooooOO = (SeekBar) findViewById(R$id.pb_progressbar);
        this.Ooooo0o = (TextView) findViewById(R$id.tv_currentpos);
        this.Ooooo00 = findViewById(R$id.backcontroller);
        this.OooooO0 = (TextView) findViewById(R$id.tv_duration);
        View findViewById = findViewById(R$id.iv_playpause);
        this.OooooOo = findViewById;
        findViewById.setOnClickListener(new et(this, 1));
        this.Oooo0o0.setOnFocusChangeListener(new tm(this, 1));
        this.Oooo0OO.setOnFocusChangeListener(new b50(this, 0));
        this.OooooOO.setOnSeekBarChangeListener(new bo(this, 2));
        this.OooooOO.setOnKeyListener(new View.OnKeyListener() {
            @Override
            public final boolean onKey(View view, int i, KeyEvent keyEvent) {
                int i2 = LivePlayActivity.o00oO0O;
                LivePlayActivity livePlayActivity = LivePlayActivity.this;
                livePlayActivity.getClass();
                if (keyEvent.getAction() == 0) {
                    if (i == 23 || i == 66) {
                        if (livePlayActivity.OooO.isPlaying()) {
                            livePlayActivity.OooO.pause();
                            livePlayActivity.Oooo000.cancel();
                            return false;
                        }
                        livePlayActivity.OooO.start();
                        livePlayActivity.Oooo000.start();
                        return false;
                    }
                    return false;
                }
                return false;
            }
        });
        this.OoooO0O.setHasFixedSize(true);
        this.OoooO0O.setLayoutManager(new V7LinearLayoutManager(this, 1));
        this.OoooOO0 = new t40(2);
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(new Date());
        this.OoooO0O.setAdapter(this.OoooOO0);
        calendar.add(5, 1);
        ArrayList arrayList = new ArrayList();
        int i = 7;
        while (true) {
            simpleDateFormat = this.OoooOOo;
            if (i < 0) {
                break;
            }
            Date time = calendar.getTime();
            LiveEpgDate liveEpgDate = new LiveEpgDate();
            liveEpgDate.setIndex(i);
            liveEpgDate.setDatePresented(simpleDateFormat.format(time));
            liveEpgDate.setDateParamVal(time);
            arrayList.add(0, liveEpgDate);
            calendar.add(5, -1);
            i--;
        }
        this.OoooOO0.OooOOO(arrayList);
        this.OoooO0O.addOnScrollListener(new f50(this));
        this.OoooO0O.setOnItemListener(new e50(this, 2));
        this.OoooOO0.setOnItemClickListener(new e50(this, 3));
        this.OoooO.setHasFixedSize(true);
        this.OoooO.setLayoutManager(new V7LinearLayoutManager(this, 1));
        v40 v40Var = new v40();
        this.o000oOoO = v40Var;
        this.OoooO.setAdapter(v40Var);
        this.OoooO.addOnScrollListener(new r50(this));
        this.OoooO.setOnItemListener(new e50(this, 0));
        this.o000oOoO.setOnItemClickListener(new e50(this, 1));
        ArrayList arrayList2 = this.OoooOOO;
        arrayList2.clear();
        Date date = new Date(this.OoooOo0.getTime() - 518400000);
        int i2 = 0;
        while (i2 < 8) {
            LiveDayListGroup liveDayListGroup = new LiveDayListGroup();
            String format = simpleDateFormat.format(new Date(date.getTime() + (i2 * 24 * 60 * 60 * 1000)));
            liveDayListGroup.setGroupIndex(i2);
            liveDayListGroup.setGroupName(format);
            arrayList2.add(liveDayListGroup);
            i2++;
            date = date;
        }
        LiveController liveController = new LiveController(this);
        this.Oooooo0 = liveController;
        liveController.setListener(new e50(this, 4));
        this.Oooooo0.setCanChangePosition(true);
        this.Oooooo0.setEnableInNormal(true);
        this.Oooooo0.setGestureEnabled(true);
        this.Oooooo0.setDoubleTapTogglePlayEnabled(false);
        this.Oooooo0.setOnDoubleTapListener(new d50(this));
        this.OooO.setVideoController(this.Oooooo0);
        this.OooOOO0.setHasFixedSize(true);
        this.OooOOO0.setLayoutManager(new V7LinearLayoutManager(this, 1));
        t40 t40Var = new t40(0);
        this.OooOOOO = t40Var;
        this.OooOOO0.setAdapter(t40Var);
        this.OooOOO0.addOnScrollListener(new h50(this));
        this.OooOOO0.setOnItemListener(new e50(this, 5));
        this.OooOOOO.setOnItemClickListener(new e50(this, 6));
        this.OooOOO.setHasFixedSize(true);
        this.OooOOO.setLayoutManager(new V7LinearLayoutManager(this, 1));
        t40 t40Var2 = new t40(1);
        this.OooOOOo = t40Var2;
        this.OooOOO.setAdapter(t40Var2);
        this.OooOOO.addOnScrollListener(new i50(this));
        this.OooOOO.setOnItemListener(new e50(this, 7));
        this.OooOOOo.setOnItemClickListener(new e50(this, 8));
        this.OooOOOo.setOnItemLongClickListener(new e50(this, 9));
        if (oo0oO0.get().getChannelGroupList().isEmpty()) {
            oo0oO0.get().selectLiveUrlAndLoad((LiveSourceBean) or.OooOoO0(LiveSourceBean.class, "live_source_url_current"));
        }
        List<LiveChannelGroup> channelGroupList = oo0oO0.get().getChannelGroupList();
        if (channelGroupList.isEmpty()) {
            OooO0oo();
            App app = App.OooOO0;
            Toast.makeText(n21.OooOooo(), "频道列表为空", 0).show();
            Oooo00O();
        } else if (channelGroupList.size() == 1 && channelGroupList.get(0).getGroupName().startsWith("http://127.0.0.1")) {
            try {
                String queryParameter = Uri.parse(channelGroupList.get(0).getGroupName()).getQueryParameter("ext");
                if (oo0oO0.get().isBase64Url(queryParameter)) {
                    queryParameter = new String(Base64.decode(queryParameter, 10), StandardCharsets.UTF_8);
                }
                yq yqVar = new yq(queryParameter);
                if (queryParameter.startsWith("https://gitcode")) {
                    ((yq) yqVar.headers("User-Agent", y21.OooO0Oo())).headers("Accept", oo0oO0.requestAccept);
                }
                if (!queryParameter.startsWith("http://127.0.0.1")) {
                    yq yqVar2 = (yq) ((yq) yqVar.cacheKey(queryParameter)).cacheMode(l1.FIRST_CACHE_THEN_REQUEST);
                    if (i.OooOoO("CACHE_TIME", 1) == -1) {
                        j = -1;
                    } else {
                        j = OooOoO * 24 * 60 * 60 * 1000;
                    }
                    yqVar2.cacheTime(j);
                }
                yqVar.execute(new o0O00o00(this, 2));
            } catch (Throwable unused) {
                OooO0oo();
                App app2 = App.OooOO0;
                Toast.makeText(n21.OooOooo(), "频道列表为空", 0).show();
            }
        } else {
            ArrayList arrayList3 = this.OooOoO0;
            arrayList3.clear();
            arrayList3.addAll(channelGroupList);
            OooO0oo();
            OooOo0();
        }
        this.OooOOoo.setHasFixedSize(true);
        this.OooOOoo.setLayoutManager(new V7LinearLayoutManager(this, 1));
        t40 t40Var3 = new t40(3);
        this.OooOo0 = t40Var3;
        this.OooOOoo.setAdapter(t40Var3);
        this.OooOOoo.addOnScrollListener(new j50(this));
        this.OooOOoo.setOnItemListener(new e50(this, 10));
        this.OooOo0.setOnItemClickListener(new e50(this, 11));
        this.OooOo00.setHasFixedSize(true);
        this.OooOo00.setLayoutManager(new V7LinearLayoutManager(this, 1));
        s50 s50Var = new s50();
        this.OooOo0O = s50Var;
        this.OooOo00.setAdapter(s50Var);
        this.OooOo00.addOnScrollListener(new k50(this));
        this.OooOo00.setOnItemListener(new e50(this, 12));
        this.OooOo0O.setOnItemClickListener(new e50(this, 13));
        this.OooOo0O.setOnItemLongClickListener(new d50(this));
        ArrayList arrayList4 = new ArrayList(Arrays.asList("线路选择", "画面比例", "播放解码", "超时换源", "偏好设置", "直播地址", "退出直播"));
        ArrayList arrayList5 = new ArrayList();
        ArrayList arrayList6 = new ArrayList();
        ArrayList arrayList7 = new ArrayList(Arrays.asList("默认", "16:9", "4:3", "填充", "原始", "裁剪"));
        ArrayList arrayList8 = new ArrayList(Arrays.asList("系统", "ijk硬解码", "ijk软解", "exo硬解", "exo软解", "阿里播放器"));
        ArrayList arrayList9 = new ArrayList(Arrays.asList("5s", "10s", "15s", "20s", "25s", "30s", "60s"));
        ArrayList arrayList10 = new ArrayList(Arrays.asList("显示时间", "显示网速", "换台反转", "跨选分类"));
        arrayList5.add(arrayList6);
        arrayList5.add(arrayList7);
        arrayList5.add(arrayList8);
        arrayList5.add(arrayList9);
        arrayList5.add(arrayList10);
        arrayList5.add(new ArrayList());
        arrayList5.add(new ArrayList());
        ArrayList arrayList11 = this.OooOo0o;
        arrayList11.clear();
        for (int i3 = 0; i3 < arrayList4.size(); i3++) {
            LiveSettingGroup liveSettingGroup = new LiveSettingGroup();
            ArrayList<LiveSettingItem> arrayList12 = new ArrayList<>();
            liveSettingGroup.setGroupIndex(i3);
            liveSettingGroup.setGroupName((String) arrayList4.get(i3));
            for (int i4 = 0; i4 < ((ArrayList) arrayList5.get(i3)).size(); i4++) {
                LiveSettingItem liveSettingItem = new LiveSettingItem();
                liveSettingItem.setItemIndex(i4);
                liveSettingItem.setItemName((String) ((ArrayList) arrayList5.get(i3)).get(i4));
                arrayList12.add(liveSettingItem);
            }
            liveSettingGroup.setLiveSettingItems(arrayList12);
            arrayList11.add(liveSettingGroup);
        }
        ((LiveSettingGroup) arrayList11.get(3)).getLiveSettingItems().get(i.OooOoO("live_connect_timeout", 5)).setItemSelected(true);
        Boolean bool = Boolean.FALSE;
        ((LiveSettingGroup) arrayList11.get(4)).getLiveSettingItems().get(0).setItemSelected(i.OooOo0o("live_show_time", bool));
        ((LiveSettingGroup) arrayList11.get(4)).getLiveSettingItems().get(1).setItemSelected(i.OooOo0o("live_show_net_speed", bool));
        ((LiveSettingGroup) arrayList11.get(4)).getLiveSettingItems().get(2).setItemSelected(i.OooOo0o("live_channel_reverse", bool));
        ((LiveSettingGroup) arrayList11.get(4)).getLiveSettingItems().get(3).setItemSelected(i.OooOo0o("live_cross_group", bool));
    }

    @Override
    public final void onBackPressed() {
        int visibility = this.OooOO0o.getVisibility();
        Handler handler = this.OooOo;
        if (visibility == 0) {
            z40 z40Var = this.o0OoOo0;
            handler.removeCallbacks(z40Var);
            handler.post(z40Var);
        } else if (this.OooOOo.getVisibility() == 0) {
            z40 z40Var2 = this.o00O0O;
            handler.removeCallbacks(z40Var2);
            handler.post(z40Var2);
        } else if (System.currentTimeMillis() - this.Ooooooo < ExoPlayer.DEFAULT_DETACH_SURFACE_TIMEOUT_MS) {
            handler.removeCallbacks(this.o00Ooo);
            handler.removeCallbacks(this.oo000o);
            super.onBackPressed();
        } else {
            this.Ooooooo = System.currentTimeMillis();
            y21.OooO0o("再按一次退出直播");
        }
    }

    @Override
    public final void onDestroy() {
        super.onDestroy();
        VideoView videoView = this.OooO;
        if (videoView != null) {
            videoView.OooO0Oo();
            this.OooO = null;
        }
        this.OooOo.removeCallbacksAndMessages(null);
        uf0.OooO00o.OooO00o("epgAddress");
        ve0 ve0Var = io.OooO00o;
        ve0Var.getClass();
        try {
            try {
                if (!((HashSet) ve0Var.OooO0o).isEmpty()) {
                    App.OooO00o().unbindService((ServiceConnection) ve0Var.OooO0oO);
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        } finally {
            ((HashSet) ve0Var.OooO0o).clear();
        }
    }

    @Override
    public final boolean onKeyDown(int i, KeyEvent keyEvent) {
        int i2;
        if (i == 22 || i == 21) {
            if (!OooOO0()) {
                return super.onKeyDown(i, keyEvent);
            }
            if (this.Oooo0O0) {
                if (i == 22) {
                    i2 = 1;
                } else {
                    i2 = -1;
                }
                int duration = (int) this.OooO.getDuration();
                if (duration > 0) {
                    this.Oooo0 += i2 * 5000;
                    int currentPosition = (int) this.OooO.getCurrentPosition();
                    int i3 = (int) (this.Oooo0 + currentPosition);
                    if (i3 > duration) {
                        i3 = duration;
                    }
                    if (i3 < 0) {
                        i3 = 0;
                    }
                    this.Oooo00o = i3;
                    this.Oooooo0.OooOOo(currentPosition, i3, duration);
                }
            }
            if (keyEvent.getAction() == 0) {
                keyEvent.startTracking();
                return !OooOo0o();
            }
        }
        if (keyEvent.getKeyCode() == 82) {
            if ((keyEvent.getFlags() & 128) != 0) {
                if (keyEvent.getAction() == 0) {
                    Oooo00O();
                }
            } else if (keyEvent.getAction() == 1) {
                Oooo0OO();
            }
        }
        if (keyEvent.getAction() == 0) {
            if (!OooOo0o()) {
                if (i != 19) {
                    if (i != 20) {
                        if (i != 23 && i != 66 && i != 85) {
                            if (i == 111) {
                                onBackPressed();
                            }
                        } else {
                            Oooo000();
                        }
                    } else if (i.OooOo0o("live_channel_reverse", Boolean.FALSE)) {
                        OooOoo();
                    } else {
                        OooOoOO();
                    }
                } else if (i.OooOo0o("live_channel_reverse", Boolean.FALSE)) {
                    OooOoOO();
                } else {
                    OooOoo();
                }
            } else if (i == 111) {
                onBackPressed();
            }
        }
        return super.onKeyDown(i, keyEvent);
    }

    @Override
    public final boolean onKeyLongPress(int i, KeyEvent keyEvent) {
        if (i == 22 || i == 21) {
            if (!OooOO0()) {
                return super.onKeyLongPress(i, keyEvent);
            }
            this.Oooo0O0 = true;
        }
        return super.onKeyLongPress(i, keyEvent);
    }

    @Override
    public final boolean onKeyUp(int i, KeyEvent keyEvent) {
        if (i != 22 && i != 21) {
            if (keyEvent.getKeyCode() == 82) {
                Oooo0OO();
            }
            return super.onKeyUp(i, keyEvent);
        } else if (!this.Oooo0O0) {
            if (i == 21) {
                if (!OooOo0o() && OooOo0O()) {
                    this.OooOoo0.preSource();
                    OooOoO(o00oO0O, this.OooOoO, true);
                }
            } else if (!OooOo0o()) {
                OooOoo0();
            }
            return super.onKeyUp(i, keyEvent);
        } else {
            this.Oooo0O0 = false;
            this.OooO.seekTo(this.Oooo00o);
            this.Oooo00o = 0;
            this.Oooo0 = 0.0f;
            this.Oooooo0.OooOOoo();
            return true;
        }
    }

    @Override
    public final void onNewIntent(Intent intent) {
        super.onNewIntent(intent);
        if (intent.getBooleanExtra("isFromFloat", false)) {
            this.OooOoo0 = (LiveChannelItem) intent.getSerializableExtra("currentLiveChannelItem");
            o00oO0O = intent.getIntExtra("currentChannelGroupIndex", 1);
            this.OooOoO = this.OooOOOo.OooOOO0.indexOf(this.OooOoo0);
        }
    }

    @Override
    public final void onPause() {
        super.onPause();
        VideoView videoView = this.OooO;
        if (videoView != null) {
            videoView.pause();
        }
    }

    @Override
    public final void onResume() {
        super.onResume();
        VideoView videoView = this.OooO;
        if (videoView != null) {
            videoView.OooOOOO();
            this.Oooooo0.setPlayState(3);
        }
    }

    @Override
    public final void onStop() {
        super.onStop();
    }
}