TIM v2.3.1版本的 MD5 值为:d6957e3ee7ce901ccc491cefdea0da8c

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


package cooperation.qzone;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.text.TextUtils;
import android.view.KeyEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
import com.tencent.av.camera.QavCameraUsage;
import com.tencent.common.app.BaseApplicationImpl;
import com.tencent.image.URLDrawable;
import com.tencent.mobileqq.app.BaseActivity;
import com.tencent.mobileqq.app.QQAppInterface;
import com.tencent.mobileqq.pluginsdk.PluginBaseInfo;
import com.tencent.mobileqq.utils.NetworkUtil;
import com.tencent.mobileqq.widget.QQToast;
import com.tencent.qphone.base.util.QLog;
import com.tencent.smtt.sdk.TbsApkDownloader;
import com.tencent.tim.R;
import common.config.service.QzoneConfig;
import cooperation.qzone.QZoneHelper;
import cooperation.qzone.plugin.PluginRecord;
import cooperation.qzone.report.lp.LpReportInfo_dc00321;
import cooperation.qzone.report.lp.LpReportInfo_dc01500;
import cooperation.qzone.video.QzoneLiveVideoPluginProxyActivity;
import cooperation.qzone.video.QzoneVideoBeaconReport;
import java.util.concurrent.atomic.AtomicBoolean;
import mqq.app.AppRuntime;
public abstract class QZoneLiveVideoBaseDownLoadActivty extends BaseActivity {
    public static final int f98388a = 1003;
    public static final String f70183a = "QZoneLiveVideoBaseDownLoadActivty";
    public static final int f98389b = 1000;
    public static final int f98390c = 1004;
    public static final int d = 1005;
    public static final int e = 1006;
    public static final int f = 1007;
    public static final int g = 1008;
    public static final int h = 1009;
    public static final int i = 0;
    public static final int j = 1;
    public static final int k = 3;
    public static final int l = 1;
    protected static final int m = 500;
    protected long f70184a;
    protected BroadcastReceiver f70185a;
    private View f70188a;
    private ViewGroup f70189a;
    private ImageView f70190a;
    private ProgressBar f70191a;
    private TextView f70192a;
    private URLDrawable f70193a;
    public volatile boolean f70195a;
    private long f70196b;
    private ImageView f70198b;
    private TextView f70199b;
    protected String f70200b;
    public boolean f70201b;
    protected String f70202c;
    protected boolean f70203c;
    private String f70204d;
    protected boolean f70205d;
    private String f70206e;
    public boolean f70207e;
    private String f70208f;
    private String f70209g;
    private String f70210h;
    private String f70211i;
    private String f70212j;
    private String f70213k;
    protected int n;
    protected int o;
    public int p;
    private int q;
    private AtomicBoolean f70194a = new AtomicBoolean(false);
    public Handler f70186a = new xzd(this);
    private View.OnClickListener f70187a = new xzf(this);
    private View.OnClickListener f70197b = new xzg(this);

    protected abstract PluginBaseInfo a(String str);

    protected abstract void c();

    public String a() {
        return PluginRecord.f70593a;
    }

    public void a(Handler handler, Message message) {
        switch (message.what) {
            case 1000:
                if (QLog.isDevelopLevel()) {
                    QLog.d(f70183a, 4, "MSG_INIT_UI, mIsUIInited=" + this.f70194a);
                }
                if (!this.f70194a.get()) {
                    a(message.arg1);
                    this.f70194a.set(true);
                }
                handler.sendEmptyMessage(1005);
                return;
            case 1001:
            case 1002:
            case 1007:
            default:
                return;
            case 1003:
                this.f70201b = false;
                int config = QzoneConfig.getInstance().getConfig("LiveSetting", QzoneConfig.SECONDARY_PLUGIN_RETRY_DOWNLOAD_TIMES, 1);
                QLog.w(f70183a, 4, "MSG_INSTALL_PLUGIN_ERROR, retryDownloadNum=" + this.n);
                if (this.n < config) {
                    this.n++;
                    b();
                    return;
                }
                this.f70203c = true;
                this.f70201b = false;
                a(true, false);
                return;
            case 1004:
                b(message.arg1);
                return;
            case 1005:
                if (QLog.isDevelopLevel()) {
                    QLog.d(f70183a, 4, "MSG_QUERY_PLUGIN_STATE");
                }
                if (!isFinishing()) {
                    a(a(), a(a()));
                    return;
                }
                return;
            case 1006:
                this.f70203c = true;
                this.f70201b = false;
                return;
            case 1008:
                this.f70205d = false;
                int config2 = QzoneConfig.getInstance().getConfig("LiveSetting", QzoneConfig.SECONDARY_PLUGIN_RETRY_DOWNLOADSO_TIMES, 1);
                QLog.w(f70183a, 4, "MSG_DOWNLOAD_SO_ERROR, retryDownloadSoNum=" + config2);
                if (this.o < config2) {
                    this.o++;
                    g();
                    return;
                }
                this.f70207e = true;
                this.f70205d = false;
                a(true, true);
                return;
            case 1009:
                this.f70207e = true;
                this.f70205d = false;
                return;
        }
    }

