PrimeIPTV Plus v2.1.0版本的 MD5 值为:44f247a9048d0121c6011174ea55496e

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


package com.lck.lxtream;

import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.app.Activity;
import android.app.Dialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Bitmap;
import android.graphics.PointF;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.preference.PreferenceManager;
import android.support.annotation.Nullable;
import android.support.v4.view.ViewCompat;
import android.support.v7.app.AppCompatActivity;
import android.text.TextUtils;
import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import butterknife.BindView;
import butterknife.ButterKnife;
import com.bumptech.glide.Glide;
import com.bumptech.glide.RequestManager;
import com.github.mmin18.widget.FlexLayout;
import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.DefaultRenderersFactory;
import com.google.android.exoplayer2.ExoPlaybackException;
import com.google.android.exoplayer2.ExoPlayerFactory;
import com.google.android.exoplayer2.PlaybackParameters;
import com.google.android.exoplayer2.Player;
import com.google.android.exoplayer2.SimpleExoPlayer;
import com.google.android.exoplayer2.Timeline;
import com.google.android.exoplayer2.drm.DrmSessionManager;
import com.google.android.exoplayer2.drm.FrameworkMediaCrypto;
import com.google.android.exoplayer2.extractor.DefaultExtractorsFactory;
import com.google.android.exoplayer2.mediacodec.MediaCodecRenderer;
import com.google.android.exoplayer2.mediacodec.MediaCodecUtil;
import com.google.android.exoplayer2.offline.FilteringManifestParser;
import com.google.android.exoplayer2.offline.StreamKey;
import com.google.android.exoplayer2.source.ExtractorMediaSource;
import com.google.android.exoplayer2.source.MediaSource;
import com.google.android.exoplayer2.source.TrackGroupArray;
import com.google.android.exoplayer2.source.dash.DashMediaSource;
import com.google.android.exoplayer2.source.dash.manifest.DashManifestParser;
import com.google.android.exoplayer2.source.hls.HlsMediaSource;
import com.google.android.exoplayer2.source.hls.playlist.DefaultHlsPlaylistParserFactory;
import com.google.android.exoplayer2.source.smoothstreaming.SsMediaSource;
import com.google.android.exoplayer2.source.smoothstreaming.manifest.SsManifestParser;
import com.google.android.exoplayer2.trackselection.AdaptiveTrackSelection;
import com.google.android.exoplayer2.trackselection.DefaultTrackSelector;
import com.google.android.exoplayer2.trackselection.MappingTrackSelector;
import com.google.android.exoplayer2.trackselection.TrackSelectionArray;
import com.google.android.exoplayer2.ui.PlayerControlView;
import com.google.android.exoplayer2.ui.PlayerView;
import com.google.android.exoplayer2.ui.SimpleExoPlayerView;
import com.google.android.exoplayer2.upstream.DataSource;
import com.google.android.exoplayer2.upstream.DefaultBandwidthMeter;
import com.google.android.exoplayer2.upstream.HttpDataSource;
import com.google.android.exoplayer2.util.EventLogger;
import com.google.android.exoplayer2.util.Util;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.lck.lxtream.DB.Auth;
import com.lck.lxtream.DB.Authentification;
import com.lck.lxtream.DB.Cat;
import com.lck.lxtream.DB.Chan;
import com.lck.lxtream.DB.ChanSUB;
import com.lck.lxtream.DB.Channel;
import com.lck.lxtream.DB.ChannelCallback;
import com.lck.lxtream.DB.Channels;
import com.lck.lxtream.DB.DBManager;
import com.lck.lxtream.DB.Listings;
import com.lck.lxtream.DB.LoginTypeEntry;
import com.lck.lxtream.DB.Package;
import com.lck.lxtream.DB.PackageList;
import com.lck.lxtream.DB.RenewInfoQHD;
import com.lck.lxtream.Exoplayer.ChangeVedioLayout;
import com.lck.lxtream.IJKPlayer.IjkVideoView;
import com.lck.lxtream.Net.ApiManager;
import com.lck.lxtream.Net.getAgentInfo;
import com.lck.lxtream.Utils.AccountUtil;
import com.lck.lxtream.Utils.AesUtils;
import com.lck.lxtream.Utils.CheckUtil;
import com.lck.lxtream.Utils.Config;
import com.lck.lxtream.Utils.Constant;
import com.lck.lxtream.Utils.DelayTask;
import com.lck.lxtream.Utils.L;
import com.lck.lxtream.Utils.NetUtil;
import com.lck.lxtream.Utils.SP;
import com.lck.lxtream.widget.DivideLineVertical;
import com.lck.lxtream.widget.FavoriteLockDialog;
import com.lck.lxtream.widget.LiveChannelView;
import com.lck.lxtream.widget.LiveInfoView;
import com.lck.lxtream.widget.LockPasswordView;
import com.lck.lxtream.widget.UpdateChanListDialog;
import com.lck.lxtream.widget.VideoItemView;
import io.reactivex.Observable;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
import io.reactivex.functions.Action;
import io.reactivex.functions.Consumer;
import io.reactivex.functions.Function;
import io.reactivex.functions.Predicate;
import io.reactivex.schedulers.Schedulers;
import java.io.EOFException;
import java.lang.ref.WeakReference;
import java.net.CookieHandler;
import java.net.CookieManager;
import java.net.CookiePolicy;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import java.util.Locale;
import java.util.Objects;
import java.util.concurrent.TimeUnit;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import org.json.JSONObject;
public class LiveActivity extends AppCompatActivity implements PlayerControlView.VisibilityListener {
    private static final DefaultBandwidthMeter BANDWIDTH_METER = new DefaultBandwidthMeter();
    private static final CookieManager DEFAULT_COOKIE_MANAGER = new CookieManager();
    @BindView(com.aplicativox.primeiptvplus.R.id.left_and_right)
    RelativeLayout centerLayout;
    private Chan currentChan;
    private ChanSUB currentChanSub;
    private Channel currentChannel;
    private Dialog dialogRenew;
    @BindView(com.aplicativox.primeiptvplus.R.id.divideLayout)
    DivideLineVertical divideLine;
    @BindView(com.aplicativox.primeiptvplus.R.id.epg_layout)
    LiveInfoView epgLayout;
    private EventLogger eventLogger;
    private PlayerView exoPlayerView;
    private IjkVideoView ijkVideoView;
    private TrackGroupArray lastSeenTrackGroupArray;
    @BindView(com.aplicativox.primeiptvplus.R.id.divide_layout)
    RelativeLayout leftLayout;
    @BindView(com.aplicativox.primeiptvplus.R.id.live_layout)
    RelativeLayout liveLayout;
    @BindView(com.aplicativox.primeiptvplus.R.id.live_list)
    LiveChannelView liveList;
    private Disposable mDisposable;
    private DataSource.Factory mediaDataSourceFactory;
    private SimpleExoPlayer player;
    private long resumePosition;
    private int resumeWindow;
    @BindView(com.aplicativox.primeiptvplus.R.id.divide_top_layout)
    RelativeLayout topLayout;
    private DefaultTrackSelector trackSelector;
    private MediaSource videoSource;
    @BindView(com.aplicativox.primeiptvplus.R.id.videoView)
    VideoItemView videoView;
    private boolean isResume = false;
    private MYHandler myHandler = new MYHandler(this);
    private UpdateChanListDialog updateDialog = null;
    Runnable k = new Runnable() {
        @Override
        public void run() {
            String post = getAgentInfo.post("https://leadcool.net/apinew/api.code/", DBManager.getUserInfo().activeCode);
            L.i("from" + post, new Object[0]);
            try {
                JSONObject jSONObject = new JSONObject(post).getJSONObject("renew");
                Message message = new Message();
                Bundle bundle = new Bundle();
                String format = String.format("%s, renew here: %s", jSONObject.getString("renew_msg"), jSONObject.getString("renew_url"));
                message.obj = getAgentInfo.getURLimage("https://" + jSONObject.getString("renew_img"));
                L.i("Img https://" + jSONObject.getString("renew_img"), new Object[0]);
                bundle.putString("seller", format);
                message.setData(bundle);
                LiveActivity.this.myHandler.sendMessage(message);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    };
    private DelayTask numTask = new DelayTask();
    private DelayTask numVisibleTask = new DelayTask();
    private CheckUtil numCheck = new CheckUtil();
    private String numCache = "";
    private int lastType = -1;
    private Consumer<Throwable> emptyAction = new Consumer<Throwable>() {
        @Override
        public void accept(Throwable th) {
            L.e(th, "");
        }
    };
    String l = "";

    public class AnonymousClass14 implements LiveChannelView.OnChannelClick {
        AnonymousClass14() {
        }

        @Override
        public void onClick(ChannelCallback channelCallback) {
            LockPasswordView lockPasswordView;
            LockPasswordView.Action action;
            LiveActivity liveActivity;
            long j;
            if (channelCallback instanceof Channel) {
                final Channel channel = (Channel) channelCallback;
                if (LiveActivity.this.currentChannel == null || !LiveActivity.this.currentChannel.ch.equals(channel.ch)) {
                    if (!channel.isLock.booleanValue()) {
                        LiveActivity.this.currentChannel = channel;
                        LiveActivity.this.currentChan = null;
                        LiveActivity.this.currentChanSub = null;
                        LiveActivity.this.playChannel();
                        return;
                    }
                    final Dialog dialog = new Dialog(LiveActivity.this, com.aplicativox.primeiptvplus.R.style.DialogTheme);
                    lockPasswordView = new LockPasswordView(LiveActivity.this);
                    dialog.setContentView(lockPasswordView);
                    dialog.show();
                    action = new LockPasswordView.Action() {
                        @Override
                        public void onEnter() {
                            dialog.dismiss();
                            LiveActivity.this.currentChannel = channel;
                            LiveActivity.this.currentChan = null;
                            LiveActivity.this.currentChanSub = null;
                            LiveActivity.this.playChannel();
                        }
                    };
                    lockPasswordView.setAction(action);
                    return;
                }
                LiveActivity.this.currentToFullScreen();
            } else if (!(channelCallback instanceof Chan)) {
                if (channelCallback instanceof ChanSUB) {
                    final ChanSUB chanSUB = (ChanSUB) channelCallback;
                    if (LiveActivity.this.currentChanSub == null || !Objects.equals(LiveActivity.this.currentChanSub.channelId, chanSUB.channelId)) {
                        if (!chanSUB.isLock.booleanValue()) {
                            LiveActivity.this.currentChanSub = chanSUB;
                            LiveActivity.this.currentChan = null;
                            LiveActivity.this.currentChannel = null;
                            LiveActivity.this.playChanSUB();
                            return;
                        }
                        final Dialog dialog2 = new Dialog(LiveActivity.this, com.aplicativox.primeiptvplus.R.style.DialogTheme);
                        lockPasswordView = new LockPasswordView(LiveActivity.this);
                        dialog2.setContentView(lockPasswordView);
                        dialog2.show();
                        action = new LockPasswordView.Action() {
                            @Override
                            public void onEnter() {
                                dialog2.dismiss();
                                LiveActivity.this.currentChanSub = chanSUB;
                                LiveActivity.this.currentChan = null;
                                LiveActivity.this.currentChannel = null;
                                LiveActivity.this.playChanSUB();
                            }
                        };
                        lockPasswordView.setAction(action);
                        return;
                    }
                    LiveActivity.this.currentToFullScreen();
                }
            } else {
                final Chan chan = (Chan) channelCallback;
                if (LiveActivity.this.currentChan == null || !Objects.equals(LiveActivity.this.currentChan.channelId, chan.channelId)) {
                    if (chan.isLock.booleanValue()) {
                        final Dialog dialog3 = new Dialog(LiveActivity.this, com.aplicativox.primeiptvplus.R.style.DialogTheme);
                        lockPasswordView = new LockPasswordView(LiveActivity.this);
                        dialog3.setContentView(lockPasswordView);
                        dialog3.show();
                        action = new LockPasswordView.Action() {
                            @Override
                            public void onEnter() {
                                LiveActivity liveActivity2;
                                long j2;
                                dialog3.dismiss();
                                LiveActivity.this.currentChan = chan;
                                LiveActivity.this.currentChannel = null;
                                LiveActivity.this.currentChanSub = null;
                                if (LiveActivity.this.getDataType().equals("2")) {
                                    liveActivity2 = LiveActivity.this;
                                    j2 = 300;
                                } else {
                                    liveActivity2 = LiveActivity.this;
                                    j2 = 600;
                                }
                                liveActivity2.playChan(j2);
                            }
                        };
                        lockPasswordView.setAction(action);
                        return;
                    }
                    LiveActivity.this.currentChan = chan;
                    LiveActivity.this.currentChannel = null;
                    LiveActivity.this.currentChanSub = null;
                    if (LiveActivity.this.getDataType().equals("2")) {
                        liveActivity = LiveActivity.this;
                        j = 300;
                    } else {
                        liveActivity = LiveActivity.this;
                        j = 600;
                    }
                    liveActivity.playChan(j);
                    return;
                }
                LiveActivity.this.currentToFullScreen();
            }
        }

        @Override
        public void onLongClick(ChannelCallback channelCallback) {
            final FavoriteLockDialog favoriteLockDialog;
            FavoriteLockDialog.OnAction onAction;
            L.i("live channel long click", new Object[0]);
            if (channelCallback instanceof Channel) {
                final Channel channel = (Channel) channelCallback;
                favoriteLockDialog = new FavoriteLockDialog(LiveActivity.this, channel.isFavorite.booleanValue(), channel.isLock.booleanValue());
                onAction = new FavoriteLockDialog.OnAction() {
                    @Override
                    public void onFavorite(boolean z) {
                        favoriteLockDialog.dismiss();
                        channel.setIsFavorite(Boolean.valueOf(z));
                        DBManager.saveChannel(channel);
                        LiveActivity.this.liveList.updateRightList();
                    }

                    @Override
                    public void onLock(final boolean z) {
                        favoriteLockDialog.dismiss();
                        if (!channel.isLock.booleanValue()) {
                            channel.setIsLock(Boolean.valueOf(z));
                            DBManager.saveChannel(channel);
                            LiveActivity.this.liveList.updateRightList();
                            return;
                        }
                        final Dialog dialog = new Dialog(LiveActivity.this, com.aplicativox.primeiptvplus.R.style.DialogTheme);
                        LockPasswordView lockPasswordView = new LockPasswordView(LiveActivity.this);
                        dialog.setContentView(lockPasswordView);
                        dialog.show();
                        lockPasswordView.setAction(new LockPasswordView.Action() {
                            @Override
                            public void onEnter() {
                                dialog.dismiss();
                                channel.setIsLock(Boolean.valueOf(z));
                                DBManager.saveChannel(channel);
                                LiveActivity.this.liveList.updateRightList();
                            }
                        });
                    }
                };
            } else if (channelCallback instanceof Chan) {
                final Chan chan = (Chan) channelCallback;
                favoriteLockDialog = new FavoriteLockDialog(LiveActivity.this, chan.isFavorite.booleanValue(), chan.isLock.booleanValue());
                onAction = new FavoriteLockDialog.OnAction() {
                    @Override
                    public void onFavorite(boolean z) {
                        favoriteLockDialog.dismiss();
                        chan.setIsFavorite(Boolean.valueOf(z));
                        DBManager.saveChannel(chan);
                        LiveActivity.this.liveList.updateRightList();
                    }

                    @Override
                    public void onLock(final boolean z) {
                        favoriteLockDialog.dismiss();
                        if (!chan.isLock.booleanValue()) {
                            chan.setIsLock(Boolean.valueOf(z));
                            DBManager.saveChannel(chan);
                            LiveActivity.this.liveList.updateRightList();
                            return;
                        }
                        final Dialog dialog = new Dialog(LiveActivity.this, com.aplicativox.primeiptvplus.R.style.DialogTheme);
                        LockPasswordView lockPasswordView = new LockPasswordView(LiveActivity.this);
                        dialog.setContentView(lockPasswordView);
                        dialog.show();
                        lockPasswordView.setAction(new LockPasswordView.Action() {
                            @Override
                            public void onEnter() {
                                dialog.dismiss();
                                chan.setIsLock(Boolean.valueOf(z));
                                DBManager.saveChannel(chan);
                                LiveActivity.this.liveList.updateRightList();
                            }
                        });
                    }
                };
            } else if (!(channelCallback instanceof ChanSUB)) {
                return;
            } else {
                final ChanSUB chanSUB = (ChanSUB) channelCallback;
                favoriteLockDialog = new FavoriteLockDialog(LiveActivity.this, chanSUB.isFavorite.booleanValue(), chanSUB.isLock.booleanValue());
                onAction = new FavoriteLockDialog.OnAction() {
                    @Override
                    public void onFavorite(boolean z) {
                        favoriteLockDialog.dismiss();
                        chanSUB.setIsFavorite(Boolean.valueOf(z));
                        DBManager.saveChannel(chanSUB);
                        LiveActivity.this.liveList.updateRightList();
                    }

                    @Override
                    public void onLock(final boolean z) {
                        favoriteLockDialog.dismiss();
                        if (!chanSUB.isLock.booleanValue()) {
                            chanSUB.setIsLock(Boolean.valueOf(z));
                            DBManager.saveChannel(chanSUB);
                            LiveActivity.this.liveList.updateRightList();
                            return;
                        }
                        final Dialog dialog = new Dialog(LiveActivity.this, com.aplicativox.primeiptvplus.R.style.DialogTheme);
                        LockPasswordView lockPasswordView = new LockPasswordView(LiveActivity.this);
                        dialog.setContentView(lockPasswordView);
                        dialog.show();
                        lockPasswordView.setAction(new LockPasswordView.Action() {
                            @Override
                            public void onEnter() {
                                dialog.dismiss();
                                chanSUB.setIsLock(Boolean.valueOf(z));
                                DBManager.saveChannel(chanSUB);
                                LiveActivity.this.liveList.updateRightList();
                            }
                        });
                    }
                };
            }
            favoriteLockDialog.setOnItemClick(onAction);
            favoriteLockDialog.create();
            favoriteLockDialog.show();
        }
    }

    public static class MYHandler extends Handler {
        WeakReference<Activity> a;

        MYHandler(Activity activity) {
            this.a = null;
            this.a = new WeakReference<>(activity);
        }

        @Override
        public void handleMessage(Message message) {
            LiveActivity liveActivity = (LiveActivity) this.a.get();
            if (liveActivity != null) {
                super.handleMessage(message);
                switch (message.what) {
                    case 0:
                        Log.d("From", message.getData().getString("seller"));
                        ((TextView) liveActivity.dialogRenew.findViewById(com.aplicativox.primeiptvplus.R.id.renew_text_dialog)).setText(message.getData().getString("seller"));
                        ((ImageView) liveActivity.dialogRenew.findViewById(com.aplicativox.primeiptvplus.R.id.renew_imgview)).setImageBitmap((Bitmap) message.obj);
                        return;
                    case 1:
                        if (!NetUtil.isNetworkAvailable()) {
                            liveActivity.setNetworkError();
                            return;
                        } else if (liveActivity.currentChannel != null) {
                            liveActivity.playChannel();
                            return;
                        } else if (liveActivity.currentChanSub != null) {
                            liveActivity.playChanSUB();
                            return;
                        } else if (liveActivity.currentChan != null) {
                            liveActivity.playChan(liveActivity.getDataType().equals("2") ? 300L : 600L);
                            return;
                        } else {
                            return;
                        }
                    default:
                        return;
                }
            }
        }
    }

    public class playerEventlistener extends Player.DefaultEventListener {
        private playerEventlistener() {
        }

        @Override
        public void onLoadingChanged(boolean z) {
            L.i("onLoadingChanged", new Object[0]);
        }

        @Override
        public void onPlaybackParametersChanged(PlaybackParameters playbackParameters) {
            L.i("onPlaybackParametersChanged" + playbackParameters.speed, new Object[0]);
        }

        @Override
        public void onPlayerError(ExoPlaybackException exoPlaybackException) {
            LiveActivity liveActivity;
            String str;
            LiveActivity liveActivity2;
            int i;
            Object[] objArr;
            L.i("onPlayerError", new Object[0]);
            String str2 = null;
            if (exoPlaybackException.type == 1) {
                Exception rendererException = exoPlaybackException.getRendererException();
                if (rendererException instanceof MediaCodecRenderer.DecoderInitializationException) {
                    MediaCodecRenderer.DecoderInitializationException decoderInitializationException = (MediaCodecRenderer.DecoderInitializationException) rendererException;
                    if (decoderInitializationException.decoderName != null) {
                        liveActivity2 = LiveActivity.this;
                        i = com.aplicativox.primeiptvplus.R.string.error_instantiating_decoder;
                        objArr = new Object[]{decoderInitializationException.decoderName};
                    } else if (decoderInitializationException.getCause() instanceof MediaCodecUtil.DecoderQueryException) {
                        str2 = "Unable to query device decoders";
                    } else if (decoderInitializationException.secureDecoderRequired) {
                        liveActivity2 = LiveActivity.this;
                        i = com.aplicativox.primeiptvplus.R.string.error_no_secure_decoder;
                        objArr = new Object[]{decoderInitializationException.mimeType};
                    } else {
                        liveActivity2 = LiveActivity.this;
                        i = com.aplicativox.primeiptvplus.R.string.error_no_decoder;
                        objArr = new Object[]{decoderInitializationException.mimeType};
                    }
                    str2 = liveActivity2.getString(i, objArr);
                }
            } else if (exoPlaybackException.type == 0) {
                if (LiveActivity.this.currentChannel != null && !LiveActivity.this.currentChannel.name.equals(LiveActivity.this.l)) {
                    L.i("current is source error reload", new Object[0]);
                    liveActivity = LiveActivity.this;
                    str = liveActivity.currentChannel.name;
                } else if (LiveActivity.this.currentChan != null && !LiveActivity.this.currentChan.channelTitle.equals(LiveActivity.this.l)) {
                    liveActivity = LiveActivity.this;
                    str = liveActivity.currentChan.channelTitle;
                } else if (LiveActivity.this.currentChanSub != null && LiveActivity.this.currentChanSub.channelTitle.equals(LiveActivity.this.l)) {
                    liveActivity = LiveActivity.this;
                    str = liveActivity.currentChanSub.channelTitle;
                }
                liveActivity.l = str;
                LiveActivity.this.myHandler.sendEmptyMessage(2);
            }
            LiveActivity.this.videoView.getLoadingView().setVideoError();
            if (str2 != null) {
                L.i("current error :" + str2, new Object[0]);
            }
            if (exoPlaybackException != null) {
                L.i("onPlayerError" + exoPlaybackException.getMessage(), new Object[0]);
            }
        }

        @Override
        public void onPlayerStateChanged(boolean z, int i) {
            L.i("onPlayerStateChanged playWhenReady : " + z + "playbackState: " + i, new Object[0]);
            if (i == 2) {
                LiveActivity.this.videoView.getLoadingView().setLoading();
                if (LiveActivity.this.videoView.getLoadingView().getVisibility() == 8) {
                    LiveActivity.this.videoView.getLoadingView().setVisibility(0);
                    LiveActivity.this.videoView.getLoadingView().setLoading();
                }
            } else if (i == 1) {
            } else {
                if (i != 4) {
                    if (LiveActivity.this.videoView.getLoadingView().getVisibility() == 0) {
                        LiveActivity.this.videoView.getLoadingView().setVisibility(8);
                    }
                } else if (LiveActivity.this.currentChan == null && LiveActivity.this.currentChannel == null && LiveActivity.this.currentChanSub == null) {
                } else {
                    LiveActivity.this.myHandler.sendEmptyMessage(1);
                }
            }
        }

        @Override
        public void onPositionDiscontinuity(int i) {
        }

        @Override
        public void onRepeatModeChanged(int i) {
            L.i("onRepeatModeChanged " + i, new Object[0]);
        }

        @Override
        public void onSeekProcessed() {
        }

        @Override
        public void onShuffleModeEnabledChanged(boolean z) {
        }

        @Override
        public void onTimelineChanged(Timeline timeline, Object obj, int i) {
            L.i("onTimelineChanged", new Object[0]);
        }

        @Override
        public void onTracksChanged(TrackGroupArray trackGroupArray, TrackSelectionArray trackSelectionArray) {
            L.i("onTracksChanged", new Object[0]);
            if (trackGroupArray != LiveActivity.this.lastSeenTrackGroupArray) {
                MappingTrackSelector.MappedTrackInfo currentMappedTrackInfo = LiveActivity.this.trackSelector.getCurrentMappedTrackInfo();
                if (currentMappedTrackInfo != null) {
                    if (currentMappedTrackInfo.getTrackTypeRendererSupport(2) == 1) {
                        L.i("Media includes video tracks, but none are playable by this device", new Object[0]);
                    }
                    if (currentMappedTrackInfo.getTrackTypeRendererSupport(1) == 1) {
                        L.i("Media includes audio tracks, but none are playable by this device", new Object[0]);
                    }
                }
                LiveActivity.this.lastSeenTrackGroupArray = trackGroupArray;
            }
        }
    }

    static {
        DEFAULT_COOKIE_MANAGER.setCookiePolicy(CookiePolicy.ACCEPT_ORIGINAL_SERVER);
    }

    private void XtreamGetData(LoginTypeEntry loginTypeEntry) {
        this.mDisposable = Observable.mergeArrayDelayError(ApiManager.getLiveChanX(loginTypeEntry.getUrl(), loginTypeEntry.getUserName(), loginTypeEntry.getUserPwd(), Constant.Xtream_Live_Streams), ApiManager.getLiveCateagesX(loginTypeEntry.getUrl(), loginTypeEntry.getUserName(), loginTypeEntry.getUserPwd(), Constant.Xtream_Live_Categories)).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).doFinally(new Action() {
            @Override
            public void run() throws Exception {
                L.i("xtream get live data over", new Object[0]);
                LiveActivity.this.saveDate();
                LiveActivity.this.hideUpdateDialog();
                LiveActivity.this.liveList.initXtreamCatView();
                LiveActivity.this.playFirst();
            }
        }).subscribe(new Consumer<List<? extends Object>>() {
            @Override
            public void accept(List<? extends Object> list) throws Exception {
                accept2((List<?>) list);
            }

            public void accept2(List<?> list) throws Exception {
            }
        }, this.emptyAction);
    }

    private DataSource.Factory buildDataSourceFactory(boolean z) {
        return ((MyApplication) getApplication()).buildDataSourceFactory(z ? BANDWIDTH_METER : null);
    }

    private HttpDataSource.Factory buildHttpDataSourceFactory(boolean z) {
        return ((MyApplication) getApplication()).buildHttpDataSourceFactory(z ? BANDWIDTH_METER : null);
    }

    private MediaSource buildMediaSource(Uri uri, @Nullable String str) {
        int inferContentType = Util.inferContentType(uri, str);
        switch (inferContentType) {
            case 0:
                L.i("current stream DASH source", new Object[0]);
                return new DashMediaSource.Factory(this.mediaDataSourceFactory).setManifestParser(new FilteringManifestParser(new DashManifestParser(), getOfflineStreamKeys(uri))).createMediaSource(uri);
            case 1:
                L.i("current stream SS source", new Object[0]);
                return new SsMediaSource.Factory(this.mediaDataSourceFactory).setManifestParser(new FilteringManifestParser(new SsManifestParser(), getOfflineStreamKeys(uri))).createMediaSource(uri);
            case 2:
                L.i("current stream HLS source", new Object[0]);
                return new HlsMediaSource.Factory(this.mediaDataSourceFactory).setPlaylistParserFactory(new DefaultHlsPlaylistParserFactory(getOfflineStreamKeys(uri))).createMediaSource(uri);
            case 3:
                L.i("current stream other source", new Object[0]);
                return new ExtractorMediaSource.Factory(this.mediaDataSourceFactory).setExtractorsFactory(new DefaultExtractorsFactory().setTsExtractorFlags(8).setTsExtractorFlags(1).setMp3ExtractorFlags(1).setMp4ExtractorFlags(1).setFragmentedMp4ExtractorFlags(16)).createMediaSource(uri);
            default:
                throw new IllegalStateException("Unsupported type: " + inferContentType);
        }
    }

    private void changeExoSizeMode(PlayerView playerView, int i) {
        int i2;
        switch (i) {
            case 0:
                i2 = 0;
                break;
            case 1:
                i2 = 3;
                break;
            case 2:
                i2 = 1;
                break;
            case 3:
                i2 = 2;
                break;
            default:
                return;
        }
        playerView.setResizeMode(i2);
    }

    private void changeIjkSizeMode(IjkVideoView ijkVideoView, int i) {
        int i2;
        switch (i) {
            case 0:
                i2 = 0;
                break;
            case 1:
                i2 = 3;
                break;
            case 2:
                i2 = 4;
                break;
            case 3:
                i2 = 1;
                break;
            default:
                return;
        }
        ijkVideoView.setAspectRatio(i2);
    }

    private void checkIUDRenew() {
        String msg;
        LoginTypeEntry xtreamEntry = AccountUtil.getXtreamEntry();
        if (xtreamEntry == null || xtreamEntry.getId() != 0 || (msg = xtreamEntry.getMsg()) == null || TextUtils.isEmpty(msg) || !msg.contains("==")) {
            return;
        }
        String[] split = msg.split("==");
        if (TextUtils.isEmpty(split[0])) {
            return;
        }
        if (isShouldRenewIUD(split[0]) == 1) {
            showRenewDialog(split);
            L.i("test active", new Object[0]);
        } else if (isShouldRenewIUD(split[0]) == 2) {
            Toast.makeText(this, (int) com.aplicativox.primeiptvplus.R.string.code_expair, 1).show();
        }
    }

    private void checkQHD(final String str) {
        Observable<Authentification> loginQHD;
        Consumer<Authentification> consumer;
        Consumer<Throwable> consumer2;
        String str2 = DBManager.getUserInfo().activeCode;
        if ((Character.getNumericValue(str2.charAt(0)) == 1 && Character.getNumericValue(str2.charAt(1)) == 5) || (Character.getNumericValue(str2.charAt(0)) == 3 && Character.getNumericValue(str2.charAt(1)) == 6)) {
            loginQHD = ApiManager.loginQHD1536(DBManager.getUserInfo());
            consumer = new Consumer<Authentification>() {
                @Override
                public void accept(Authentification authentification) throws Exception {
                    if (!Constant.code_qhd.equals(authentification.authentification.get(0).status)) {
                        Toast.makeText(LiveActivity.this, (int) com.aplicativox.primeiptvplus.R.string.code_error, 1).show();
                        return;
                    }
                    LoginTypeEntry xtreamEntry = AccountUtil.getXtreamEntry();
                    xtreamEntry.setMsg(authentification.authentification.get(0).msg);
                    xtreamEntry.setType(str + "@" + DBManager.getUserInfo().activeCode);
                    AccountUtil.insertEntry(xtreamEntry);
                    LiveActivity.this.showQHDRenew();
                }
            };
            consumer2 = new Consumer<Throwable>() {
                @Override
                public void accept(Throwable th) throws Exception {
                    LiveActivity liveActivity;
                    int i;
                    if (th instanceof EOFException) {
                        liveActivity = LiveActivity.this;
                        i = com.aplicativox.primeiptvplus.R.string.code_error;
                    } else {
                        liveActivity = LiveActivity.this;
                        i = com.aplicativox.primeiptvplus.R.string.check_network;
                    }
                    Toast.makeText(liveActivity, i, 1).show();
                }
            };
        } else {
            loginQHD = ApiManager.loginQHD(DBManager.getUserInfo());
            consumer = new Consumer<Authentification>() {
                @Override
                public void accept(Authentification authentification) throws Exception {
                    if (!Constant.code_qhd.equals(authentification.authentification.get(0).status)) {
                        Toast.makeText(LiveActivity.this, (int) com.aplicativox.primeiptvplus.R.string.code_error, 1).show();
                        return;
                    }
                    LoginTypeEntry xtreamEntry = AccountUtil.getXtreamEntry();
                    xtreamEntry.setMsg(authentification.authentification.get(0).msg);
                    xtreamEntry.setType(str + "@" + DBManager.getUserInfo().activeCode);
                    AccountUtil.insertEntry(xtreamEntry);
                    LiveActivity.this.showQHDRenew();
                }
            };
            consumer2 = new Consumer<Throwable>() {
                @Override
                public void accept(Throwable th) throws Exception {
                    LiveActivity liveActivity;
                    int i;
                    if (th instanceof EOFException) {
                        liveActivity = LiveActivity.this;
                        i = com.aplicativox.primeiptvplus.R.string.code_error;
                    } else {
                        liveActivity = LiveActivity.this;
                        i = com.aplicativox.primeiptvplus.R.string.check_network;
                    }
                    Toast.makeText(liveActivity, i, 1).show();
                }
            };
        }
        this.mDisposable = loginQHD.subscribe(consumer, consumer2);
    }

    private void checkRenewInfo() {
        String dataType = AccountUtil.getDataType();
        if (TextUtils.isEmpty(dataType)) {
            return;
        }
        if (dataType.equals("0") || dataType.equals("1")) {
            checkQHD(dataType);
        } else if (dataType.equals("2") || dataType.equals("3")) {
            checkIUDRenew();
        }
    }

    private void checkWhetherUpdateList() {
        String str = SP.get(Constant.UPDATE_DATE, "");
        L.i("current cache date :" + str, new Object[0]);
        String format = new SimpleDateFormat("yyyy-MM-dd", Locale.getDefault()).format(Calendar.getInstance(Locale.getDefault()).getTime());
        if (TextUtils.isEmpty(str) || !format.equals(str)) {
            showUpdateDialog();
            return;
        }
        getLastChan();
        this.liveList.checkVideoType();
        checkRenewInfo();
        if (this.isResume) {
            playCache();
        } else {
            this.myHandler.postDelayed(new Runnable() {
                @Override
                public void run() {
                    LiveActivity.this.playCache();
                }
            }, 800L);
        }
    }

    private void clearResumePosition() {
        this.resumeWindow = -1;
        this.resumePosition = C.TIME_UNSET;
    }

    private void codeGetData(String str) {
        String videoType = getVideoType(str);
        if (TextUtils.isEmpty(videoType)) {
            return;
        }
        if (videoType.equals("0") || videoType.equals("1")) {
            getQHDChannels(videoType);
        } else if (videoType.equals("2")) {
            loginIUD();
        } else if (videoType.equals("3")) {
            loginSUB();
        }
    }

    private void currentToPlayerAcitivity(String str) {
        Intent intent = new Intent(this, PlayerActivity.class);
        intent.putExtra(Constant.current_url, str);
        startActivity(intent);
    }

    private void getAllChannels() {
        String str = SP.get(Constant.LOGIN_SERVER, "");
        if (TextUtils.isEmpty(str)) {
            return;
        }
        List list = (List) new Gson().fromJson(str, new TypeToken<ArrayList<LoginTypeEntry>>() {
        }.getType());
        for (int i = 0; i < list.size(); i++) {
            LoginTypeEntry loginTypeEntry = (LoginTypeEntry) list.get(i);
            if (loginTypeEntry.getState() == 0 && loginTypeEntry.getLoginState() == 0) {
                if (loginTypeEntry.getId() == 0) {
                    codeGetData(loginTypeEntry.getType());
                    return;
                } else {
                    XtreamGetData(loginTypeEntry);
                    return;
                }
            }
        }
    }

    private PointF getCenterPosition(FlexLayout flexLayout) {
        PointF pointF = new PointF();
        pointF.x = flexLayout.getWidth() / 2;
        pointF.y = flexLayout.getHeight() / 2;
        return pointF;
    }

    public String getDataType() {
        String str = SP.get(Constant.LOGIN_SERVER, "");
        if (TextUtils.isEmpty(str)) {
            return "";
        }
        List list = (List) new Gson().fromJson(str, new TypeToken<ArrayList<LoginTypeEntry>>() {
        }.getType());
        for (int i = 0; i < list.size(); i++) {
            LoginTypeEntry loginTypeEntry = (LoginTypeEntry) list.get(i);
            if (loginTypeEntry.getState() == 0 && loginTypeEntry.getLoginState() == 0) {
                return loginTypeEntry.getId() == 0 ? getVideoType(loginTypeEntry.getType()) : "600";
            }
        }
        return "";
    }

    public void getIudChans() {
        this.mDisposable = Observable.mergeArrayDelayError(ApiManager.getAllLiveChanIUD(DBManager.getUserInfo().activeCode), ApiManager.getLiveAllCatListsIUD(DBManager.getUserInfo().activeCode)).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).doFinally(new Action() {
            @Override
            public void run() throws Exception {
                LiveActivity.this.saveDate();
                LiveActivity.this.hideUpdateDialog();
                LiveActivity.this.liveList.checkVideoType();
                LiveActivity.this.playFirst();
            }
        }).subscribe(new Consumer<Object>() {
            @Override
            public void accept(Object obj) {
            }
        }, this.emptyAction);
    }

