百草园 v7.5版本的 MD5 值为:17f49811374a404d232d5b2cc35bf30f

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


package com.shenma.tvlauncher.tvlive;

import android.app.Activity;
import android.app.Dialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.drawable.ColorDrawable;
import android.media.AudioManager;
import android.net.TrafficStats;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.Looper;
import android.os.Message;
import android.os.PowerManager;
import android.util.Base64;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.Display;
import android.view.GestureDetector;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ImageView;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.PopupWindow;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import com.android.volley.AuthFailureError;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.TimeoutError;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.HurlStack;
import com.android.volley.toolbox.StringRequest;
import com.android.volley.toolbox.Volley;
import com.baidu.cyberplayer.core.BVideoView;
import com.bumptech.glide.load.Key;
import com.forcetech.android.ForceTV;
import com.nostra13.universalimageloader.core.download.BaseImageDownloader;
import com.shenma.tvlauncher.BaseActivity;
import com.shenma.tvlauncher.R;
import com.shenma.tvlauncher.tvlive.p033Ooo.I1I;
import com.shenma.tvlauncher.tvlive.p033Ooo.IL;
import com.shenma.tvlauncher.tvlive.p033Ooo.o0o0;
import com.shenma.tvlauncher.utils.Constant;
import com.shenma.tvlauncher.utils.O80Oo0O;
import com.shenma.tvlauncher.utils.lLi1LL;
import com.shenma.tvlauncher.utils.o0o8;
import com.shenma.tvlauncher.view.o0o0;
import com.umeng.analytics.MobclickAgent;
import com.wepower.live.parser.ILetv;
import com.wepower.live.parser.IPlay;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.ProtocolException;
import java.net.URL;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import org.json.JSONException;
import org.json.JSONObject;

public class TVLivePlayer extends BaseActivity implements View.OnClickListener, AdapterView.OnItemClickListener, AdapterView.OnItemSelectedListener {

    public static String f4135O8oO8o8 = "";
    public static int Oo = 0;

    public static int f4136O80Oo0O = 0;

    public static int f4137lliiI1 = 0;

    public static int f4138oo0OOO8 = 0;

    private static int f413980 = 8000;

    private static int f4140O8O00oo;

    private static String f4141oO00O;

    private float f4142O0o80oO;

    private RelativeLayout f4143O0o;

    private TextView f4146O8o0OO;
    private Handler OOo;

    private Runnable f4148OO800Oo8;

    private Dialog f4149Oo8O;
    private IPlay Ooo;

    private TextView f4154O80808;

    private HandlerThread f4156Oo88O0;

    private int f4159O8;
    private long o0;

    public RequestQueue f4161o0o8;
    private TextView o8;
    private int o80;
    private float o800;

    private long f4162ooO00O00;

    private ILetv f4163ooo0;

    private RelativeLayout f4166o88;

    private String f4167o8o0O;

    private long f4168o8;

    private int f4169o800;

    private IL1Iii f417308O;

    private int f41740o;

    private int f41798O008OO;

    private float f41818o00;

    private long f4187O8O0;

    private TextView f4189o0;

    private TextView f4192o;

    private ListView f4193o08;

    private PopupWindow f41940;

    private com.shenma.tvlauncher.tvlive.p032O8oO8o8.IL1Iii f419500;

    private int f4196088OO;

    private int f4197088;

    private TextView f4199O80;

    com.shenma.tvlauncher.tvlive.IL1Iii.O8oO8o8 f4157Oo8ooOo = new com.shenma.tvlauncher.tvlive.IL1Iii.O8oO8o8(this);
    private BVideoView o8o0 = null;

    private ImageView f4164o08o = null;
    private ImageView OoO08o = null;

    private ImageView f4153O0O8Oo = null;

    private TextView f4155O8O08OOo = null;

    private TextView f4185O = null;

    private TextView f4190o08o = null;

    private ListView f4191o8OOoO0 = null;

    private View f417780o = null;

    private com.shenma.tvlauncher.view.ILil f4151O = null;
    private com.shenma.tvlauncher.tvlive.p033Ooo.O8 O8 = null;

    private com.shenma.tvlauncher.tvlive.p032O8oO8o8.O8oO8o8 f4183800 = null;

    private int f4158OoO = 0;

    private int f4184OO0 = 0;

    private int f41760oo0o = 0;

    private Dialog f4150Oo = null;
    private com.shenma.tvlauncher.tvlive.p033Ooo.ILil oOO0808 = null;

    private o0o0 f4165o0OoO = new o0o0();

    private String f41808OOO = "";

    private AudioManager f41828o00 = null;
    private String Oo8 = "";

    private O8oO8o8 f417888O8008 = null;

    private long f4171o8O08 = 0;

    private boolean f4147O8 = false;

    private GestureDetector f4145O8O = null;

    private long f4170oooo = 0;

    private int f4144O800008O = 0;

    private PowerManager.WakeLock f4188o = null;

    private ILil f4186Ooo8OO = ILil.PLAYER_IDLE;
    private String OO880 = Constant.TVLIVE;

    private String f4152O0880 = null;
    private boolean OOO = false;

    private boolean f41720 = false;

    private boolean f419888o8o = false;
    private boolean O80 = false;

    private int f41750o0o8O = 0;
    private long OO0O = 0;