    public void a(boolean z, boolean z2) {
        if (this.f70199b != null) {
            if (z) {
                this.f70199b.setText("下载超时,请点击重试");
            } else if (z2) {
                this.f70199b.setText("升级中,请稍候...");
            } else {
                this.q %= 3;
                switch (this.q) {
                    case 0:
                        this.f70199b.setText("升级中,请稍候.");
                        break;
                    case 1:
                        this.f70199b.setText("升级中,请稍候..");
                        break;
                    case 2:
                        this.f70199b.setText("升级中,请稍候...");
                        break;
                }
                this.q++;
            }
        }
    }

    public boolean mo10876a(PluginBaseInfo pluginBaseInfo) {
        return pluginBaseInfo != null;
    }

    public void a(PluginBaseInfo pluginBaseInfo) {
        if (this.f70194a.get()) {
            int i2 = (int) (pluginBaseInfo.mDownloadProgress * 100.0f);
            if (QLog.isColorLevel()) {
                QLog.d(f70183a, 2, "handlePluginInfo, STATE_DOWNLOADING, progress=" + i2);
            }
            if (i2 > 0) {
                this.f70186a.removeMessages(1006);
                this.f70186a.obtainMessage(1004, i2, 0).sendToTarget();
                a(false, false);
            } else if (this.f70203c) {
                this.f70186a.removeMessages(1006);
                a(true, false);
            }
        }
        this.f70186a.sendEmptyMessageDelayed(1005, 500L);
    }

    public void a(String str, PluginBaseInfo pluginBaseInfo) {
        if (mo10876a(pluginBaseInfo)) {
            switch (pluginBaseInfo.mState) {
                case -2:
                    if (QLog.isColorLevel()) {
                        QLog.d(f70183a, 2, "handlePluginInfo, STATE_ERROR");
                    }
                    this.f70186a.sendEmptyMessage(1003);
                    return;
                case -1:
                default:
                    if (QLog.isColorLevel()) {
                        QLog.d(f70183a, 2, "handlePluginInfo, STATE=" + pluginBaseInfo.mState);
                        return;
                    }
                    return;
                case 0:
                    if (QLog.isColorLevel()) {
                        QLog.d(f70183a, 2, "handlePluginInfo, STATE_NODOWNLOAD");
                    }
                case 1:
                    if (QLog.isColorLevel()) {
                        QLog.d(f70183a, 2, "handlePluginInfo, STATE_DOWNLOADING");
                        break;
                    }
                    break;
                case 2:
                    break;
                case 3:
                    if (QLog.isColorLevel()) {
                        QLog.d(f70183a, 2, "handlePluginInfo, STATE_INSTALLING");
                    }
                    this.f70186a.sendEmptyMessageDelayed(1005, 500L);
                    return;
                case 4:
                    if (QLog.isColorLevel()) {
                        QLog.d(f70183a, 2, "handlePluginInfo, STATE_INSTALLED");
                    }
                    f();
                    return;
            }
            a(pluginBaseInfo);
        }
    }