    private void getLastChan() {
        Channel channel;
        long j;
        String dataType = getDataType();
        if (TextUtils.isEmpty(dataType)) {
            return;
        }
        String str = SP.get("last_channel");
        L.i("lastChan :" + str, new Object[0]);
        if (dataType.equals("0") || dataType.equals("1")) {
            if (TextUtils.isEmpty(str) || DBManager.getChannel(str) == null) {
                loadQHDFirstChannel();
                return;
            }
            channel = DBManager.getChannel(str);
        } else if (dataType.equals("2")) {
            if (TextUtils.isEmpty(str) || DBManager.getChan(str) == null) {
                j = 300;
                loadIUDFirstChan(j);
                return;
            }
            this.currentChan = DBManager.getChan(str);
            return;
        } else if (!dataType.equals("3")) {
            if (dataType.equals("600")) {
                if (TextUtils.isEmpty(str) || DBManager.getChan(str) == null) {
                    j = 600;
                    loadIUDFirstChan(j);
                    return;
                }
                this.currentChan = DBManager.getChan(str);
                return;
            }
            return;
        } else {
            if (TextUtils.isEmpty(str) || DBManager.getChanSUB(str) == null) {
                loadSUBFirstChan(200L);
            } else {
                this.currentChanSub = DBManager.getChanSUB(str);
            }
            channel = null;
            this.currentChan = null;
        }
        this.currentChannel = channel;
    }