    Handler f4160Oo = new Handler() {
        @Override
        public void handleMessage(Message message) {
            RelativeLayout relativeLayout;
            Handler handler;
            int i;
            long j;
            Ooo ooo;
            int i2 = message.what;
            if (i2 == 1005) {
                TVLivePlayer.this.m3816();
            } else if (i2 != 1006) {
                switch (i2) {
                    case 1:
                        TVLivePlayer.this.f4166o88.setVisibility(0);
                        break;
                    case 2:
                        relativeLayout = TVLivePlayer.this.f4166o88;
                        relativeLayout.setVisibility(8);
                        break;
                    case 3:
                        TVLivePlayer.this.Oo();
                        break;
                    case 4:
                        TVLivePlayer.this.m378000oOOo();
                        break;
                    case 6:
                        TVLivePlayer.this.showDialog(R.string.load_err);
                        break;
                    case 7:
                        TVLivePlayer.this.IL1Iii(2);
                        handler = TVLivePlayer.this.f4160Oo;
                        i = 7;
                        j = TVLivePlayer.f413980;
                        handler.sendEmptyMessageDelayed(i, j);
                        break;
                    case 8:
                        TVLivePlayer.this.f417780o.setVisibility(8);
                        break;
                    case 9:
                        TVLivePlayer.this.f4185O.setText("");
                        break;
                    case 10:
                        if (!TVLivePlayer.f4135O8oO8o8.equals("")) {
                            TVLivePlayer.this.I1I(Integer.parseInt(TVLivePlayer.f4135O8oO8o8));
                        }
                        TVLivePlayer.f4135O8oO8o8 = "";
                        TVLivePlayer.this.f4185O.setText(TVLivePlayer.f4135O8oO8o8 + "频道");
                        Log.d("TVLivePlayer", "keyChanne=" + TVLivePlayer.f4135O8oO8o8);
                        break;
                    case 11:
                        TVLivePlayer.this.f4165o0OoO = new IL().m3831O8oO8o8(new File(TVLivePlayer.this.getFilesDir() + File.separator + "data.xml"));
                        if (TVLivePlayer.this.OO880.equals(Constant.TVLIVE_DIY)) {
                            ooo = new Ooo("http://diy.vbohd.com/user_list_xml.php?user_id=10086", "data.xml", 4);
                        } else if (TVLivePlayer.this.f41750o0o8O == 1) {
                            ooo = new Ooo("http://wephd.live.cctv1949.com/api_new/wephd.xml", "data.xml", 4);
                        } else {
                            TVLivePlayer tVLivePlayer = TVLivePlayer.this;
                            ooo = new Ooo(tVLivePlayer.f4165o0OoO.m3837O8oO8o8().get(2).IL1Iii(), "data.xml", 4);
                        }
                        ooo.start();
                        TVLivePlayer tVLivePlayer2 = TVLivePlayer.this;
                        new Ooo(tVLivePlayer2.f4165o0OoO.m3837O8oO8o8().get(5).IL1Iii(), "news.xml", 13).start();
                        break;
                    case 13:
                        TVLivePlayer.this.f4165o0OoO = new IL().m3831O8oO8o8(new File(TVLivePlayer.this.getFilesDir() + File.separator + "news.xml"));
                        if (TVLivePlayer.this.f4165o0OoO != null) {
                            for (int i3 = 0; i3 < TVLivePlayer.this.f4165o0OoO.m3837O8oO8o8().size(); i3++) {
                                if (!TVLivePlayer.this.f4165o0OoO.m3837O8oO8o8().get(i3).m3835O8oO8o8().equals("timeout")) {
                                    TVLivePlayer.this.f41808OOO = TVLivePlayer.this.f41808OOO + TVLivePlayer.this.f4165o0OoO.m3837O8oO8o8().get(i3).m3835O8oO8o8() + ":" + TVLivePlayer.this.f4165o0OoO.m3837O8oO8o8().get(i3).IL1Iii();
                                } else if (TVLivePlayer.this.f4165o0OoO.m3837O8oO8o8().get(i3).m3835O8oO8o8().equals("timeout")) {
                                    TVLivePlayer tVLivePlayer3 = TVLivePlayer.this;
                                    tVLivePlayer3.f4171o8O08 = Long.parseLong(tVLivePlayer3.f4165o0OoO.m3837O8oO8o8().get(i3).IL1Iii());
                                }
                            }
                        }
                        TVLivePlayer.this.f4160Oo.sendEmptyMessage(14);
                        break;
                    case 14:
                        if (TVLivePlayer.this.f4171o8O08 > 0) {
                            TVLivePlayer.this.f4190o08o.setText(TVLivePlayer.this.f41808OOO);
                            Log.d("mProgramNews", "mProgramNews=" + TVLivePlayer.this.f4190o08o);
                            handler = TVLivePlayer.this.f4160Oo;
                            i = 16;
                            j = 40000;
                            handler.sendEmptyMessageDelayed(i, j);
                            break;
                        }
                        break;
                    case 15:
                        if (TVLivePlayer.this.f4184OO0 == TVLivePlayer.this.O8.m3834O8oO8o8().get(TVLivePlayer.this.f4158OoO).IL1Iii().size() - 1) {
                            TVLivePlayer.this.f4184OO0 = 0;
                        } else {
                            TVLivePlayer.m377900oOOo(TVLivePlayer.this);
                        }
                        TVLivePlayer tVLivePlayer4 = TVLivePlayer.this;
                        tVLivePlayer4.oOO0808 = tVLivePlayer4.O8.m3834O8oO8o8().get(TVLivePlayer.this.f4158OoO).IL1Iii().get(TVLivePlayer.this.f4184OO0);
                        TVLivePlayer.this.f41760oo0o = 0;
                        TVLivePlayer.this.f4160Oo.sendEmptyMessage(18);
                        lLi1LL.m3854Ooo("TVLivePlayer", "LiveConstant.PLAY_NEXT...不能播放");
                        o0o8.m3873O8oO8o8(TVLivePlayer.this, R.string.play_next, R.drawable.toast_err);
                        break;
                    case 16:
                        Log.d("mProgramNews", "mProgramNews=" + TVLivePlayer.this.f4190o08o);
                        TVLivePlayer.this.f4160Oo.sendEmptyMessageDelayed(14, TVLivePlayer.this.f4171o8O08 * 60000);
                        break;
                    case 17:
                        relativeLayout = TVLivePlayer.this.f4143O0o;
                        relativeLayout.setVisibility(8);
                        break;
                    case 18:
                        TVLivePlayer.this.m3757O80Oo0O();
                        break;
                }
            } else {
                o0o8.m3875O8oO8o8(TVLivePlayer.this, "正在为您更新直播插件!", R.drawable.toast_smile);
            }
            super.handleMessage(message);
        }
    };

    public class IL1Iii extends Handler {
        public IL1Iii(Looper looper) {
            super(looper);
        }

        @Override
        public void handleMessage(Message message) {
            if (message.what != 4) {
                return;
            }
            lLi1LL.IL1Iii("TVLivePlayer", "mVideoSource=" + TVLivePlayer.this.f4152O0880);
            TVLivePlayer.this.o8o0.setVideoPath(TVLivePlayer.this.f4152O0880);
            TVLivePlayer.this.o8o0.showCacheInfo(false);
            TVLivePlayer.this.o8o0.start();
            TVLivePlayer.this.f4186Ooo8OO = ILil.PLAYER_PREPARING;
        }
    }

    public enum ILil {
        PLAYER_IDLE,
        PLAYER_PREPARING,
        PLAYER_PREPARED
    }

    public class O8oO8o8 extends AsyncTask<String, Integer, com.shenma.tvlauncher.tvlive.p033Ooo.IL1Iii> {
        private String ILil;
        private final String IL1Iii = "http://aps.lsott.com/egp/";

        private final String f4219Ooo = ".xml";

        public O8oO8o8(String str) {
            this.ILil = "";
            TVLivePlayer.this.f4146O8o0OO.setText(TVLivePlayer.this.oOO0808.ILil());
            TVLivePlayer.this.f4199O80.setText("");
            TVLivePlayer.this.f4189o0.setText("");
            TVLivePlayer.this.o8.setText("");
            this.ILil = str;
            this.ILil = "http://aps.lsott.com/egp/" + str + ".xml";
        }

        @Override
        public com.shenma.tvlauncher.tvlive.p033Ooo.IL1Iii doInBackground(String... strArr) {
            String str;
            Iterator<String> keys;
            byte[] bArr = new byte[1024];
            try {
                HttpURLConnection httpURLConnection = (HttpURLConnection) new URL(this.ILil).openConnection();
                httpURLConnection.setRequestMethod("GET");
                httpURLConnection.setConnectTimeout(10000);
                InputStream inputStream = httpURLConnection.getInputStream();
                ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
                byte[] bArr2 = new byte[1024];
                while (true) {
                    int read = inputStream.read(bArr2);
                    if (read == -1) {
                        break;
                    }
                    byteArrayOutputStream.write(bArr2, 0, read);
                }
                inputStream.close();
                byteArrayOutputStream.close();
                str = new String(byteArrayOutputStream.toByteArray(), Key.STRING_CHARSET_NAME);
            } catch (MalformedURLException e) {
                Log.e("TVLivePlayer", "doInBackground" + e.toString());
                e.printStackTrace();
                str = "";
                JSONObject jSONObject = new JSONObject(str);
                keys = jSONObject.keys();
                com.shenma.tvlauncher.tvlive.p033Ooo.IL1Iii iL1Iii = new com.shenma.tvlauncher.tvlive.p033Ooo.IL1Iii();
                while (keys.hasNext()) {
                    try {
                    } catch (JSONException e2) {
                        e = e2;
                        Log.e("weibo", "doInBackground" + e.toString());
                        e.printStackTrace();
                        lLi1LL.m3854Ooo("TVLivePlayer", "return mEpgs=" + iL1Iii);
                        return iL1Iii;
                    }
                }
                lLi1LL.m3854Ooo("TVLivePlayer", "return mEpgs=" + iL1Iii);
                return iL1Iii;
            } catch (ProtocolException e3) {
                Log.e("TVLivePlayer", "doInBackground" + e3.toString());
                e3.printStackTrace();
                str = "";
                JSONObject jSONObject2 = new JSONObject(str);
                keys = jSONObject2.keys();
                com.shenma.tvlauncher.tvlive.p033Ooo.IL1Iii iL1Iii2 = new com.shenma.tvlauncher.tvlive.p033Ooo.IL1Iii();
                while (keys.hasNext()) {
                }
                lLi1LL.m3854Ooo("TVLivePlayer", "return mEpgs=" + iL1Iii2);
                return iL1Iii2;
            } catch (IOException e4) {
                Log.e("TVLivePlayer", "doInBackground" + e4.toString());
                e4.printStackTrace();
                str = "";
                JSONObject jSONObject22 = new JSONObject(str);
                keys = jSONObject22.keys();
                com.shenma.tvlauncher.tvlive.p033Ooo.IL1Iii iL1Iii22 = new com.shenma.tvlauncher.tvlive.p033Ooo.IL1Iii();
                while (keys.hasNext()) {
                }
                lLi1LL.m3854Ooo("TVLivePlayer", "return mEpgs=" + iL1Iii22);
                return iL1Iii22;
            }
            JSONObject jSONObject222 = new JSONObject(str);
            keys = jSONObject222.keys();
            com.shenma.tvlauncher.tvlive.p033Ooo.IL1Iii iL1Iii222 = new com.shenma.tvlauncher.tvlive.p033Ooo.IL1Iii();
            while (keys.hasNext()) {
                String next = keys.next();
                String string = jSONObject222.getString(next);
                com.shenma.tvlauncher.tvlive.p033Ooo.O8oO8o8 o8oO8o8 = new com.shenma.tvlauncher.tvlive.p033Ooo.O8oO8o8();
                o8oO8o8.m3833O8oO8o8(next);
                o8oO8o8.IL1Iii(string);
                iL1Iii222.m3823O8oO8o8().add(o8oO8o8);
            }
            lLi1LL.m3854Ooo("TVLivePlayer", "return mEpgs=" + iL1Iii222);
            return iL1Iii222;
        }