    @Override
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        if (this.mSystemBarComp != null) {
            this.mSystemBarComp.f68903a = false;
        }
        setContentView(R.layout.f57931name_res_0x7f030632);
        this.f70189a = (ViewGroup) findViewById(R.id.f54656name_res_0x7f091d9d);
        this.f70188a = findViewById(R.id.f54655name_res_0x7f091d9c);
    }

    public class LaunchCompletedObserver extends BroadcastReceiver {
        private String f70214a;
        private String f98392b;

        public LaunchCompletedObserver(String str, String str2) {
            this.f70214a = str;
            this.f98392b = str2;
        }

        @Override
        public void onReceive(Context context, Intent intent) {
            String stringExtra = intent.getStringExtra("plugin_apk");
            String stringExtra2 = intent.getStringExtra("plugin_name");
            if (QLog.isColorLevel()) {
                QLog.d(QZoneLiveVideoBaseDownLoadActivty.f70183a, 1, "LaunchCompletedObserver.onReceive: " + stringExtra + ", " + stringExtra2);
            }
            if (this.f98392b.equalsIgnoreCase(stringExtra) && stringExtra2 != null) {
                QZoneLiveVideoBaseDownLoadActivty.this.m10874a();
            }
        }
    }

    public boolean m10875a() {
        if (getAppRuntime() != null) {
            this.f70202c = getAppRuntime().getAccount();
        }
        Intent intent = getIntent();
        if (intent == null) {
            QLog.w(f70183a, 1, "intent is null");
            Toast.makeText(getApplicationContext(), "参数错误,无法启动", 1).show();
            QzoneVideoBeaconReport.a(this.f70202c, QzoneVideoBeaconReport.aO, "6", null);
            LpReportInfo_dc01500.reportLaunch(PluginRecord.f70593a, "", 0.0d, 3, "0");
            finish();
            return false;
        }
        this.p = intent.getIntExtra("mode", 0);
        this.f70184a = intent.getLongExtra(QZoneHelper.Constants.K, System.currentTimeMillis());
        if (3 != this.p && 1 != this.p) {
            QLog.w(f70183a, 1, "mode invalid, mMode=" + this.p);
            Toast.makeText(getApplicationContext(), "参数错误,无法启动, mode=" + this.p, 1).show();
            QzoneVideoBeaconReport.a(this.f70202c, QzoneVideoBeaconReport.aO, "6", null);
            LpReportInfo_dc01500.reportLaunch(PluginRecord.f70593a, "", (System.currentTimeMillis() - this.f70184a) / 1000.0d, 3, this.p + "");
            finish();
            return false;
        } else if (!NetworkUtil.h(getApplicationContext())) {
            QLog.w(f70183a, 1, "onCreate, no network available");
            QQToast.a(this, "网络无连接,请检查你的网络连接", 0).m9833a();
            if (this.p == 1) {
                QzoneVideoBeaconReport.a(this.f70202c, QzoneVideoBeaconReport.aO, "2", null);
            }
            LpReportInfo_dc01500.reportLaunch(PluginRecord.f70593a, "", (System.currentTimeMillis() - this.f70184a) / 1000.0d, 4, this.p + "");
            finish();
            return false;
        } else if (LocalMultiProcConfig.a("state", "idle").equals("installing")) {
            QLog.w(f70183a, 1, "onCreate, plugin installing");
            QQToast.a(this, "插件正在升级,请稍候", 0).m9833a();
            if (this.p == 1) {
                LpReportInfo_dc00321.report(8, 128, 3, false, false);
                QzoneVideoBeaconReport.a(this.f70202c, QzoneVideoBeaconReport.aO, "5", null);
            }
            LpReportInfo_dc01500.reportLaunch(PluginRecord.f70593a, "", (System.currentTimeMillis() - this.f70184a) / 1000.0d, 5, this.p + "");
            finish();
            return false;
        } else {
            AppRuntime appRuntime = getAppRuntime();
            if (appRuntime != null && ((QQAppInterface) appRuntime).m4707d()) {
                Toast.makeText(getApplicationContext(), "正在通话中,请结束通话后再试", 1).show();
                if (this.p == 1) {
                    QzoneVideoBeaconReport.a(this.f70202c, QzoneVideoBeaconReport.aO, "7", null);
                }
                LpReportInfo_dc01500.reportLaunch(PluginRecord.f70593a, "", (System.currentTimeMillis() - this.f70184a) / 1000.0d, 2, this.p + ",1");
                finish();
                return false;
            } else if (QavCameraUsage.b(BaseApplicationImpl.getContext())) {
                Toast.makeText(getApplicationContext(), "摄像头正在使用中,请稍候再试", 1).show();
                if (this.p == 1) {
                    QzoneVideoBeaconReport.a(this.f70202c, QzoneVideoBeaconReport.aO, "8", null);
                }
                LpReportInfo_dc01500.reportLaunch(PluginRecord.f70593a, "", (System.currentTimeMillis() - this.f70184a) / 1000.0d, 2, this.p + ",2");
                finish();
                return false;
            } else {
                this.f70200b = intent.getStringExtra(TbsApkDownloader.BACKUPNAME);
                this.f70204d = intent.getStringExtra("room_id");
                this.f70212j = intent.getStringExtra("current_uin");
                QLog.d(f70183a, 1, "mRoomId=" + this.f70204d + ", mBackUrl=" + this.f70200b + ", mCurrentUin=" + this.f70212j);
                this.f70196b = intent.getLongExtra("host_uin", 0L);
                this.f70206e = intent.getStringExtra("video_play_source");
                this.f70208f = intent.getStringExtra("feeds_type");
                this.f70209g = intent.getStringExtra("shuo_id");
                this.f70210h = intent.getStringExtra("repost_uin");
                this.f70211i = intent.getStringExtra("video_play_scene");
                this.f70213k = intent.getStringExtra("entranceReferId");
                return true;
            }
        }
    }

    public void a(int i2) {
        this.f70188a.setVisibility(8);
        this.f70189a.setVisibility(0);
        this.f70192a = (TextView) findViewById(R.id.f54658name_res_0x7f091d9f);
        this.f70191a = (ProgressBar) findViewById(R.id.f54659name_res_0x7f091da0);
        this.f70199b = (TextView) findViewById(R.id.f48903name_res_0x7f090723);
        this.f70190a = (ImageView) findViewById(R.id.f52853name_res_0x7f091691);
        this.f70198b = (ImageView) findViewById(R.id.f54657name_res_0x7f091d9e);
        try {
            this.f70193a = URLDrawable.getDrawable("http://qzonestyle.gtimg.cn/qzone/phone/n/QQ-Qzone-Android/qzone_live_video_download_bg.png", (URLDrawable.URLDrawableOptions) null);
            if (this.f70193a != null) {
                this.f70198b.setImageDrawable(this.f70193a);
            }
            this.f70193a.setURLDrawableListener(new xze(this));
        } catch (Exception e2) {
            QLog.d(f70183a, 1, "initUI", e2);
        }
        this.f70190a.setOnClickListener(this.f70197b);
        if (i2 == 0) {
            this.f70199b.setText("升级中,请稍候...");
        } else {
            this.f70199b.setText("立即升级");
        }
        this.f70199b.setOnClickListener(this.f70187a);
    }

    protected void b(int i2) {
        if (this.f70191a != null) {
            this.f70191a.setProgress(i2);
        }
    }

    public void m10874a() {
        finish();
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        this.f70186a.removeMessages(1005);
        this.f70186a.removeMessages(1006);
        if (this.f70185a != null) {
            try {
                if (QLog.isColorLevel()) {
                    QLog.d(f70183a, 1, "unregisterReceiver");
                }
                unregisterReceiver(this.f70185a);
            } catch (Exception e2) {
                QLog.w(f70183a, 1, "", e2);
            }
            this.f70185a = null;
        }
    }

    @Override
    public boolean onKeyDown(int i2, KeyEvent keyEvent) {
        if (4 == i2) {
            this.f70195a = true;
        }
        return super.onKeyDown(i2, keyEvent);
    }

    public void b() {
        if (QLog.isColorLevel()) {
            QLog.d(f70183a, 2, "installPlugin");
        }
        this.f70203c = false;
        this.f70201b = true;
        Message obtain = Message.obtain();
        obtain.what = 1000;
        obtain.arg1 = 0;
        this.f70186a.sendMessage(obtain);
        this.f70186a.sendEmptyMessageDelayed(1006, QzoneConfig.getInstance().getConfig("LiveSetting", QzoneConfig.SECONDARY_PLUGIN_INSTALL_TIMEOUT, 60000));
    }

    public void d() {
        this.f70201b = false;
    }

    public void e() {
        if (this.f70195a) {
            QLog.w(f70183a, 1, "launch has canceled");
            return;
        }
        if (this.f70189a != null) {
            this.f70189a.setVisibility(8);
        }
        if (this.f70188a != null) {
            this.f70188a.setVisibility(0);
        }
        String str = "";
        if (getAppRuntime() != null) {
            str = getAppRuntime().getAccount();
        } else if (!TextUtils.isEmpty(this.f70212j)) {
            QLog.w(f70183a, 1, "launchLiveVideo, getAppRuntime is null");
            str = this.f70212j;
        }
        if (QLog.isColorLevel()) {
            QLog.d(f70183a, 2, "launchLiveVideo, account=" + str);
        }
        if (TextUtils.isEmpty(str)) {
            QQToast.a(this, "获取帐号信息失败,请稍候再试", 0).m9833a();
            LpReportInfo_dc01500.reportLaunch(PluginRecord.f70593a, "", (System.currentTimeMillis() - this.f70184a) / 1000.0d, 6, this.p + "");
            m10874a();
            return;
        }
        Intent intent = new Intent();
        intent.putExtra("room_id", this.f70204d);
        intent.putExtra("mode", this.p);
        intent.putExtra("video_play_source", this.f70206e);
        intent.putExtra("feeds_type", this.f70208f);
        intent.putExtra("shuo_id", this.f70209g);
        intent.putExtra("repost_uin", this.f70210h);
        intent.putExtra("video_play_scene", this.f70211i);
        intent.putExtra("entranceReferId", this.f70213k);
        intent.putExtra(QZoneHelper.Constants.K, this.f70184a);
        QzoneLiveVideoPluginProxyActivity.a(this, str, intent, -1);
    }

    public void f() {
        if (this.p == 1) {
            g();
        } else {
            e();
        }
    }

    protected void g() {
    }
}