    private List<StreamKey> getOfflineStreamKeys(Uri uri) {
        return ((MyApplication) getApplication()).getDownloadTracker().getOfflineStreamKeys(uri);
    }

    public void getOtherPackageChannels() {
        this.mDisposable = Observable.fromIterable(DBManager.getPackagesFromParentId("-1", "1")).flatMap(new Function<Package, Observable<Channels>>() {
            @Override
            public Observable<Channels> apply(Package r2) throws Exception {
                return ApiManager.getLiveChannelsQHD(r2.id, DBManager.getUserInfo());
            }
        }).doFinally(new Action() {
            @Override
            public void run() throws Exception {
                L.i("get channel over", new Object[0]);
                LiveActivity.this.saveDate();
                LiveActivity.this.hideUpdateDialog();
                LiveActivity.this.liveList.checkVideoType();
                LiveActivity.this.playFirst();
            }
        }).subscribe(new Consumer<Channels>() {
            @Override
            public void accept(Channels channels) throws Exception {
            }
        }, this.emptyAction);
    }

    private void getQHDChannels(String str) {
        String str2 = DBManager.getUserInfo().activeCode;
        if (str2 == null || TextUtils.isEmpty(str2)) {
            return;
        }
        if (Character.getNumericValue(str2.charAt(0)) != 1) {
            if (Character.getNumericValue(str2.charAt(0)) == 3 && Character.getNumericValue(str2.charAt(1)) == 6) {
                loginQHDPRO36(str2);
            }
        } else if (Character.getNumericValue(str2.charAt(1)) == 2 && Character.getNumericValue(str2.charAt(2)) == 3) {
            loginQHDPRO(str2);
        } else if (Character.getNumericValue(str2.charAt(1)) == 7) {
            loginQHD(str2);
        } else if (Character.getNumericValue(str2.charAt(1)) == 5) {
            loginQHD1536(str2);
        }
    }