        @Override
        public void onPostExecute(com.shenma.tvlauncher.tvlive.p033Ooo.IL1Iii iL1Iii) {
            TVLivePlayer.this.m3747O8oO8o8(iL1Iii);
        }

        @Override
        protected void onPreExecute() {
            super.onPreExecute();
        }
    }

    public class O8 implements Comparator<com.shenma.tvlauncher.tvlive.p033Ooo.O8oO8o8> {
        private O8() {
        }

        @Override
        public int compare(com.shenma.tvlauncher.tvlive.p033Ooo.O8oO8o8 o8oO8o8, com.shenma.tvlauncher.tvlive.p033Ooo.O8oO8o8 o8oO8o82) {
            int intValue = Integer.valueOf(o8oO8o8.m3832O8oO8o8()).intValue();
            int intValue2 = Integer.valueOf(o8oO8o82.m3832O8oO8o8()).intValue();
            if (intValue > intValue2) {
                return 1;
            }
            return intValue < intValue2 ? -1 : 0;
        }
    }

    public class Ooo extends Thread {
        private String ILil;

        public String f4221O8oO8o8;

        private int f4222Ooo;

        public Ooo(String str, String str2, int i) {
            this.f4222Ooo = 0;
            this.ILil = "";
            this.f4221O8oO8o8 = str;
            this.ILil = str2;
            this.f4222Ooo = i;
        }

        @Override
        public void run() {
            new com.shenma.tvlauncher.tvlive.IL1Iii.IL1Iii(TVLivePlayer.this.f4160Oo).m3722O8oO8o8(TVLivePlayer.this.getFilesDir() + File.separator + this.ILil, this.f4221O8oO8o8, TVLivePlayer.this.getApplicationContext(), this.f4222Ooo);
        }
    }

    public void I1I(int i) {
        int i2 = 0;
        while (i >= this.O8.m3834O8oO8o8().get(i2).IL1Iii().size()) {
            i -= this.O8.m3834O8oO8o8().get(i2).IL1Iii().size();
            i2++;
            if (i2 >= this.O8.m3834O8oO8o8().size()) {
                return;
            }
        }
        this.f4158OoO = i2;
        int i3 = i != 0 ? i - 1 : 0;
        if (this.f4158OoO < this.O8.m3834O8oO8o8().size() && this.f4184OO0 < this.O8.m3834O8oO8o8().get(this.f4158OoO).IL1Iii().size()) {
            this.f4184OO0 = i3;
            this.f41760oo0o = 0;
            this.oOO0808 = this.O8.m3834O8oO8o8().get(this.f4158OoO).IL1Iii().get(this.f4184OO0);
            m3761Oo8ooOo();
            this.f4191o8OOoO0.setSelection(this.f4184OO0);
            this.f4160Oo.sendEmptyMessage(18);
        }
    }

    private int IL1Iii(String str, int i) {
        return getSharedPreferences("play_file", 0).getInt(str, i);
    }

    private void IL1Iii(float f) {
        int i = this.o80;
        if (i == 0 || i == 2) {
            this.o80 = 2;
            float f2 = ((-f) / this.f4196088OO) * 2.0f;
            int min = (int) Math.min(Math.max(this.f4142O0o80oO + f2, 0.01f) * 255.0f, 255.0f);
            if (f2 != 0.0f) {
                if (min < 5) {
                    m3743O8oO8o8(R.drawable.mv_ic_brightness, 255, 0, false);
                } else {
                    m3743O8oO8o8(R.drawable.mv_ic_brightness, 255, min, false);
                }
                lLi1LL.IL1Iii("doBrightnessTouch", "Lightness=" + this.f4142O0o80oO + "....vol=" + min + "...delta=" + f2 + "....mSurfaceYDisplayRange=" + this.f4196088OO);
            }
        }
    }

    public void IL1Iii(int i) {
        int i2;
        if (i != 1) {
            if (i == 2) {
                i2 = this.f41760oo0o == this.oOO0808.IL1Iii().size() - 1 ? 0 : this.f41760oo0o + 1;
            }
            this.f4160Oo.sendEmptyMessage(18);
        } else {
            int i3 = this.f41760oo0o;
            if (i3 == 0) {
                i3 = this.oOO0808.IL1Iii().size();
            }
            i2 = i3 - 1;
        }
        this.f41760oo0o = i2;
        this.f4160Oo.sendEmptyMessage(18);
    }

    private void IL1Iii(String str) {
        if (this.Oo8.equals(str)) {
            return;
        }
        O8oO8o8 o8oO8o8 = this.f417888O8008;
        if (o8oO8o8 != null) {
            o8oO8o8.cancel(true);
        }
        this.Oo8 = str;
        this.f417888O8008 = new O8oO8o8(str);
        this.f417888O8008.execute("");
    }

    private void ILil(int i) {
        String I1I;
        lLi1LL.m3854Ooo("TVLivePlayer", "epg====" + this.oOO0808.m3824O8oO8o8());
        IL1Iii(this.oOO0808.m3824O8oO8o8());
        if (this.f4186Ooo8OO != ILil.PLAYER_IDLE) {
            this.o8o0.stopPlayback();
        }
        com.shenma.tvlauncher.tvlive.p033Ooo.ILil iLil = this.oOO0808;
        if (iLil == null || (I1I = iLil.IL1Iii().get(i).I1I()) == null || "".equals(I1I)) {
            return;
        }
        if (!this.OO880.equals(Constant.TVLIVE_DIY)) {
            I1I = this.Ooo.returnPlayUrl(I1I);
        }
        this.f4152O0880 = I1I;
        lLi1LL.m3854Ooo("TVLivePlayer", "mVideoSource=" + this.f4152O0880 + "---port=" + this.o0);
        this.f4186Ooo8OO = ILil.PLAYER_IDLE;
        if (this.f417308O.hasMessages(4)) {
            this.f417308O.removeMessages(4);
        }
        this.f417308O.sendEmptyMessage(4);
        lLi1LL.m3854Ooo("TVLivePlayer", this.f4152O0880);
        if (this.f4147O8) {
            return;
        }
        lLi1LL.m3854Ooo("TVLivePlayer", "isSendNext..." + this.f4147O8);
        this.f4160Oo.sendEmptyMessageDelayed(15, 60000L);
        this.f4147O8 = true;
    }

    private void m3742O8oO8o8(float f) {
        int i;
        int i2;
        int i3 = this.o80;
        if (i3 == 0 || i3 == 1) {
            this.o80 = 1;
            int i4 = -((int) ((f / this.f4196088OO) * this.f4169o800));
            int min = Math.min(Math.max(this.f4197088 + i4, 0), this.f4169o800);
            lLi1LL.IL1Iii("doVolumeTouch", "vol====" + min + "...delta=" + i4);
            if (i4 != 0) {
                if (min < 1) {
                    m3743O8oO8o8(R.drawable.mv_ic_volume_mute, this.f4169o800, min, true);
                    return;
                }
                if (min >= 1) {
                    i = this.f4169o800;
                    if (min < i / 2) {
                        i2 = R.drawable.mv_ic_volume_low;
                        m3743O8oO8o8(i2, i, min, true);
                    }
                }
                i = this.f4169o800;
                if (min >= i / 2) {
                    i2 = R.drawable.mv_ic_volume_high;
                    m3743O8oO8o8(i2, i, min, true);
                }
            }
        }
    }

    private void m3743O8oO8o8(int i, int i2, int i3, Boolean bool) {
        if (bool.booleanValue()) {
            this.f41828o00.setStreamVolume(3, i3, 0);
        } else {
            o0o8.m3871O8oO8o8((Activity) this, i3);
        }
        if (this.f3321OO8 == null) {
            this.f3321OO8 = new Toast(this);
            View inflate = LayoutInflater.from(this).inflate(R.layout.mv_media_volume_controler, (ViewGroup) null);
            ImageView imageView = (ImageView) inflate.findViewById(R.id.center_image);
            ProgressBar progressBar = (ProgressBar) inflate.findViewById(R.id.center_progress);
            progressBar.setMax(i2);
            progressBar.setProgress(i3);
            imageView.setImageResource(i);
            this.f3321OO8.setView(inflate);
        } else {
            View view = this.f3321OO8.getView();
            ImageView imageView2 = (ImageView) view.findViewById(R.id.center_image);
            ProgressBar progressBar2 = (ProgressBar) view.findViewById(R.id.center_progress);
            progressBar2.setMax(i2);
            progressBar2.setProgress(i3);
            imageView2.setImageResource(i);
        }
        this.f3321OO8.setGravity(17, 0, 0);
        this.f3321OO8.setDuration(0);
        this.f3321OO8.show();
    }