    public void getQHDLiveChannels() {
        String str = DBManager.getUserInfo().activeCode;
        if (TextUtils.isEmpty(str)) {
            return;
        }
        this.mDisposable = Observable.mergeArrayDelayError(ApiManager.getAllLiveChannelsQHD(str), ApiManager.getAllLivePackageQHD(str)).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).doFinally(new Action() {
            @Override
            public void run() throws Exception {
                LiveActivity.this.saveDate();
                LiveActivity.this.hideUpdateDialog();
                LiveActivity.this.liveList.checkVideoType();
                LiveActivity.this.playFirst();
            }
        }).subscribe(new Consumer<Object>() {
            @Override
            public void accept(Object obj) {
            }
        }, this.emptyAction);
    }

    public void getQHDPROLiveChannels() {
        String str = DBManager.getUserInfo().activeCode;
        if (str == null || TextUtils.isEmpty(str)) {
            return;
        }
        this.mDisposable = Observable.mergeArrayDelayError(ApiManager.getAllLiveChannelsPRO(str), ApiManager.getAllLivePackagePRO(str)).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).doFinally(new Action() {
            @Override
            public void run() throws Exception {
                LiveActivity.this.saveDate();
                LiveActivity.this.hideUpdateDialog();
                LiveActivity.this.liveList.checkVideoType();
                LiveActivity.this.playFirst();
            }
        }).subscribe(new Consumer<Object>() {
            @Override
            public void accept(Object obj) {
            }
        }, this.emptyAction);
    }

    public void getSubChans() {
        this.mDisposable = Observable.mergeArrayDelayError(ApiManager.getAllLiveChanList(DBManager.getUserInfo().activeCode), ApiManager.getLiveCatListsSUB(DBManager.getUserInfo().activeCode)).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).doFinally(new Action() {
            @Override
            public void run() throws Exception {
                LiveActivity.this.saveDate();
                LiveActivity.this.hideUpdateDialog();
                LiveActivity.this.liveList.checkVideoType();
                LiveActivity.this.playFirst();
            }
        }).subscribe(new Consumer<Object>() {
            @Override
            public void accept(Object obj) {
            }
        }, this.emptyAction);
    }

    public void hideUpdateDialog() {
        UpdateChanListDialog updateChanListDialog = this.updateDialog;
        if (updateChanListDialog == null || !updateChanListDialog.isShowing()) {
            return;
        }
        this.updateDialog.dismiss();
        this.updateDialog = null;
    }

    private void init() {
        this.videoView.setBackground(com.aplicativox.primeiptvplus.R.drawable.video_normal_shape);
        ViewCompat.setBackground(this.videoView, null);
    }

    private void initializePlayer() {
        this.trackSelector = new DefaultTrackSelector(new AdaptiveTrackSelection.Factory(BANDWIDTH_METER));
        this.lastSeenTrackGroupArray = null;
        this.eventLogger = new EventLogger(this.trackSelector);
        this.player = ExoPlayerFactory.newSimpleInstance(new DefaultRenderersFactory(this, (DrmSessionManager<FrameworkMediaCrypto>) null, ((MyApplication) getApplication()).useExtensionRenderers() ? 2 : 0), this.trackSelector);
        this.player.addListener(new playerEventlistener());
        this.player.addAnalyticsListener(this.eventLogger);
        PlayerView playerView = this.exoPlayerView;
        if (playerView != null) {
            PlayerView.switchTargetView(this.player, null, playerView);
        }
    }

    private void invisiableOtherView(boolean z) {
        this.videoView.switchChannelName(!z);
        if (z) {
            this.divideLine.setVisibility(8);
            this.liveList.setVisibility(8);
            this.epgLayout.setVisibility(8);
            this.leftLayout.setVisibility(8);
            this.centerLayout.setVisibility(8);
            this.topLayout.setVisibility(8);
            return;
        }
        this.divideLine.setVisibility(0);
        this.liveList.setVisibility(0);
        this.epgLayout.setVisibility(0);
        this.leftLayout.setVisibility(0);
        this.centerLayout.setVisibility(0);
        this.topLayout.setVisibility(0);
        this.liveList.getLeftViewFocus();
    }

    private boolean isShouldRenew(String str) {
        int i;
        int i2;
        int indexOf = str.indexOf("after");
        int indexOf2 = str.indexOf("days");
        if (indexOf != -1 && indexOf2 != -1 && (i = indexOf + 6) < (i2 = indexOf2 - 1) && i2 < str.length()) {
            int parseInt = Integer.parseInt(str.substring(i, i2));
            L.d("remain days %d", Integer.valueOf(parseInt));
            if (parseInt <= 30 && parseInt >= 1) {
                return true;
            }
        }
        return false;
    }

    private int isShouldRenewIUD(String str) {
        long longValue = Long.valueOf(str).longValue() - (Calendar.getInstance().getTimeInMillis() / 1000);
        if (longValue < 0) {
            return 2;
        }
        return longValue < 2592000 ? 1 : 0;
    }

    private void loadIUDFirstChan(final long j) {
        this.mDisposable = Observable.just(Long.valueOf(j)).flatMap(new Function<Long, Observable<Cat>>() {
            @Override
            public Observable<Cat> apply(Long l) throws Exception {
                return Observable.fromIterable(DBManager.getCats(l.longValue()));
            }
        }).throttleFirst(10L, TimeUnit.SECONDS).flatMap(new Function<Cat, Observable<Chan>>() {
            @Override
            public Observable<Chan> apply(Cat cat) throws Exception {
                return Observable.just(DBManager.getChans(cat.categoryId.longValue()).get(0));
            }
        }).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Consumer<Chan>() {
            @Override
            public void accept(Chan chan) throws Exception {
                LiveActivity.this.currentChan = chan;
                LiveActivity.this.currentChannel = null;
                LiveActivity.this.currentChanSub = null;
                LiveActivity.this.playChan(j);
            }
        }, this.emptyAction);
    }

    private void loadQHDFirstChannel() {
        this.mDisposable = Observable.just("1").flatMap(new Function<String, Observable<Package>>() {
            @Override
            public Observable<Package> apply(String str) throws Exception {
                return Observable.just(DBManager.getQhdFirstPackages("1"));
            }
        }).flatMap(new Function<Package, Observable<Channel>>() {
            @Override
            public Observable<Channel> apply(Package r3) throws Exception {
                return Observable.just(DBManager.getChannels(r3.getId().longValue()).get(0));
            }
        }).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Consumer<Channel>() {
            @Override
            public void accept(Channel channel) throws Exception {
                L.i("qhdFirstChannel :" + channel.name, new Object[0]);
                LiveActivity.this.currentChannel = channel;
                LiveActivity.this.currentChan = null;
                LiveActivity.this.currentChanSub = null;
                LiveActivity.this.playChannel();
            }
        }, this.emptyAction);
    }

    private void loadSUBFirstChan(long j) {
        this.mDisposable = Observable.just(Long.valueOf(j)).flatMap(new Function<Long, Observable<Cat>>() {
            @Override
            public Observable<Cat> apply(Long l) throws Exception {
                return Observable.fromIterable(DBManager.getCats(l.longValue()));
            }
        }).throttleFirst(10L, TimeUnit.SECONDS).flatMap(new Function<Cat, Observable<ChanSUB>>() {
            @Override
            public Observable<ChanSUB> apply(Cat cat) throws Exception {
                return Observable.just(DBManager.getChanSUBs(cat.categoryId.longValue()).get(0));
            }
        }).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Consumer<ChanSUB>() {
            @Override
            public void accept(ChanSUB chanSUB) throws Exception {
                LiveActivity.this.currentChanSub = chanSUB;
                LiveActivity.this.currentChan = null;
                LiveActivity.this.currentChannel = null;
                LiveActivity.this.playChanSUB();
            }
        }, this.emptyAction);
    }

    private void loginIUD() {
        final String str = DBManager.getUserInfo().activeCode;
        if (str == null || TextUtils.isEmpty(str)) {
            return;
        }
        ApiManager.loginIUD(DBManager.getUserInfo(str)).subscribe(new Consumer<Auth>() {
            @Override
            public void accept(Auth auth) throws Exception {
                if (auth.codeInfo.status.intValue() != 1) {
                    Intent intent = new Intent(LiveActivity.this, ServerSettingsActivity.class);
                    intent.putExtra(Constant.FROM_LOGIN, 0);
                    LiveActivity.this.startActivity(intent);
                    LiveActivity.this.finish();
                    return;
                }
                StringBuilder sb = new StringBuilder();
                sb.append(auth.codeInfo.expTimestamp);
                if (auth.renewInfo != null) {
                    sb.append("==");
                    sb.append(auth.renewInfo.renew.msg);
                    sb.append("==");
                    sb.append(auth.renewInfo.renew.link);
                    sb.append("==");
                    sb.append(auth.renewInfo.renew.qrimg);
                }
                LoginTypeEntry xtreamEntry = AccountUtil.getXtreamEntry();
                if (xtreamEntry != null) {
                    xtreamEntry.setType("2@" + str);
                    xtreamEntry.setMsg(sb.toString());
                    xtreamEntry.setState(0);
                    xtreamEntry.setLoginState(0);
                    AccountUtil.insertEntry(xtreamEntry);
                }
                LiveActivity.this.getIudChans();
            }
        }, new Consumer<Throwable>() {
            @Override
            public void accept(Throwable th) throws Exception {
                LiveActivity.this.getIudChans();
            }
        });
    }

    private void loginQHD(final String str) {
        ApiManager.loginQHD(DBManager.getUserInfo(str)).subscribe(new Consumer<Authentification>() {
            @Override
            public void accept(Authentification authentification) throws Exception {
                if (!Constant.code_qhd.equals(authentification.authentification.get(0).status)) {
                    Intent intent = new Intent(LiveActivity.this, ServerSettingsActivity.class);
                    intent.putExtra(Constant.FROM_LOGIN, 0);
                    LiveActivity.this.startActivity(intent);
                    LiveActivity.this.finish();
                    return;
                }
                LoginTypeEntry xtreamEntry = AccountUtil.getXtreamEntry();
                if (xtreamEntry != null) {
                    xtreamEntry.setType("1@" + str);
                    xtreamEntry.setMsg(authentification.authentification.get(0).msg);
                    xtreamEntry.setState(0);
                    xtreamEntry.setLoginState(0);
                    AccountUtil.insertEntry(xtreamEntry);
                }
                LiveActivity.this.getQHDLiveChannels();
            }
        }, new Consumer<Throwable>() {
            @Override
            public void accept(Throwable th) throws Exception {
                LiveActivity.this.getQHDLiveChannels();
            }
        });
    }

    private void loginQHD1536(final String str) {
        ApiManager.loginQHD1536(DBManager.getUserInfo(str)).subscribe(new Consumer<Authentification>() {
            @Override
            public void accept(Authentification authentification) throws Exception {
                if (!Constant.code_qhd.equals(authentification.authentification.get(0).status)) {
                    Intent intent = new Intent(LiveActivity.this, ServerSettingsActivity.class);
                    intent.putExtra(Constant.FROM_LOGIN, 0);
                    LiveActivity.this.startActivity(intent);
                    LiveActivity.this.finish();
                    return;
                }
                LoginTypeEntry xtreamEntry = AccountUtil.getXtreamEntry();
                if (xtreamEntry != null) {
                    xtreamEntry.setType("1@" + str);
                    xtreamEntry.setMsg(authentification.authentification.get(0).msg);
                    xtreamEntry.setState(0);
                    xtreamEntry.setLoginState(0);
                    AccountUtil.insertEntry(xtreamEntry);
                }
                LiveActivity.this.getQHDLiveChannels();
            }
        }, new Consumer<Throwable>() {
            @Override
            public void accept(Throwable th) throws Exception {
                LiveActivity.this.getQHDLiveChannels();
            }
        });
    }

    private void loginQHDPRO(final String str) {
        if (str == null || TextUtils.isEmpty(str)) {
            return;
        }
        ApiManager.loginQHD(DBManager.getUserInfo(str)).subscribe(new Consumer<Authentification>() {
            @Override
            public void accept(Authentification authentification) throws Exception {
                if (!Constant.code_qhd.equals(authentification.authentification.get(0).status)) {
                    Intent intent = new Intent(LiveActivity.this, ServerSettingsActivity.class);
                    intent.putExtra(Constant.FROM_LOGIN, 0);
                    LiveActivity.this.startActivity(intent);
                    LiveActivity.this.finish();
                    return;
                }
                LoginTypeEntry xtreamEntry = AccountUtil.getXtreamEntry();
                if (xtreamEntry != null) {
                    xtreamEntry.setType("0@" + str);
                    xtreamEntry.setMsg(authentification.authentification.get(0).msg);
                    xtreamEntry.setState(0);
                    xtreamEntry.setLoginState(0);
                    AccountUtil.insertEntry(xtreamEntry);
                }
                LiveActivity.this.getQHDPROLiveChannels();
            }
        }, new Consumer<Throwable>() {
            @Override
            public void accept(Throwable th) throws Exception {
                LiveActivity.this.getQHDPROLiveChannels();
            }
        });
    }

    private void loginQHDPRO36(final String str) {
        ApiManager.loginQHD1536(DBManager.getUserInfo(str)).subscribe(new Consumer<Authentification>() {
            @Override
            public void accept(Authentification authentification) throws Exception {
                if (!Constant.code_qhd.equals(authentification.authentification.get(0).status)) {
                    Intent intent = new Intent(LiveActivity.this, ServerSettingsActivity.class);
                    intent.putExtra(Constant.FROM_LOGIN, 0);
                    LiveActivity.this.startActivity(intent);
                    LiveActivity.this.finish();
                    return;
                }
                LoginTypeEntry xtreamEntry = AccountUtil.getXtreamEntry();
                if (xtreamEntry != null) {
                    xtreamEntry.setType("0@" + str);
                    xtreamEntry.setMsg(authentification.authentification.get(0).msg);
                    xtreamEntry.setState(0);
                    xtreamEntry.setLoginState(0);
                    AccountUtil.insertEntry(xtreamEntry);
                }
                LiveActivity.this.getQHDPROLiveChannels();
            }
        }, new Consumer<Throwable>() {
            @Override
            public void accept(Throwable th) throws Exception {
                LiveActivity.this.getQHDPROLiveChannels();
            }
        });
    }

    private void loginSUB() {
        final String str = DBManager.getUserInfo().activeCode;
        if (str == null || TextUtils.isEmpty(str)) {
            return;
        }
        this.mDisposable = ApiManager.loginSUB(DBManager.getUserInfo(str)).subscribe(new Consumer<Auth>() {
            @Override
            public void accept(Auth auth) throws Exception {
                if (auth.codeInfo.status.intValue() != 1) {
                    Intent intent = new Intent(LiveActivity.this, ServerSettingsActivity.class);
                    intent.putExtra(Constant.FROM_LOGIN, 0);
                    LiveActivity.this.startActivity(intent);
                    LiveActivity.this.finish();
                    return;
                }
                StringBuilder sb = new StringBuilder();
                sb.append(auth.codeInfo.expTimestamp);
                if (auth.renewInfo != null) {
                    sb.append("==");
                    sb.append(auth.renewInfo.renew.msg);
                    sb.append("==");
                    sb.append(auth.renewInfo.renew.link);
                    sb.append("==");
                    sb.append(auth.renewInfo.renew.qrimg);
                }
                LoginTypeEntry xtreamEntry = AccountUtil.getXtreamEntry();
                if (xtreamEntry != null) {
                    xtreamEntry.setType("3@" + str);
                    xtreamEntry.setMsg(sb.toString());
                    xtreamEntry.setState(0);
                    xtreamEntry.setLoginState(0);
                    AccountUtil.insertEntry(xtreamEntry);
                }
                LiveActivity.this.getSubChans();
            }
        }, new Consumer<Throwable>() {
            @Override
            public void accept(Throwable th) throws Exception {
                LiveActivity.this.getSubChans();
            }
        });
    }

    private void onDown() {
        this.liveList.onListDown();
    }

    private void onUp() {
        this.liveList.onListUp();
    }

    public void playCache() {
        Channel channel = this.currentChannel;
        if (channel != null) {
            this.currentChan = null;
            this.currentChanSub = null;
            if (!channel.isLock.booleanValue()) {
                playChannel();
                return;
            }
            this.currentChannel = null;
        } else {
            Chan chan = this.currentChan;
            if (chan != null) {
                this.currentChannel = null;
                this.currentChanSub = null;
                if (!chan.isLock.booleanValue()) {
                    playChan(getDataType().equals("2") ? 300L : 600L);
                    return;
                }
                this.currentChan = null;
            } else {
                ChanSUB chanSUB = this.currentChanSub;
                if (chanSUB == null) {
                    return;
                }
                this.currentChan = null;
                this.currentChannel = null;
                if (!chanSUB.isLock.booleanValue()) {
                    playChanSUB();
                    return;
                }
                this.currentChanSub = null;
            }
        }
        this.videoView.setChanName(getString(com.aplicativox.primeiptvplus.R.string.channel_locked));
    }

    public void playChan(long j) {
        SP.put("last_channel", this.currentChan.channelTitle);
        this.videoView.setChanName(this.currentChan.channelTitle);
        playLive(this.currentChan.channelUrl, true);
        L.i("current pid :" + j, new Object[0]);
        if (j == 300) {
            this.mDisposable = ApiManager.getEgpInfoIUD(DBManager.getUserInfo().activeCode, this.currentChan.channelId.intValue()).subscribe(new Consumer<Listings>() {
                @Override
                public void accept(Listings listings) throws Exception {
                }
            }, this.emptyAction);
            return;
        }
        LoginTypeEntry xtreamEntry = AccountUtil.getXtreamEntry();
        ApiManager.getXtreamEgpInfo(xtreamEntry.getUrl(), xtreamEntry.getUserName(), xtreamEntry.getUserPwd(), Constant.Xtream_Live_Streams_Epg, this.currentChan.channelId.intValue()).subscribe(new Consumer<Listings>() {
            @Override
            public void accept(Listings listings) throws Exception {
            }
        }, this.emptyAction);
    }

    public void playChanSUB() {
        SP.put("last_channel", this.currentChanSub.channelTitle);
        this.videoView.setChanName(this.currentChanSub.channelTitle);
        L.i("current playing chan :" + this.currentChanSub.channelTitle + " --" + this.currentChanSub.channelUrl, new Object[0]);
        playLive(this.currentChanSub.channelUrl, true);
        this.mDisposable = ApiManager.getEgpInfoSUB(DBManager.getUserInfo().activeCode, this.currentChanSub.channelId.intValue()).subscribe(new Consumer<Listings>() {
            @Override
            public void accept(Listings listings) throws Exception {
            }
        }, this.emptyAction);
    }

    public void playChannel() {
        SP.put("last_channel", this.currentChannel.name);
        this.videoView.setChanName(this.currentChannel.name);
        playLive(this.currentChannel.ch, true);
        this.epgLayout.setData(this.currentChannel);
    }

    public void playFirst() {
        if (this.currentChan == null && this.currentChannel == null && this.currentChanSub == null) {
            getLastChan();
            playCache();
        }
    }

    private void playLive(String str, boolean z) {
        LoginTypeEntry xtreamEntry;
        if (!NetUtil.isNetworkAvailable()) {
            setNetworkError();
            return;
        }
        if (z) {
            SP.put(Constant.DECTDE_TYPE, 0);
        } else {
            SP.put(Constant.DECTDE_TYPE, 1);
        }
        String dataType = AccountUtil.getDataType();
        if ((dataType.equals("0") || dataType.equals("1")) && (xtreamEntry = AccountUtil.getXtreamEntry()) != null && xtreamEntry.getType() != null && !TextUtils.isEmpty(xtreamEntry.getType()) && xtreamEntry.getType().contains("@")) {
            String str2 = xtreamEntry.getType().split("@")[1];
            if (!str.contains(str2)) {
                str = AesUtils.DecryptString(str, Config.AES_KEY, Config.AES_KEY) + "code=" + str2;
            }
        }
        playN(str, false);
    }

    private void playN(String str, boolean z) {
        L.i("current playing isResume :" + this.isResume, new Object[0]);
        if (this.isResume) {
            int i = SP.get(Constant.DECTDE_TYPE, 0);
            if (i != 0 && !z) {
                if (i == 1 || i == 2) {
                    if (this.exoPlayerView != null) {
                        this.exoPlayerView = null;
                        releasePlayer();
                    }
                    SharedPreferences defaultSharedPreferences = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
                    defaultSharedPreferences.edit().putBoolean(getApplicationContext().getString(com.aplicativox.primeiptvplus.R.string.pref_key_using_media_codec), i == 1).apply();
                    if (this.ijkVideoView == null || this.lastType != i) {
                        L.i("first ijk init", new Object[0]);
                        IjkVideoView ijkVideoView = this.ijkVideoView;
                        if (ijkVideoView != null) {
                            ijkVideoView.release(true);
                            this.ijkVideoView = null;
                        }
                        this.ijkVideoView = new IjkVideoView(this);
                        this.ijkVideoView.setAspectRatio(1);
                        this.videoView.removePlayer();
                        this.videoView.setPlayer(this.ijkVideoView);
                        if (this.videoView.getLoadingView().getVisibility() == 0) {
                            this.videoView.getLoadingView().setVisibility(8);
                        }
                    }
                    this.lastType = i;
                    this.ijkVideoView.setVideoPath(str, false);
                    this.ijkVideoView.start();
                    return;
                }
                return;
            }
            IjkVideoView ijkVideoView2 = this.ijkVideoView;
            if (ijkVideoView2 != null) {
                ijkVideoView2.release(true);
                this.ijkVideoView = null;
            }
            if (this.exoPlayerView == null) {
                L.i("frist exoplayer", new Object[0]);
                this.exoPlayerView = new SimpleExoPlayerView(this);
                this.exoPlayerView.setUseController(false);
                this.videoView.removePlayer();
                this.videoView.setPlayer(this.exoPlayerView);
                this.exoPlayerView.setResizeMode(3);
                if (this.videoView.getLoadingView().getVisibility() == 8) {
                    this.videoView.getLoadingView().setVisibility(0);
                }
            }
            L.i("current url :" + str, new Object[0]);
            releasePlayer();
            initializePlayer();
            MediaSource mediaSource = this.videoSource;
            if (mediaSource != null) {
                mediaSource.releaseSource(null);
                this.videoSource = null;
            }
            this.videoSource = buildMediaSource(Uri.parse(str), null);
            this.player.prepare(this.videoSource);
            this.player.setPlayWhenReady(true);
        }
    }

    private void playNWidthSeek(String str, boolean z, long j) {
        if (this.isResume) {
            int i = SP.get(Constant.DECTDE_TYPE, 0);
            if (i != 0 && !z) {
                if (i == 1 || i == 2) {
                    if (this.exoPlayerView != null) {
                        this.exoPlayerView = null;
                        releasePlayer();
                    }
                    if (this.ijkVideoView == null || this.lastType != i) {
                        L.i("first ijk init", new Object[0]);
                        IjkVideoView ijkVideoView = this.ijkVideoView;
                        if (ijkVideoView != null) {
                            ijkVideoView.release(true);
                            this.ijkVideoView = null;
                        }
                        this.videoView.removeAllViews();
                        this.ijkVideoView = new IjkVideoView(this);
                        this.videoView.addView(this.ijkVideoView);
                        if (this.videoView.getLoadingView().getVisibility() == 0) {
                            this.videoView.getLoadingView().setVisibility(8);
                        }
                        setScreen();
                    }
                    this.lastType = i;
                    this.ijkVideoView.setVideoPath(str, false);
                    this.ijkVideoView.start();
                    return;
                }
                return;
            }
            IjkVideoView ijkVideoView2 = this.ijkVideoView;
            if (ijkVideoView2 != null) {
                ijkVideoView2.release(true);
                this.ijkVideoView = null;
            }
            if (this.exoPlayerView == null) {
                L.i("frist exoplayer", new Object[0]);
                this.videoView.removePlayer();
                this.exoPlayerView = new PlayerView(this);
                this.exoPlayerView.setUseController(false);
                this.videoView.setPlayer(this.exoPlayerView);
                if (this.videoView.getLoadingView().getVisibility() == 8) {
                    this.videoView.getLoadingView().setVisibility(0);
                }
                setScreen();
            }
            if (j > 0) {
                invisiableOtherView(true);
                this.videoView.removePlayer();
            }
            L.i("current url :" + str + " seek : " + j, new Object[0]);
            releasePlayer();
            initializePlayer();
            this.player.prepare(this.videoSource, false, false);
            this.player.setPlayWhenReady(true);
        }
    }

    private void playVod(String str) {
        if (NetUtil.isNetworkAvailable()) {
            playN(str, true);
        } else {
            setNetworkError();
        }
    }

    private void releasePlayer() {
        if (this.player != null) {
            updateResumePosition();
            this.player.release();
            this.player = null;
            this.trackSelector = null;
            this.eventLogger = null;
        }
    }

    public void saveDate() {
        SP.put(Constant.UPDATE_DATE, new SimpleDateFormat("yyyy-MM-dd", Locale.getDefault()).format(Calendar.getInstance(Locale.getDefault()).getTime()));
    }

    private void setClickListener() {
        this.liveList.setOnChannelClick(new AnonymousClass14());
    }

    private void setFocuseListener() {
        this.videoView.setOnFocusChangeListener(new View.OnFocusChangeListener() {
            @Override
            public void onFocusChange(View view, boolean z) {
                LiveActivity.this.videoView.setVideoItemViewBackground(z);
            }
        });
        this.videoView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (LiveActivity.this.liveList.getVisibility() == 0) {
                    LiveActivity.this.currentToFullScreen();
                    LiveActivity.this.videoView.setVideoItemViewBackground(false);
                } else if (LiveActivity.this.liveList.getVisibility() == 8) {
                    LiveActivity.this.fullScreenToBack();
                }
            }
        });
    }

    public void setNetworkError() {
        this.videoView.getLoadingView().setVideoNetError();
    }

    private void setNumText(String str) {
        this.videoView.setChanNum(str);
        this.videoView.setChanNumVisiable(true);
        this.numVisibleTask.cancelAndDelayRun(new Runnable() {
            @Override
            public void run() {
                LiveActivity.this.videoView.setChanNumVisiable(false);
            }
        }, 3000L);
    }

    private void setScreen() {
        EventBus.getDefault().post(new ChangeVedioLayout(SP.get("screen_size", 0)));
    }

    public void showQHDRenew() {
        LoginTypeEntry xtreamEntry = AccountUtil.getXtreamEntry();
        if (xtreamEntry != null && xtreamEntry.getId() == 0 && isShouldRenew(xtreamEntry.getMsg())) {
            showRenewDialogQHD();
            Log.d("test", "test active");
        }
    }

    private void showRenewDialog() {
        this.dialogRenew = new Dialog(this, com.aplicativox.primeiptvplus.R.style.DialogTheme);
        this.dialogRenew.setContentView(com.aplicativox.primeiptvplus.R.layout.renew_dialog);
        new Thread(this.k).start();
        this.dialogRenew.setOnKeyListener(new DialogInterface.OnKeyListener() {
            @Override
            public boolean onKey(DialogInterface dialogInterface, int i, KeyEvent keyEvent) {
                if (i == 23 && keyEvent.getAction() == 0) {
                    dialogInterface.dismiss();
                    return true;
                }
                return false;
            }
        });
        this.dialogRenew.show();
    }

    private void showRenewDialog(String[] strArr) {
        this.dialogRenew = new Dialog(this, com.aplicativox.primeiptvplus.R.style.DialogTheme);
        this.dialogRenew.setContentView(com.aplicativox.primeiptvplus.R.layout.renew_dialog);
        Glide.with(getApplicationContext()).load(strArr[3]).into((ImageView) this.dialogRenew.findViewById(com.aplicativox.primeiptvplus.R.id.renew_imgview));
        ((TextView) this.dialogRenew.findViewById(com.aplicativox.primeiptvplus.R.id.renew_text_dialog)).setText(strArr[1] + " " + strArr[2]);
        this.dialogRenew.setOnKeyListener(new DialogInterface.OnKeyListener() {
            @Override
            public boolean onKey(DialogInterface dialogInterface, int i, KeyEvent keyEvent) {
                if (i == 23 && keyEvent.getAction() == 0) {
                    dialogInterface.dismiss();
                    return true;
                }
                return false;
            }
        });
        this.dialogRenew.show();
    }

    private void showRenewDialogQHD() {
        this.dialogRenew = new Dialog(this, com.aplicativox.primeiptvplus.R.style.DialogTheme);
        this.dialogRenew.setContentView(com.aplicativox.primeiptvplus.R.layout.renew_dialog);
        String str = DBManager.getUserInfo().activeCode;
        L.i("current qhd code:" + str, new Object[0]);
        this.mDisposable = ApiManager.getRenewInfo(str, "seller_ad", "f2fa285311b54fa5bf22e6acbb148877066227db").subscribe(new Consumer<RenewInfoQHD>() {
            @Override
            public void accept(RenewInfoQHD renewInfoQHD) throws Exception {
                L.d("renew from " + renewInfoQHD.renew.renew_msg + " renew msg url :" + renewInfoQHD.renew.renew_img, new Object[0]);
                StringBuilder sb = new StringBuilder();
                sb.append(renewInfoQHD.renew.renew_msg);
                sb.append("\t");
                sb.append(renewInfoQHD.renew.renew_url);
                ((TextView) LiveActivity.this.dialogRenew.findViewById(com.aplicativox.primeiptvplus.R.id.renew_text_dialog)).setText(sb.toString());
                RequestManager with = Glide.with(LiveActivity.this.getApplicationContext());
                with.load("https://" + renewInfoQHD.renew.renew_img).into((ImageView) LiveActivity.this.dialogRenew.findViewById(com.aplicativox.primeiptvplus.R.id.renew_imgview));
            }
        }, new Consumer<Throwable>() {
            @Override
            public void accept(Throwable th) throws Exception {
                L.i("throwable:" + th, new Object[0]);
            }
        });
        this.dialogRenew.setOnKeyListener(new DialogInterface.OnKeyListener() {
            @Override
            public boolean onKey(DialogInterface dialogInterface, int i, KeyEvent keyEvent) {
                if (i == 23 && keyEvent.getAction() == 0) {
                    dialogInterface.dismiss();
                    return true;
                }
                return false;
            }
        });
        this.dialogRenew.show();
    }

    private void showUpdateDialog() {
        if (this.updateDialog == null) {
            this.updateDialog = new UpdateChanListDialog(this);
        }
        this.updateDialog.create();
        this.updateDialog.show();
        getAllChannels();
    }

    private void updateResumePosition() {
        this.resumeWindow = this.player.getCurrentWindowIndex();
        this.resumePosition = this.player.isCurrentWindowSeekable() ? Math.max(0L, this.player.getCurrentPosition()) : C.TIME_UNSET;
    }

    @Subscribe(threadMode = ThreadMode.MAIN)
    public void changeLayout(ChangeVedioLayout changeVedioLayout) {
        L.i("change layout msg : " + changeVedioLayout.getLayoutType(), new Object[0]);
        SP.put("screen_size", changeVedioLayout.getLayoutType());
        IjkVideoView ijkVideoView = this.ijkVideoView;
        if (ijkVideoView != null) {
            changeIjkSizeMode(ijkVideoView, changeVedioLayout.getLayoutType());
            return;
        }
        PlayerView playerView = this.exoPlayerView;
        if (playerView != null) {
            changeExoSizeMode(playerView, changeVedioLayout.getLayoutType());
        }
    }

    public void currentToFullScreen() {
        invisiableOtherView(true);
    }

    public void currentToTopAnim(VideoItemView videoItemView, PointF pointF) {
        L.i("current x :" + pointF.x, new Object[0]);
        L.i("current y :" + pointF.y, new Object[0]);
        ObjectAnimator ofFloat = ObjectAnimator.ofFloat(videoItemView.getPlayView(), "x", pointF.x);
        ObjectAnimator ofFloat2 = ObjectAnimator.ofFloat(videoItemView.getPlayView(), "y", pointF.y);
        ObjectAnimator ofFloat3 = ObjectAnimator.ofFloat(videoItemView.getPlayView(), "scaleX", 1.0f, 2.0f);
        ObjectAnimator ofFloat4 = ObjectAnimator.ofFloat(videoItemView.getPlayView(), "scaleY", 1.0f, 2.0f);
        AnimatorSet animatorSet = new AnimatorSet();
        animatorSet.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animator) {
                super.onAnimationEnd(animator);
            }
        });
        animatorSet.setDuration(300L);
        animatorSet.playTogether(ofFloat, ofFloat2, ofFloat3, ofFloat4);
        animatorSet.start();
    }

    public void fullScreenToBack() {
        invisiableOtherView(false);
    }

    public void getPackages(Long l) {
        if (l.longValue() == -1) {
            l = null;
        }
        this.mDisposable = ApiManager.getLivePackageListQHD(l, DBManager.getUserInfo()).flatMap(new Function<PackageList, Observable<Package>>() {
            @Override
            public Observable<Package> apply(PackageList packageList) throws Exception {
                return Observable.fromIterable(packageList.bouquets);
            }
        }).filter(new Predicate<Package>() {
            @Override
            public boolean test(Package r2) throws Exception {
                return r2.type.equals("2");
            }
        }).flatMap(new Function<Package, Observable<PackageList>>() {
            @Override
            public Observable<PackageList> apply(Package r2) throws Exception {
                return ApiManager.getLivePackageListQHD(r2.id, DBManager.getUserInfo());
            }
        }).flatMap(new Function<PackageList, Observable<Package>>() {
            @Override
            public Observable<Package> apply(PackageList packageList) throws Exception {
                return Observable.fromIterable(packageList.bouquets);
            }
        }).filter(new Predicate<Package>() {
            @Override
            public boolean test(Package r2) throws Exception {
                return r2.type.equals("1");
            }
        }).flatMap(new Function<Package, Observable<Channels>>() {
            @Override
            public Observable<Channels> apply(Package r2) throws Exception {
                return ApiManager.getLiveChannelsQHD(r2.id, DBManager.getUserInfo());
            }
        }).doFinally(new Action() {
            @Override
            public void run() throws Exception {
                L.i("get channel doFinally " + Thread.currentThread().getName(), new Object[0]);
                LiveActivity.this.getOtherPackageChannels();
            }
        }).subscribe(new Consumer<Channels>() {
            @Override
            public void accept(Channels channels) throws Exception {
            }
        }, this.emptyAction);
    }

    public String getVideoType() {
        String str = SP.get(Constant.LOGIN_TYPE);
        if (TextUtils.isEmpty(str)) {
            return "";
        }
        String[] split = str.split("@");
        return split.length >= 2 ? split[0] : "";
    }

    public String getVideoType(String str) {
        if (TextUtils.isEmpty(str)) {
            return "";
        }
        String[] split = str.split("@");
        return split.length >= 2 ? split[0] : "";
    }

    @Override
    public void onBackPressed() {
        super.onBackPressed();
    }

    @Override
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        setContentView(com.aplicativox.primeiptvplus.R.layout.activity_live);
        ButterKnife.bind(this);
        this.videoView.hideScyleIcon();
        init();
        clearResumePosition();
        this.mediaDataSourceFactory = buildDataSourceFactory(true);
        CookieHandler cookieHandler = CookieHandler.getDefault();
        CookieManager cookieManager = DEFAULT_COOKIE_MANAGER;
        if (cookieHandler != cookieManager) {
            CookieHandler.setDefault(cookieManager);
        }
        setClickListener();
        setFocuseListener();
        checkWhetherUpdateList();
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        Disposable disposable = this.mDisposable;
        if (disposable != null) {
            disposable.dispose();
        }
    }

    @Override
    public boolean onKeyDown(int i, KeyEvent keyEvent) {
        DelayTask delayTask;
        Runnable runnable;
        if (this.liveList.getVisibility() == 8 && (keyEvent.getKeyCode() == 4 || keyEvent.getKeyCode() == 23 || keyEvent.getKeyCode() == 66)) {
            fullScreenToBack();
            return true;
        }
        if (keyEvent.getAction() == 0) {
            L.i("liveAcitivity keycode:" + keyEvent.getKeyCode(), new Object[0]);
            if (keyEvent.getKeyCode() == 19) {
                if (this.liveList.getVisibility() == 8) {
                    onUp();
                    return true;
                }
            } else if (keyEvent.getKeyCode() == 20) {
                if (this.liveList.getVisibility() == 8) {
                    onDown();
                }
                return true;
            } else if (keyEvent.getKeyCode() == 21) {
                L.i("liveAcitivity left click", new Object[0]);
            } else if (keyEvent.getKeyCode() == 22) {
                L.i("liveAcitivity right click", new Object[0]);
                if (this.liveList.getParentView().getChildCount() == 2 && this.liveList.getParentView().getChildAt(1).hasFocus()) {
                    L.i("liveAcitivity videoView focus", new Object[0]);
                    this.videoView.setFocusable(true);
                    this.videoView.requestFocus();
                    return true;
                }
            } else if (i >= 7 && i <= 16) {
                if (this.liveList.getVisibility() == 0) {
                    return true;
                }
                if (this.numCheck.isDoubleAction(AdaptiveTrackSelection.DEFAULT_MIN_TIME_BETWEEN_BUFFER_REEVALUTATION_MS)) {
                    if (this.numCache.length() < 2) {
                        this.numCache += String.valueOf(i - 7);
                        setNumText(this.numCache);
                        delayTask = this.numTask;
                        runnable = new Runnable() {
                            @Override
                            public void run() {
                                LiveActivity.this.liveList.onNumClick(Integer.parseInt(LiveActivity.this.numCache));
                            }
                        };
                        delayTask.cancelAndDelayRun(runnable, 2001L);
                    } else if (this.numCache.length() == 2) {
                        this.numCache += String.valueOf(i - 7);
                        setNumText(this.numCache);
                        this.numTask.cancel();
                        this.liveList.onNumClick(Integer.parseInt(this.numCache));
                    }
                } else if (i == 7) {
                    this.numCheck.reset();
                } else {
                    this.numCache = String.valueOf(i - 7);
                    setNumText(this.numCache);
                    delayTask = this.numTask;
                    runnable = new Runnable() {
                        @Override
                        public void run() {
                            LiveActivity.this.liveList.onNumClick(Integer.parseInt(LiveActivity.this.numCache));
                        }
                    };
                    delayTask.cancelAndDelayRun(runnable, 2001L);
                }
                return true;
            }
        }
        return super.onKeyDown(i, keyEvent);
    }

    @Override
    public void onPause() {
        super.onPause();
        EventBus.getDefault().unregister(this);
        IjkVideoView ijkVideoView = this.ijkVideoView;
        if (ijkVideoView != null) {
            ijkVideoView.release(true);
            this.ijkVideoView = null;
        }
        if (this.exoPlayerView != null) {
            this.exoPlayerView = null;
            releasePlayer();
        }
        this.isResume = false;
    }

    @Override
    public void onResume() {
        super.onResume();
        this.isResume = true;
        EventBus.getDefault().register(this);
    }

    @Override
    public void onVisibilityChange(int i) {
        L.i("onVisibilityChange : " + i, new Object[0]);
    }
}