    public void m3747O8oO8o8(com.shenma.tvlauncher.tvlive.p033Ooo.IL1Iii iL1Iii) {
        int i;
        if (iL1Iii == null || iL1Iii.m3823O8oO8o8() == null || iL1Iii.m3823O8oO8o8().size() <= 0) {
            return;
        }
        Collections.sort(iL1Iii.m3823O8oO8o8(), new O8());
        Date date = new Date();
        int hours = date.getHours();
        int minutes = date.getMinutes();
        int i2 = (hours * 60) + minutes;
        Log.e("handan", "hours:" + hours + "  minutes:" + minutes + "  keysValue:" + i2);
        if (iL1Iii != null && iL1Iii.m3823O8oO8o8() != null && iL1Iii.m3823O8oO8o8().size() > 1) {
            i = 0;
            while (i < iL1Iii.m3823O8oO8o8().size()) {
                if (i2 < Integer.valueOf(iL1Iii.m3823O8oO8o8().get(i).m3832O8oO8o8()).intValue()) {
                    break;
                } else {
                    i++;
                }
            }
        }
        i = -1;
        if (i != -1) {
            if (i > 0) {
                String[] split = iL1Iii.m3823O8oO8o8().get(i - 1).IL1Iii().split("-");
                if (split.length == 2) {
                    this.f4199O80.setText(split[1]);
                    this.f4146O8o0OO.setText(this.oOO0808.ILil());
                }
            }
            this.o8.setText(iL1Iii.m3823O8oO8o8().get(i).IL1Iii());
            int i3 = i + 1;
            if (i3 >= iL1Iii.m3823O8oO8o8().size()) {
                this.f4189o0.setText(iL1Iii.m3823O8oO8o8().get(0).IL1Iii());
            } else {
                this.f4189o0.setText(iL1Iii.m3823O8oO8o8().get(i3).IL1Iii());
            }
        }
    }

    private void m3748O8oO8o8(String str, int i) {
        SharedPreferences.Editor edit = getSharedPreferences("play_file", 0).edit();
        edit.putInt(str, i);
        edit.commit();
    }

    private void m3751OO8() {
        this.o8o0.setOnErrorListener(new BVideoView.OnErrorListener() {
            @Override
            public boolean onError(int i, int i2) {
                TVLivePlayer.this.f4186Ooo8OO = ILil.PLAYER_IDLE;
                TVLivePlayer.this.f41720 = true;
                return false;
            }
        });
        this.o8o0.setOnPreparedListener(new BVideoView.OnPreparedListener() {
            @Override
            public void onPrepared() {
                lLi1LL.m3854Ooo("TVLivePlayer", "setOnPreparedListener...");
                TVLivePlayer.this.f4160Oo.removeMessages(7);
                TVLivePlayer.this.f4160Oo.removeMessages(15);
                TVLivePlayer.this.f4160Oo.sendEmptyMessage(3);
                TVLivePlayer.this.f4160Oo.sendEmptyMessage(2);
                TVLivePlayer.this.f4147O8 = false;
            }
        });
        this.o8o0.setOnInfoListener(new BVideoView.OnInfoListener() {
            @Override
            public boolean onInfo(int i, int i2) {
                if (i == 701) {
                    TVLivePlayer.this.f4160Oo.sendEmptyMessage(1);
                } else if (i == 702) {
                    TVLivePlayer.this.f4160Oo.sendEmptyMessage(2);
                }
                return true;
            }
        });
        this.o8o0.setOnCompletionListener(new BVideoView.OnCompletionListener() {
            @Override
            public void onCompletion() {
            }
        });
    }

    public void Oo() {
        this.f4192o.setVisibility(8);
        m3759O8O08OOo();
        this.f4160Oo.removeMessages(7);
        TextView textView = this.f4185O;
        if (textView != null) {
            textView.setText("");
        }
        RelativeLayout relativeLayout = this.f4143O0o;
        if (relativeLayout != null) {
            relativeLayout.setVisibility(8);
        }
    }

    public void Oo0() {
        this.f4161o0o8.add(new StringRequest("http://www.smtvzm.com/index.php/user/getmychannel.xml?loginname=" + this.f4167o8o0O + "&ckinfo=231231", m3790O(), m3814o0O0O()) {
            @Override
            public Map<String, String> getHeaders() {
                HashMap hashMap = new HashMap();
                hashMap.put("Authorization", "Basic " + new String(Base64.encode("admin:1234".getBytes(), 0)));
                return hashMap;
            }
        });
    }

    private void OoO08o() {
        this.f41750o0o8O = this.f3328Ooo.getInt("open_tvlive", 0);
        lLi1LL.IL1Iii("TVLivePlayer", "当前服务器:" + this.f41750o0o8O);
    }

    private void m3755O0O8Oo() {
        this.OOo.removeCallbacks(this.f4148OO800Oo8);
        this.f4187O8O0 = TrafficStats.getTotalRxBytes();
        this.f4162ooO00O00 = System.currentTimeMillis();
        this.OOo.postDelayed(this.f4148OO800Oo8, 0L);
        this.f4154O80808.setVisibility(0);
    }

    public void m3757O80Oo0O() {
        this.f4160Oo.sendEmptyMessage(2);
        if (System.currentTimeMillis() - this.OO0O > 300) {
            ILil(this.f41760oo0o);
            this.f4160Oo.sendEmptyMessage(2);
        }
        m3755O0O8Oo();
        this.OO0O = System.currentTimeMillis();
        this.f4192o.setText(this.oOO0808.ILil() + " " + (this.f41760oo0o + 1) + "/" + this.oOO0808.IL1Iii().size() + "源");
        this.f4192o.setVisibility(0);
        this.f4160Oo.removeMessages(7);
        StringBuilder sb = new StringBuilder();
        sb.append("keyChanne=");
        sb.append(f4135O8oO8o8);
        lLi1LL.IL1Iii("TVLivePlayer", sb.toString());
        this.f4185O.setText(f4135O8oO8o8);
        this.f4160Oo.sendEmptyMessageDelayed(7, f413980);
        this.f4143O0o.setVisibility(0);
    }

    private void m3759O8O08OOo() {
        this.OOo.removeCallbacks(this.f4148OO800Oo8);
        this.f4154O80808.setVisibility(8);
    }

    private void m3761Oo8ooOo() {
        this.f4183800 = new com.shenma.tvlauncher.tvlive.p032O8oO8o8.O8oO8o8(this.O8.m3834O8oO8o8().get(this.f4158OoO).IL1Iii(), this);
        this.f4191o8OOoO0.setAdapter((ListAdapter) this.f4183800);
        this.f4155O8O08OOo.setText(this.O8.m3834O8oO8o8().get(this.f4158OoO).m3829Ooo());
        this.f4160Oo.removeMessages(8);
        this.f4160Oo.sendEmptyMessageDelayed(8, 10000L);
    }

    public void m3764Oo() {
        this.f4143O0o.setVisibility(8);
        this.f417780o.setVisibility(8);
        if (this.f41940 == null) {
            o0o8.m3875O8oO8o8(this, "菜单加载未完成", R.drawable.toast_shut);
            return;
        }
        this.f419500 = new com.shenma.tvlauncher.tvlive.p032O8oO8o8.IL1Iii(this, O80Oo0O.m3848O8oO8o8(0), 5, Boolean.valueOf(this.O80));
        this.f4193o08.setAdapter((ListAdapter) this.f419500);
        this.f41940.setAnimationStyle(R.style.AnimationMenu);
        this.f41940.showAtLocation(this.o8o0, 53, 0, 0);
        this.f41940.update(0, 0, getResources().getDimensionPixelSize(R.dimen.sm_350), this.f4159O8);
        this.f419888o8o = true;
        this.O80 = false;
    }

    public void m3765llL1ii() {
        this.f4191o8OOoO0.setFocusable(true);
        this.f4191o8OOoO0.setFocusableInTouchMode(true);
        this.f4191o8OOoO0.requestFocus();
        this.f4191o8OOoO0.setSelection(this.f4184OO0);
    }

    private void m3768lLi1LL() {
        this.f4157Oo8ooOo.m3724Ooo();
        this.f4163ooo0 = this.f4157Oo8ooOo.m3723O8oO8o8();
        this.f4163ooo0.loadLetv(this.f3328Ooo.getString(com.shenma.tvlauncher.tvlive.IL1Iii.ILil.IL1Iii, "libutp.so"), this.IL1Iii);
        this.o0 = this.f4163ooo0.start();
        this.Ooo = this.f4157Oo8ooOo.IL1Iii();
        this.Ooo.returnIP();
    }

    private void m3770lliiI1() {
        if (this.f4184OO0 == this.O8.m3834O8oO8o8().get(this.f4158OoO).IL1Iii().size() - 1) {
            this.f4184OO0 = 0;
        } else {
            this.f4184OO0++;
        }
        this.oOO0808 = this.O8.m3834O8oO8o8().get(this.f4158OoO).IL1Iii().get(this.f4184OO0);
        this.f41760oo0o = 0;
        this.f4160Oo.sendEmptyMessage(18);
    }

    private void m3772o0o8() {
        com.shenma.tvlauncher.view.ILil iLil = this.f4151O;
        if (iLil == null || !iLil.isShowing()) {
            return;
        }
        this.f4151O.dismiss();
    }

    public void o8o0() {
        this.f41798O008OO = this.f3328Ooo.getInt("playPre", 0);
        if (this.f41798O008OO == 0) {
            f4138oo0OOO8 = 0;
        } else {
            f4138oo0OOO8 = 1;
        }
    }

    private void m3773oo0OOO8() {
        int i = this.f4184OO0;
        if (i == 0) {
            i = this.O8.m3834O8oO8o8().get(this.f4158OoO).IL1Iii().size();
        }
        this.f4184OO0 = i - 1;
        this.oOO0808 = this.O8.m3834O8oO8o8().get(this.f4158OoO).IL1Iii().get(this.f4184OO0);
        this.f41760oo0o = 0;
        this.f4160Oo.sendEmptyMessage(18);
    }

    public void m3775o08o() {
        int i;
        f413980 = this.f3328Ooo.getInt("delay_time", 8000);
        int i2 = f413980;
        if (i2 != 5000) {
            if (i2 == 8000) {
                i = 1;
            } else if (i2 == 10000) {
                i = 2;
            } else if (i2 == 12000) {
                i = 3;
            } else if (i2 == 15000) {
                i = 4;
            }
            Oo = i;
            return;
        }
        Oo = 0;
    }

    static int m377900oOOo(TVLivePlayer tVLivePlayer) {
        int i = tVLivePlayer.f4184OO0;
        tVLivePlayer.f4184OO0 = i + 1;
        return i;
    }

    public void m378000oOOo() {
        this.O8 = new I1I().m3822O8oO8o8(new File(getFilesDir() + File.separator + "data.xml"));
        this.f4158OoO = IL1Iii("class_type", 0);
        this.f4184OO0 = IL1Iii("program_type", 0);
        if (this.f4158OoO >= this.O8.m3834O8oO8o8().size()) {
            this.f4158OoO = 0;
            this.f4184OO0 = 0;
        }
        if (this.f4184OO0 >= this.O8.m3834O8oO8o8().get(this.f4158OoO).IL1Iii().size()) {
            this.f4158OoO = 0;
            this.f4184OO0 = 0;
        }
        this.oOO0808 = this.O8.m3834O8oO8o8().get(this.f4158OoO).IL1Iii().get(this.f4184OO0);
        if (this.oOO0808 == null) {
            this.f4158OoO = 0;
            this.f4184OO0 = 0;
        }
        m3761Oo8ooOo();
        m3765llL1ii();
        m3772o0o8();
        int i = this.f4144O800008O;
        if (i != 0) {
            I1I(i);
        } else {
            this.f4160Oo.sendEmptyMessage(18);
        }
    }

    public void m378780() {
        PopupWindow popupWindow = this.f41940;
        if (popupWindow == null || !popupWindow.isShowing()) {
            return;
        }
        this.f41940.dismiss();
    }

    private Response.Listener<String> m3790O() {
        return new Response.Listener<String>() {
            @Override
            public void onResponse(String str) {
                new Ooo("http://www.smtvzm.com/xmlfile/" + TVLivePlayer.this.f4167o8o0O.toLowerCase() + ".xml", "data.xml", 4).start();
            }
        };
    }

    private void m3792O8(int i) {
        Message message = new Message();
        message.what = 10;
        this.f4160Oo.removeMessages(10);
        f4135O8oO8o8 += i;
        this.f4185O.setText(f4135O8oO8o8);
        Log.d("TVLivePlayer", "initMessage...keyChanne=" + f4135O8oO8o8);
        this.f4160Oo.sendMessageDelayed(message, 700L);
    }

    private void m3793O8O00oo() {
        Display defaultDisplay = getWindowManager().getDefaultDisplay();
        this.f4159O8 = defaultDisplay.getHeight();
        this.f41740o = defaultDisplay.getWidth();
    }

    private void m3799Ooo(int i) {
        com.shenma.tvlauncher.view.ILil iLil = this.f4151O;
        if (iLil != null && iLil.isShowing()) {
            this.f4151O.dismiss();
        }
        this.f4151O = new com.shenma.tvlauncher.view.ILil(this);
        this.f4151O.m3969O8oO8o8(i);
        this.f4151O.setCanceledOnTouchOutside(false);
        this.f4151O.show();
    }

    private void m3801O() {
        o0o0.O8oO8o8 o8oO8o8 = new o0o0.O8oO8o8(this.IL1Iii);
        View inflate = View.inflate(this.IL1Iii, R.layout.logout_dialog, null);
        ((TextView) inflate.findViewById(R.id.tv_logout_msg)).setText("亲!请在个人中心进行注册登录.电脑登录www.smtvzm.com可添加观看您自定义的节目.当然!现在无需登录就可观看体验神马小组自定义的节目啦!");
        o8oO8o8.m4132O8oO8o8(inflate);
        o8oO8o8.m4133O8oO8o8("确认", new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialogInterface, int i) {
                dialogInterface.dismiss();
                TVLivePlayer.this.f4167o8o0O = "sm0001";
                TVLivePlayer.this.Oo0();
            }
        });
        o8oO8o8.IL1Iii("退出", new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialogInterface, int i) {
                dialogInterface.dismiss();
                TVLivePlayer.this.finish();
            }
        });
        this.f4149Oo8O = o8oO8o8.m4134O8oO8o8();
        this.f4149Oo8O.show();
        this.f4149Oo8O.setCancelable(false);
        this.f4149Oo8O.setCanceledOnTouchOutside(false);
    }

    private void m3803o08o() {
        if (this.f4188o == null) {
            this.f4188o = ((PowerManager) getSystemService("power")).newWakeLock(536870922, getClass().getCanonicalName());
            this.f4188o.acquire();
        }
    }

    private void m3808o8OOoO0() {
        PowerManager.WakeLock wakeLock = this.f4188o;
        if (wakeLock == null || !wakeLock.isHeld()) {
            return;
        }
        this.f4188o.release();
        this.f4188o = null;
    }

    public void m3811oO00O() {
        if (this.f3328Ooo.getInt("mIsHwDecode", 0) == 1) {
            this.OOO = false;
            f4137lliiI1 = 0;
        } else {
            this.OOO = true;
            f4137lliiI1 = 1;
        }
    }

    private Response.ErrorListener m3814o0O0O() {
        return new Response.ErrorListener() {
            @Override
            public void onErrorResponse(VolleyError volleyError) {
                String str;
                o0o8.m3875O8oO8o8(TVLivePlayer.this, "亲爱的用户,您后台配置的数据有误!", R.drawable.toast_shut);
                if (volleyError instanceof TimeoutError) {
                    str = "请求超时";
                } else {
                    if (!(volleyError instanceof AuthFailureError)) {
                        return;
                    }
                    str = "AuthFailureError=" + volleyError.toString();
                }
                lLi1LL.m3853O8("TVLivePlayer", str);
            }
        };
    }

    public void m3816() {
        (this.f41750o0o8O == 1 ? new Ooo("http://live.lsott.com/wepower/wephd_v3.xml", "data.xml", 4) : new Ooo("http://live.lsott.com/wepower/wephd_test.xml", "data.xml", 4)).start();
        new ForceTV().m522O8oO8o8();
        m3768lLi1LL();
    }

    @Override
    protected void IL1Iii() {
        m3817O8();
    }

    @Override
    protected void ILil() {
        this.f4164o08o.setOnClickListener(this);
        this.OoO08o.setOnClickListener(this);
        this.f4153O0O8Oo.setOnClickListener(this);
        this.f4191o8OOoO0.setOnItemClickListener(this);
        this.f4191o8OOoO0.setOnItemSelectedListener(this);
        this.f4145O8O = new GestureDetector(new GestureDetector.SimpleOnGestureListener() {
            @Override
            public boolean onDoubleTap(MotionEvent motionEvent) {
                TVLivePlayer.this.m3764Oo();
                return true;
            }

            @Override
            public boolean onFling(MotionEvent motionEvent, MotionEvent motionEvent2, float f, float f2) {
                return false;
            }

            @Override
            public void onLongPress(MotionEvent motionEvent) {
                TVLivePlayer.this.m3764Oo();
            }

            @Override
            public boolean onSingleTapConfirmed(MotionEvent motionEvent) {
                if (TVLivePlayer.this.f4143O0o.getVisibility() != 8 && TVLivePlayer.this.f417780o.getVisibility() != 8) {
                    TVLivePlayer.this.f4143O0o.setVisibility(8);
                    TVLivePlayer.this.f4160Oo.removeMessages(17);
                    TVLivePlayer.this.f417780o.setVisibility(8);
                    TVLivePlayer.this.f4160Oo.removeMessages(8);
                    return true;
                }
                TVLivePlayer.this.f4143O0o.setVisibility(0);
                TVLivePlayer.this.f4160Oo.removeMessages(17);
                TVLivePlayer.this.f4160Oo.sendEmptyMessageDelayed(17, 10000L);
                TVLivePlayer.this.f417780o.setVisibility(0);
                TVLivePlayer.this.m3765llL1ii();
                TVLivePlayer.this.f4160Oo.removeMessages(8);
                TVLivePlayer.this.f4160Oo.sendEmptyMessageDelayed(8, 10000L);
                return true;
            }
        });
    }

    @Override
    protected void mo3284O8oO8o8() {
        int i;
        this.f41828o00 = (AudioManager) getSystemService("audio");
        String string = this.f3328Ooo.getString("play_ratio", "16:9");
        if ("原始比例".equals(string)) {
            i = 0;
        } else if ("4:3 缩放".equals(string)) {
            i = 1;
        } else {
            if (!"16:9缩放".equals(string)) {
                if ("默认全屏".equals(string)) {
                    i = 3;
                }
                m3811oO00O();
                o8o0();
                m3775o08o();
                OoO08o();
                m3793O8O00oo();
                IL1Iii();
                mo3286Ooo();
                ILil();
                m3751OO8();
                O80Oo0O.m3849O8oO8o8(this, this.o8o0, f4136O80Oo0O, this.I1I, this.f3329o0o0);
                this.f4156Oo88O0 = new HandlerThread("event handler thread", 10);
                this.f4156Oo88O0.start();
                this.f417308O = new IL1Iii(this.f4156Oo88O0.getLooper());
            }
            i = 2;
        }
        f4136O80Oo0O = i;
        m3811oO00O();
        o8o0();
        m3775o08o();
        OoO08o();
        m3793O8O00oo();
        IL1Iii();
        mo3286Ooo();
        ILil();
        m3751OO8();
        O80Oo0O.m3849O8oO8o8(this, this.o8o0, f4136O80Oo0O, this.I1I, this.f3329o0o0);
        this.f4156Oo88O0 = new HandlerThread("event handler thread", 10);
        this.f4156Oo88O0.start();
        this.f417308O = new IL1Iii(this.f4156Oo88O0.getLooper());
    }

    @Override
    public void onBackPressed() {
        com.shenma.tvlauncher.view.ILil iLil = this.f4151O;
        if (iLil != null && iLil.isShowing()) {
            m3772o0o8();
            return;
        }
        Dialog dialog = this.f4150Oo;
        if (dialog != null && dialog.isShowing()) {
            Oo();
            return;
        }
        View view = this.f417780o;
        if (view != null && view.getVisibility() == 0) {
            this.f417780o.setVisibility(8);
            return;
        }
        long currentTimeMillis = System.currentTimeMillis();
        if (currentTimeMillis - this.f4170oooo > 3000) {
            lLi1LL.m3854Ooo("TVLivePlayer", "再按一次");
            o0o8.m3873O8oO8o8(this, R.string.onbackpressed, R.drawable.toast_err);
            this.f4170oooo = currentTimeMillis;
        } else {
            lLi1LL.m3854Ooo("TVLivePlayer", "finish()...");
            if (this.f3321OO8 != null) {
                this.f3321OO8.cancel();
            }
            finish();
            System.exit(0);
        }
    }

    @Override
    public void onClick(View view) {
        int i;
        int id = view.getId();
        if (id != R.id.downview) {
            if (id != R.id.leftview) {
                if (id != R.id.rightview) {
                    return;
                }
                if (this.f417780o.getVisibility() == 0) {
                    i = this.f4158OoO == this.O8.m3834O8oO8o8().size() - 1 ? 0 : this.f4158OoO + 1;
                }
            } else {
                if (this.f417780o.getVisibility() != 0) {
                    IL1Iii(1);
                    return;
                }
                int i2 = this.f4158OoO;
                if (i2 == 0) {
                    i2 = this.O8.m3834O8oO8o8().size();
                }
                i = i2 - 1;
            }
            this.f4158OoO = i;
            m3761Oo8ooOo();
            return;
        }
        IL1Iii(2);
    }

    @Override
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        setContentView(R.layout.lives_main);
        this.f41828o00 = (AudioManager) getSystemService("audio");
        this.f4190o08o = (TextView) findViewById(R.id.program_news);
        m3799Ooo(R.string.load_msg);
        this.f4161o0o8 = Volley.newRequestQueue(this, new HurlStack());
        mo3284O8oO8o8();
        Intent intent = getIntent();
        this.f4144O800008O = intent.getIntExtra("KEYCHANNE", 1);
        this.OO880 = intent.getStringExtra("TVTYPE");
        if (!this.OO880.equals(Constant.TVLIVE_DIY)) {
            new com.shenma.tvlauncher.tvlive.IL1Iii.Ooo(this, this.f4160Oo).m3731O8oO8o8();
            return;
        }
        this.f4167o8o0O = this.f3328Ooo.getString("userName", null);
        String str = this.f4167o8o0O;
        if (str == null || str.equals("")) {
            m3801O();
        } else {
            Oo0();
        }
    }

    @Override
    public void onDestroy() {
        lLi1LL.m3854Ooo("TVLivePlayer", "onDestroy()...");
        RequestQueue requestQueue = this.f4161o0o8;
        if (requestQueue != null) {
            requestQueue.cancelAll(this);
        }
        ILetv iLetv = this.f4163ooo0;
        if (iLetv != null) {
            iLetv.stop();
            this.f4163ooo0 = null;
        }
        super.onDestroy();
    }

    @Override
    public void onItemClick(AdapterView<?> adapterView, View view, int i, long j) {
        this.f4184OO0 = i;
        this.oOO0808 = this.O8.m3834O8oO8o8().get(this.f4158OoO).IL1Iii().get(this.f4184OO0);
        this.f41760oo0o = 0;
        this.f4160Oo.sendEmptyMessage(18);
        HashMap hashMap = new HashMap();
        hashMap.put("TVLiveName", this.oOO0808.ILil());
        MobclickAgent.onEvent(this, "TVLive", hashMap);
    }

    @Override
    public void onItemSelected(AdapterView<?> adapterView, View view, int i, long j) {
        this.f4160Oo.removeMessages(8);
        this.f4160Oo.sendEmptyMessageDelayed(8, 10000L);
    }

    @Override
    public boolean onKeyDown(int i, KeyEvent keyEvent) {
        int i2;
        if (i == 4) {
            onBackPressed();
            return true;
        }
        if (i != 66) {
            if (i != 82) {
                switch (i) {
                    case 7:
                    case 8:
                    case 9:
                    case 10:
                    case 11:
                    case 12:
                    case 13:
                    case 14:
                    case 15:
                    case 16:
                        m3792O8(keyEvent.getKeyCode() - 7);
                        break;
                    default:
                        switch (i) {
                            case 19:
                                if (this.f41798O008OO != 0) {
                                    if (this.f417780o.getVisibility() == 8) {
                                        this.f41828o00.adjustStreamVolume(3, 1, 1);
                                        break;
                                    }
                                } else if (this.f417780o.getVisibility() == 8 && keyEvent.getAction() == 0) {
                                    m3773oo0OOO8();
                                    break;
                                }
                                break;
                            case 20:
                                if (this.f41798O008OO != 0) {
                                    if (this.f417780o.getVisibility() == 8) {
                                        this.f41828o00.adjustStreamVolume(3, -1, 1);
                                        break;
                                    }
                                } else if (this.f417780o.getVisibility() == 8 && keyEvent.getAction() == 0) {
                                    m3770lliiI1();
                                    break;
                                }
                                break;
                            case 21:
                                if (this.f417780o.getVisibility() != 0) {
                                    IL1Iii(1);
                                    break;
                                } else {
                                    int i3 = this.f4158OoO;
                                    if (i3 == 0) {
                                        i3 = this.O8.m3834O8oO8o8().size();
                                    }
                                    i2 = i3 - 1;
                                    this.f4158OoO = i2;
                                    m3761Oo8ooOo();
                                    break;
                                }
                            case 22:
                                if (this.f417780o.getVisibility() != 0) {
                                    IL1Iii(2);
                                    break;
                                } else if (this.f4158OoO == this.O8.m3834O8oO8o8().size() - 1) {
                                    this.f4158OoO = 0;
                                    m3761Oo8ooOo();
                                    break;
                                } else {
                                    i2 = this.f4158OoO + 1;
                                    this.f4158OoO = i2;
                                    m3761Oo8ooOo();
                                }
                            case 23:
                                if (this.f4143O0o.getVisibility() == 8) {
                                    this.f4143O0o.setVisibility(0);
                                    this.f4160Oo.removeMessages(17);
                                    this.f4160Oo.sendEmptyMessageDelayed(17, 10000L);
                                }
                                break;
                            case 24:
                                this.f41828o00.adjustStreamVolume(3, 1, 1);
                                return true;
                            case 25:
                                this.f41828o00.adjustStreamVolume(3, -1, 1);
                                return true;
                        }
                        break;
                }
            } else {
                m3764Oo();
            }
            return false;
        }
        if (this.f4143O0o.getVisibility() == 8) {
            this.f4143O0o.setVisibility(0);
            this.f4160Oo.removeMessages(17);
            this.f4160Oo.sendEmptyMessageDelayed(17, 10000L);
        }
    }

    @Override
    public void onNothingSelected(AdapterView<?> adapterView) {
    }

    @Override
    public void onPause() {
        lLi1LL.m3854Ooo("TVLivePlayer", "onPause()...");
        MobclickAgent.onPageEnd("TVLivePlayer");
        MobclickAgent.onPause(this);
        m3748O8oO8o8("class_type", this.f4158OoO);
        m3748O8oO8o8("program_type", this.f4184OO0);
        this.f4160Oo.removeMessages(7);
        this.f4160Oo.removeMessages(15);
        this.f4160Oo.removeMessages(10);
        m3808o8OOoO0();
        this.OOo.removeCallbacks(this.f4148OO800Oo8);
        if (this.f4186Ooo8OO == ILil.PLAYER_PREPARED) {
            this.o8o0.stopPlayback();
        }
        super.onPause();
    }

    @Override
    public void onResume() {
        MobclickAgent.onPageStart("TVLivePlayer");
        MobclickAgent.onResume(this);
        m3803o08o();
        if (!this.f4156Oo88O0.isAlive()) {
            this.f4156Oo88O0 = new HandlerThread("event handler thread", 10);
            this.f4156Oo88O0.start();
            this.f417308O = new IL1Iii(this.f4156Oo88O0.getLooper());
        }
        this.OOo = new Handler() {
            @Override
            public void handleMessage(Message message) {
                super.handleMessage(message);
                if (message.what != 5) {
                    return;
                }
                TVLivePlayer.this.f4154O80808.setText(TVLivePlayer.f4141oO00O);
            }
        };
        this.f4148OO800Oo8 = new Runnable() {
            @Override
            public void run() {
                StringBuilder sb;
                String str;
                if (TVLivePlayer.this.f4187O8O0 != 0 && TVLivePlayer.this.f4162ooO00O00 != 0) {
                    long currentTimeMillis = System.currentTimeMillis();
                    long totalRxBytes = TrafficStats.getTotalRxBytes();
                    long j = totalRxBytes - TVLivePlayer.this.f4187O8O0;
                    long j2 = currentTimeMillis - TVLivePlayer.this.f4162ooO00O00;
                    if (j > 0 && j2 > 0) {
                        TVLivePlayer.this.f4168o8 = ((j / j2) * 1000) / 1024;
                        if (TVLivePlayer.this.f4168o8 >= 1024) {
                            sb = new StringBuilder();
                            sb.append(String.valueOf(TVLivePlayer.this.f4168o8 / 1024));
                            str = "MB/S";
                        } else {
                            sb = new StringBuilder();
                            sb.append(String.valueOf(TVLivePlayer.this.f4168o8));
                            str = "KB/S";
                        }
                        sb.append(str);
                        String unused = TVLivePlayer.f4141oO00O = sb.toString();
                        TVLivePlayer.this.OOo.sendEmptyMessage(5);
                    }
                    TVLivePlayer.this.f4187O8O0 = totalRxBytes;
                    TVLivePlayer.this.f4162ooO00O00 = currentTimeMillis;
                }
                TVLivePlayer.this.OOo.postDelayed(TVLivePlayer.this.f4148OO800Oo8, 500L);
            }
        };
        super.onResume();
    }

    @Override
    public void onStop() {
        lLi1LL.m3854Ooo("TVLivePlayer", "onStop()...");
        RequestQueue requestQueue = this.f4161o0o8;
        if (requestQueue != null) {
            requestQueue.stop();
        }
        m3772o0o8();
        this.f4156Oo88O0.quit();
        overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
        super.onStop();
    }

    @Override
    public boolean onTouchEvent(MotionEvent motionEvent) {
        if (this.f417780o.getVisibility() == 0 && this.f41818o00 < getResources().getDimensionPixelSize(R.dimen.sm_360)) {
            return true;
        }
        this.f4145O8O.onTouchEvent(motionEvent);
        DisplayMetrics displayMetrics = new DisplayMetrics();
        getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
        if (this.f4196088OO == 0) {
            this.f4196088OO = Math.min(displayMetrics.widthPixels, displayMetrics.heightPixels);
        }
        float rawY = motionEvent.getRawY() - this.o800;
        float rawX = motionEvent.getRawX() - this.f41818o00;
        Log.d("TVLivePlayer", "mTouchX=" + this.f41818o00);
        Log.d("TVLivePlayer", "mTouchY=" + this.o800);
        float abs = Math.abs(rawY / rawX);
        lLi1LL.m3854Ooo("joychang", "y_changed=" + rawY + "...x_changed=" + rawX + "...coef=" + abs + "...xgesturesize=" + ((rawX / displayMetrics.xdpi) * 2.54f));
        int action = motionEvent.getAction();
        if (action == 0) {
            lLi1LL.m3854Ooo("TVLivePlayer", "MotionEvent.ACTION_DOWN.......");
            this.o80 = 0;
            this.o800 = motionEvent.getRawY();
            this.f41818o00 = motionEvent.getRawX();
            this.f4169o800 = this.f41828o00.getStreamMaxVolume(3);
            this.f4197088 = this.f41828o00.getStreamVolume(3);
            this.f4142O0o80oO = o0o8.m3860O8oO8o8((Activity) this);
        } else if (action == 1) {
            lLi1LL.m3854Ooo("TVLivePlayer", "MotionEvent.ACTION_UP.......");
            if (this.o80 == 1 && this.f41798O008OO == 0) {
                if (rawY > 80.0f) {
                    m3770lliiI1();
                } else if (rawY < -80.0f) {
                    m3773oo0OOO8();
                }
            } else if (this.o80 == 3) {
                if (rawX > 150.0f) {
                    IL1Iii(2);
                } else if (rawX < -150.0f) {
                    IL1Iii(1);
                }
            }
        } else if (action == 2) {
            lLi1LL.m3854Ooo("TVLivePlayer", "MotionEvent.ACTION_MOVE.......");
            if (abs > 2.0f) {
                if (this.f417780o.getVisibility() == 8 && this.f41818o00 > this.f41740o / 2) {
                    this.o80 = 1;
                    if (this.f41798O008OO != 0) {
                        m3742O8oO8o8(rawY);
                    }
                }
                if (this.f417780o.getVisibility() == 8 && this.f41818o00 < this.f41740o / 2) {
                    this.o80 = 2;
                    IL1Iii(rawY);
                }
            } else {
                this.o80 = 3;
            }
        }
        return true;
    }

    public void m3817O8() {
        View inflate = View.inflate(this, R.layout.mv_controler_menu, null);
        this.f4193o08 = (ListView) inflate.findViewById(R.id.media_controler_menu);
        this.f41940 = new PopupWindow(inflate, -2, -2);
        this.f41940.setOutsideTouchable(true);
        this.f41940.setTouchable(true);
        this.f41940.setFocusable(true);
        this.f4193o08.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> adapterView, View view, int i, long j) {
                SharedPreferences.Editor edit;
                String str;
                String str2;
                int i2;
                ListView listView;
                com.shenma.tvlauncher.tvlive.p032O8oO8o8.IL1Iii iL1Iii;
                if (TVLivePlayer.this.f419888o8o) {
                    TVLivePlayer.this.f419888o8o = false;
                    TVLivePlayer.this.O80 = true;
                    if (i == 0) {
                        int unused = TVLivePlayer.f4140O8O00oo = 0;
                        listView = TVLivePlayer.this.f4193o08;
                        iL1Iii = new com.shenma.tvlauncher.tvlive.p032O8oO8o8.IL1Iii(TVLivePlayer.this, O80Oo0O.m3848O8oO8o8(1), 0, Boolean.valueOf(TVLivePlayer.this.O80));
                    } else if (i == 1) {
                        int unused2 = TVLivePlayer.f4140O8O00oo = 1;
                        listView = TVLivePlayer.this.f4193o08;
                        iL1Iii = new com.shenma.tvlauncher.tvlive.p032O8oO8o8.IL1Iii(TVLivePlayer.this, O80Oo0O.m3848O8oO8o8(2), 1, Boolean.valueOf(TVLivePlayer.this.O80));
                    } else {
                        if (i != 2) {
                            if (i != 3) {
                                return;
                            }
                            int unused3 = TVLivePlayer.f4140O8O00oo = 3;
                            TVLivePlayer.this.f4193o08.setAdapter((ListAdapter) new com.shenma.tvlauncher.tvlive.p032O8oO8o8.IL1Iii(TVLivePlayer.this, O80Oo0O.m3848O8oO8o8(4), 3, Boolean.valueOf(TVLivePlayer.this.O80)));
                            return;
                        }
                        int unused4 = TVLivePlayer.f4140O8O00oo = 2;
                        listView = TVLivePlayer.this.f4193o08;
                        iL1Iii = new com.shenma.tvlauncher.tvlive.p032O8oO8o8.IL1Iii(TVLivePlayer.this, O80Oo0O.m3848O8oO8o8(3), 2, Boolean.valueOf(TVLivePlayer.this.O80));
                    }
                    listView.setAdapter((ListAdapter) iL1Iii);
                    return;
                }
                if (TVLivePlayer.this.O80) {
                    int i3 = TVLivePlayer.f4140O8O00oo;
                    if (i3 == 0) {
                        TVLivePlayer.f4137lliiI1 = i;
                        if (i != 0) {
                            if (i == 1) {
                                edit = TVLivePlayer.this.f3328Ooo.edit();
                                edit.putInt("mIsHwDecode", 0);
                                str = "硬解码";
                            }
                            TVLivePlayer.this.m3811oO00O();
                            TVLivePlayer.this.o8o0.setDecodeMode(!TVLivePlayer.this.OOO ? 1 : 0);
                            TVLivePlayer.this.m378780();
                            TVLivePlayer.this.f4160Oo.sendEmptyMessage(18);
                            return;
                        }
                        edit = TVLivePlayer.this.f3328Ooo.edit();
                        edit.putInt("mIsHwDecode", 1);
                        str = "软解码";
                        edit.putString("play_decode", str);
                        edit.commit();
                        TVLivePlayer.this.m3811oO00O();
                        TVLivePlayer.this.o8o0.setDecodeMode(!TVLivePlayer.this.OOO ? 1 : 0);
                        TVLivePlayer.this.m378780();
                        TVLivePlayer.this.f4160Oo.sendEmptyMessage(18);
                        return;
                    }
                    if (i3 == 1) {
                        TVLivePlayer.f4136O80Oo0O = i;
                        TVLivePlayer tVLivePlayer = TVLivePlayer.this;
                        O80Oo0O.m3849O8oO8o8(tVLivePlayer, tVLivePlayer.o8o0, TVLivePlayer.f4136O80Oo0O, TVLivePlayer.this.I1I, TVLivePlayer.this.f3329o0o0);
                        SharedPreferences.Editor edit2 = TVLivePlayer.this.f3328Ooo.edit();
                        if (i == 0) {
                            str2 = "原始比例";
                        } else if (i == 1) {
                            str2 = "4:3 缩放";
                        } else if (i == 2) {
                            str2 = "16:9缩放";
                        } else if (i == 3) {
                            str2 = "默认全屏";
                        }
                        edit2.putString("play_ratio", str2);
                        edit2.commit();
                    } else if (i3 == 2) {
                        TVLivePlayer.f4138oo0OOO8 = i;
                        SharedPreferences.Editor edit3 = TVLivePlayer.this.f3328Ooo.edit();
                        if (i == 0) {
                            edit3.putInt("playPre", 0);
                        } else {
                            if (i == 1) {
                                edit3.putInt("playPre", 1);
                            }
                            TVLivePlayer.this.o8o0();
                        }
                        edit3.commit();
                        TVLivePlayer.this.o8o0();
                    } else {
                        if (i3 != 3) {
                            return;
                        }
                        TVLivePlayer.Oo = i;
                        SharedPreferences.Editor edit4 = TVLivePlayer.this.f3328Ooo.edit();
                        if (i == 0) {
                            i2 = BaseImageDownloader.DEFAULT_HTTP_CONNECT_TIMEOUT;
                        } else if (i == 1) {
                            i2 = 8000;
                        } else if (i == 2) {
                            i2 = 10000;
                        } else if (i == 3) {
                            i2 = 12000;
                        } else {
                            if (i == 4) {
                                i2 = 15000;
                            }
                            TVLivePlayer.this.m3775o08o();
                        }
                        edit4.putInt("delay_time", i2);
                        edit4.commit();
                        TVLivePlayer.this.m3775o08o();
                    }
                    TVLivePlayer.this.m378780();
                }
            }
        });
        this.f4193o08.setOnKeyListener(new View.OnKeyListener() {
            @Override
            public boolean onKey(View view, int i, KeyEvent keyEvent) {
                if (keyEvent.getAction() != 1 && i == 4) {
                    if (TVLivePlayer.this.O80) {
                        TVLivePlayer.this.f419888o8o = true;
                        TVLivePlayer.this.O80 = false;
                        TVLivePlayer.this.f4193o08.setAdapter((ListAdapter) new com.shenma.tvlauncher.tvlive.p032O8oO8o8.IL1Iii(TVLivePlayer.this, O80Oo0O.m3848O8oO8o8(0), 5, Boolean.valueOf(TVLivePlayer.this.O80)));
                    } else if (TVLivePlayer.this.f419888o8o) {
                        TVLivePlayer.this.f41940.dismiss();
                    }
                }
                return false;
            }
        });
    }

    @Override
    protected void mo3286Ooo() {
        this.o8o0 = (BVideoView) findViewById(R.id.vv);
        this.f4164o08o = (ImageView) findViewById(R.id.leftview);
        this.OoO08o = (ImageView) findViewById(R.id.rightview);
        this.f4153O0O8Oo = (ImageView) findViewById(R.id.downview);
        this.f4155O8O08OOo = (TextView) findViewById(R.id.programtitle);
        this.f4185O = (TextView) findViewById(R.id.program_num);
        this.f4191o8OOoO0 = (ListView) findViewById(R.id.programlist);
        this.f4191o8OOoO0.setSelector(new ColorDrawable(0));
        this.f417780o = findViewById(R.id.left_layout);
        this.o8 = (TextView) findViewById(R.id.epg1);
        this.f4189o0 = (TextView) findViewById(R.id.epg2);
        this.f4143O0o = (RelativeLayout) findViewById(R.id.epg_layout);
        this.f4199O80 = (TextView) findViewById(R.id.curren_tv_title);
        this.f4146O8o0OO = (TextView) findViewById(R.id.tv_name);
        this.f4166o88 = (RelativeLayout) findViewById(R.id.rl_progressBar);
        this.f4192o = (TextView) findViewById(R.id.tv_line);
        this.f4154O80808 = (TextView) findViewById(R.id.tv_speed);
        BVideoView.setAKSK("", "");
        this.o8o0.setDecodeMode(!this.OOO ? 1 : 0);
    }
}