导航菜单

页面标题

页面副标题

饼干视频 v4.1.0 - MQLandscapeVideoActivity.java 源代码

正在查看: 饼干视频 v4.1.0 应用的 MQLandscapeVideoActivity.java JAVA 源代码文件

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


package com.moqi.sdk.activity;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.text.TextUtils;
import android.util.DisplayMetrics;
import android.view.KeyEvent;
import android.view.TextureView;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.appcompat.widget.AppCompatButton;
import androidx.constraintlayout.widget.ConstraintLayout;
import com.moqi.sdk.R;
import com.moqi.sdk.cache.b;
import com.moqi.sdk.download2.a;
import com.moqi.sdk.manager.http.RequestImpl;
import com.moqi.sdk.model.MoQiAd;
import com.moqi.sdk.receiver.DownLoadReceiver;
import com.moqi.sdk.utils.h0;
import com.moqi.sdk.utils.o;
import com.moqi.sdk.utils.s;
import com.moqi.sdk.utils.t;
import com.moqi.sdk.utils.w;
import com.moqi.sdk.view.CircleProgressBar;
import com.qq.e.comm.managers.setting.GlobalSetting;
import com.tencent.mm.opensdk.modelmsg.WXMediaMessage;
import java.io.File;
import java.io.Serializable;
import java.util.List;
import java.util.Timer;
import java.util.TimerTask;

public class MQLandscapeVideoActivity extends Activity implements DownLoadReceiver.a, View.OnClickListener {
    private static final String B = "PARAMS_AD";
    private static final String C = "PARAMS_OPENSOUND";
    private MoQiAd a;
    private ImageView b;
    private TextView c;
    private TextView d;
    private ProgressButton e;
    private LinearLayout f;
    private CircleProgressBar g;
    private ImageView h;
    private ImageView i;
    private w j;
    private DownLoadReceiver l;
    private TextureView m;
    private View n;
    private List<MoQiAd> r;
    private int t;
    private TextView u;
    private Timer w;
    private boolean k = true;
    private boolean o = false;
    private int p = 0;
    public int q = 0;
    private int s = 0;
    private int v = 0;
    private int x = 0;
    private int y = 0;

    @SuppressLint({"HandlerLeak"})
    public final Handler z = new e();
    private String A = "";

    public class a implements w.c {
        public a() {
        }

        @Override
        public void a() {
            if (MQLandscapeVideoActivity.this.r.size() <= MQLandscapeVideoActivity.this.s + 1) {
                if (MQLandscapeVideoActivity.this.a != null) {
                    MQLandscapeVideoActivity.this.a.upActionEvent(1, "");
                    MQLandscapeVideoActivity mQLandscapeVideoActivity = MQLandscapeVideoActivity.this;
                    MQPortraitDetailActivity.a(mQLandscapeVideoActivity, mQLandscapeVideoActivity.a);
                }
                MQLandscapeVideoActivity.this.a(2);
                MQLandscapeVideoActivity.this.finish();
                return;
            }
            if (MQLandscapeVideoActivity.this.a != null) {
                MQLandscapeVideoActivity.this.a.upActionEvent(1, "");
            }
            if (MQLandscapeVideoActivity.this.a != null && MQLandscapeVideoActivity.this.y != 0) {
                MQLandscapeVideoActivity.this.a.upActionTimeEvent(111, MQLandscapeVideoActivity.this.y);
                MQLandscapeVideoActivity.this.y = 0;
            }
            MQLandscapeVideoActivity.this.i();
            MQLandscapeVideoActivity.this.k();
            MQLandscapeVideoActivity.this.f();
        }

        @Override
        public void a(double d) {
            MQLandscapeVideoActivity.this.o = true;
            MQLandscapeVideoActivity.this.a();
            MQLandscapeVideoActivity.this.v = (int) (d / 1000.0d);
            MQLandscapeVideoActivity.this.x = 0;
            MQLandscapeVideoActivity.this.d();
            MQLandscapeVideoActivity.this.j.a(MQLandscapeVideoActivity.this.q);
        }

        @Override
        public void a(int i, int i2) {
        }

        @Override
        public void a(String str) {
            MQLandscapeVideoActivity.this.a(3);
        }

        @Override
        public void b() {
            MQLandscapeVideoActivity.this.k();
        }
    }

    public class b implements View.OnClickListener {
        public b() {
        }

        @Override
        public void onClick(View view) {
            MQLandscapeVideoActivity.this.a(4);
            MQLandscapeVideoActivity.this.a.upActionEvent(5, "");
            MQLandscapeVideoActivity.this.finish();
        }
    }

    public class c implements View.OnClickListener {
        public c() {
        }

        @Override
        public void onClick(View view) {
            MQLandscapeVideoActivity.this.j();
        }
    }

    public class d implements b.c<Bitmap> {
        public d() {
        }

        @Override
        public void a(Bitmap bitmap) {
            if (bitmap != null) {
                MQLandscapeVideoActivity.this.b.setImageBitmap(bitmap);
            }
        }
    }

    public class e extends Handler {
        public e() {
        }

        @Override
        public void handleMessage(Message message) {
            super.handleMessage(message);
            if (MQLandscapeVideoActivity.this.t <= 0) {
                MQLandscapeVideoActivity.this.b();
                return;
            }
            if (MQLandscapeVideoActivity.this.t == 5 && MQLandscapeVideoActivity.this.a.isAllDxClickRate == 1) {
                MQLandscapeVideoActivity.this.e.performClick();
                if (MQLandscapeVideoActivity.this.a != null) {
                    MQLandscapeVideoActivity.this.a.upActionEvent(11, "");
                }
            }
            MQLandscapeVideoActivity.s(MQLandscapeVideoActivity.this);
            MQLandscapeVideoActivity.c(MQLandscapeVideoActivity.this);
            MQLandscapeVideoActivity.this.l();
            MQLandscapeVideoActivity.i(MQLandscapeVideoActivity.this);
            try {
                MQLandscapeVideoActivity.this.u.setText(MQLandscapeVideoActivity.this.t + "");
                if (MQLandscapeVideoActivity.this.a.adtype == 2) {
                    MQLandscapeVideoActivity.this.u.setVisibility(0);
                    if (MQLandscapeVideoActivity.this.x >= com.moqi.sdk.d.U) {
                        MQLandscapeVideoActivity.this.h.setVisibility(0);
                    }
                } else if (!MQLandscapeVideoActivity.this.u.isShown()) {
                    MQLandscapeVideoActivity.this.u.setVisibility(0);
                }
                if (MQLandscapeVideoActivity.this.t < 2) {
                    MQLandscapeVideoActivity.this.h.setVisibility(8);
                }
            } catch (Exception e) {
                t.a(e);
            }
        }
    }

    public class f extends TimerTask {
        public f() {
        }

        @Override
        public void run() {
            Message message = new Message();
            message.what = 1;
            MQLandscapeVideoActivity.this.z.sendMessage(message);
        }
    }

    public class g implements Runnable {
        public g() {
        }

        @Override
        public void run() {
            MQLandscapeVideoActivity.this.k();
            MQLandscapeVideoActivity.this.g.setVisibility(8);
        }
    }

    public class h implements a.b {
        public h() {
        }

        @Override
        public void a(int i) {
            if (MQLandscapeVideoActivity.this.e == null || !MQLandscapeVideoActivity.this.a.clickUrl.equals(MQLandscapeVideoActivity.this.A) || i >= 100) {
                return;
            }
            MQLandscapeVideoActivity.this.e.setBackgroundResource(R.drawable.bg_download_gray);
            MQLandscapeVideoActivity.this.e.setButtonMode(1);
            MQLandscapeVideoActivity.this.e.setText("下载中");
            MQLandscapeVideoActivity.this.e.setProgress(i);
            t.c("sczxc", "存在 = " + i);
        }

        @Override
        public void a(File file) {
            com.moqi.sdk.utils.b.a(MQLandscapeVideoActivity.this, file);
        }
    }

    public class i implements o.c {
        public i() {
        }

        @Override
        public void onComplete(String str) {
        }
    }

    public void a() {
        int size = this.r.size();
        int i2 = this.s + 1;
        if (size > i2) {
            a(this.r.get(i2));
        }
    }

    public void a(int i2) {
        try {
            Intent intent = new Intent("com.call.REWARDCALLBACK");
            intent.putExtra("type", i2);
            MoQiAd moQiAd = this.a;
            if (moQiAd != null) {
                intent.putExtra("order", moQiAd.orderNo);
                intent.putExtra("posId", this.a.adPlcID);
            }
            sendBroadcast(intent);
        } catch (Exception unused) {
        }
    }

    public static void a(Context context, List<MoQiAd> list, int i2) {
        try {
            context.startActivity(new Intent(context, (Class<?>) MQLandscapeVideoActivity.class).putExtra(B, (Serializable) list).putExtra(C, i2));
        } catch (Exception unused) {
        }
    }

    private void a(MoQiAd moQiAd) {
        String a2 = o.a(this, moQiAd.videoUrl);
        if (!new File(a2).exists()) {
            o a3 = com.moqi.sdk.d.a(moQiAd.videoUrl);
            a3.a(new i());
            a3.a(this, Integer.parseInt(moQiAd.adID));
        } else {
            t.c("sczxc", "视频已缓存path文件存在 = " + a2);
        }
    }

    public void b() {
        Timer timer = this.w;
        if (timer != null) {
            timer.cancel();
            this.w = null;
        }
    }

    private void b(int i2) {
        if (i2 == 0) {
            this.k = true;
            this.i.setImageResource(R.drawable.ks_sound_open);
            w wVar = this.j;
            if (wVar != null) {
                wVar.g();
                return;
            }
            return;
        }
        this.k = false;
        this.i.setImageResource(R.drawable.ks_sound_close);
        w wVar2 = this.j;
        if (wVar2 != null) {
            wVar2.a();
        }
    }

    public static int c(MQLandscapeVideoActivity mQLandscapeVideoActivity) {
        int i2 = mQLandscapeVideoActivity.y;
        mQLandscapeVideoActivity.y = i2 + 1;
        return i2;
    }

    public void d() {
        Timer timer = this.w;
        if (timer != null) {
            timer.cancel();
            this.w = null;
        }
        this.w = new Timer();
        this.w.schedule(new f(), 1000L, 1000L);
    }

    private void e() {
    }

    public void f() {
        AppCompatButton appCompatButton;
        CharSequence charSequence;
        MoQiAd moQiAd = this.a;
        if (moQiAd == null) {
            return;
        }
        com.moqi.sdk.cache.b.a(!TextUtils.isEmpty(moQiAd.logoUrl) ? this.a.logoUrl : com.moqi.sdk.d.V, new d());
        this.c.setText(this.a.name);
        this.d.setText(this.a.summary);
        this.e.setButtonMode(0);
        this.e.setBackgroundResource(R.drawable.bg_download);
        if (this.a.type.equals("1")) {
            this.e.setText("下载");
            if (!com.moqi.sdk.utils.a.c(this, this.a.pkg)) {
                return;
            }
            appCompatButton = this.e;
            charSequence = "打开";
        } else {
            appCompatButton = this.e;
            charSequence = "查看详情";
        }
        appCompatButton.setText(charSequence);
    }

    private void g() {
        this.b = (ImageView) findViewById(R.id.iv_apk_icon);
        this.c = (TextView) findViewById(R.id.tv_apk_name);
        this.f = (LinearLayout) findViewById(R.id.ll_shake);
        this.d = (TextView) findViewById(R.id.tv_apk_info);
        this.g = (CircleProgressBar) findViewById(R.id.cPro);
        this.u = (TextView) findViewById(R.id.tv_time);
        this.h = (ImageView) findViewById(R.id.iv_close);
        this.i = (ImageView) findViewById(R.id.iv_sound);
        this.n = findViewById(R.id.mbg);
        ?? r0 = (ProgressButton) findViewById(R.id.tv_apk_download);
        this.e = r0;
        r0.setBackgroundResource(R.drawable.bg_download);
        f();
        this.n.setOnClickListener(this);
        this.e.setOnClickListener(this);
        this.h.setOnClickListener(new b());
        this.i.setOnClickListener(new c());
    }

    private void h() {
        this.r = (List) getIntent().getSerializableExtra(B);
        this.p = getIntent().getIntExtra(C, 0);
        List<MoQiAd> list = this.r;
        if (list != null && list.size() > 0) {
            this.a = this.r.get(0);
        }
        for (int i2 = 0; i2 < this.r.size(); i2++) {
            this.t += Integer.parseInt(this.r.get(i2).countDownTime);
        }
    }

    public static int i(MQLandscapeVideoActivity mQLandscapeVideoActivity) {
        int i2 = mQLandscapeVideoActivity.t - 1;
        mQLandscapeVideoActivity.t = i2;
        return i2;
    }

    public void i() {
        this.s++;
        int size = this.r.size();
        int i2 = this.s;
        if (size > i2) {
            this.a = this.r.get(i2);
        }
    }

    public void j() {
        boolean z = !this.k;
        this.k = z;
        if (z) {
            this.i.setImageResource(R.drawable.ks_sound_open);
            this.j.g();
        } else {
            this.i.setImageResource(R.drawable.ks_sound_close);
            this.j.a();
        }
    }

    public void k() {
        MoQiAd moQiAd = this.a;
        if (moQiAd == null) {
            return;
        }
        String str = moQiAd.videoUrl;
        if (!str.toUpperCase().endsWith("M3U8")) {
            str = o.a(this, this.a.videoUrl);
            if (!new File(str).exists()) {
                this.g.setVisibility(0);
                if (this.s != 0) {
                    MoQiAd moQiAd2 = this.a;
                    if (moQiAd2 != null) {
                        moQiAd2.upActionEvent(4, "拼接视频缓存失败");
                        MQPortraitDetailActivity.a(this, this.a);
                    }
                    a(2);
                    finish();
                    return;
                }
                return;
            }
        }
        w wVar = this.j;
        if (wVar != null) {
            wVar.a(str);
            if (!this.k) {
                this.j.a();
            }
        }
        this.a.upActionEvent(0, "");
        if (this.s == 0) {
            a(1);
            if (com.moqi.sdk.d.Z.equals("1") && com.moqi.sdk.d.X.equals("1")) {
                this.f.setVisibility(0);
            } else {
                this.f.setVisibility(8);
            }
        }
        MoQiAd moQiAd3 = this.a;
        if (moQiAd3 == null || moQiAd3.platId <= 10) {
            return;
        }
        RequestImpl.getInstance().repost(this.a.reshow);
    }

    public void l() {
        int i2;
        MoQiAd moQiAd = this.a;
        if (moQiAd == null) {
            return;
        }
        int i3 = this.x;
        if (i3 == 3) {
            i2 = 113;
        } else {
            if (i3 == 30) {
                a(2);
                this.h.setVisibility(0);
                return;
            }
            double d2 = this.v;
            if (i3 == ((int) (0.25d * d2))) {
                i2 = 1125;
            } else if (i3 == ((int) (0.5d * d2))) {
                i2 = 1150;
            } else if (i3 != ((int) (d2 * 0.75d))) {
                return;
            } else {
                i2 = 1175;
            }
        }
        moQiAd.upActionEvent(i2, "");
    }

    public static int s(MQLandscapeVideoActivity mQLandscapeVideoActivity) {
        int i2 = mQLandscapeVideoActivity.x;
        mQLandscapeVideoActivity.x = i2 + 1;
        return i2;
    }

    @Override
    public void a(int i2, String str) {
        this.g.setProgress(i2);
        if (i2 == 100) {
            this.g.postDelayed(new g(), 200L);
        }
    }

    public void c() {
        String str;
        String str2;
        String str3;
        if (this.a != null) {
            a(11);
            this.a.upActionEvent(2, "");
            MoQiAd moQiAd = this.a;
            if (moQiAd != null && moQiAd.platId > 10) {
                RequestImpl.getInstance().repost(this.a.reclick);
            }
            if (this.a.type.equals("1")) {
                if (com.moqi.sdk.utils.a.c(this, this.a.pkg)) {
                    com.moqi.sdk.utils.a.d(this, this.a.pkg);
                    return;
                }
                MoQiAd moQiAd2 = this.a;
                String str4 = moQiAd2.clickUrl;
                this.A = str4;
                com.moqi.sdk.download2.a.a(this, str4, moQiAd2, new h());
                return;
            }
            if (this.a.type.equals(GlobalSetting.SPLASH_AD)) {
                MoQiAd moQiAd3 = this.a;
                if (moQiAd3 == null || (str3 = moQiAd3.clickUrl) == null) {
                    return;
                }
                s.b(this, str3);
                return;
            }
            if (this.a.type.equals(GlobalSetting.NATIVE_EXPRESS_AD)) {
                MoQiAd moQiAd4 = this.a;
                if (moQiAd4 == null || (str2 = moQiAd4.clickUrl) == null) {
                    return;
                }
                h0.a(this, str2);
                return;
            }
            MoQiAd moQiAd5 = this.a;
            if (moQiAd5 == null || (str = moQiAd5.clickUrl) == null) {
                return;
            }
            MQWebViewActivity.a(this, str, moQiAd5);
        }
    }

    @Override
    public void onClick(View view) {
        if (this.a != null) {
            if (view.getId() == this.m.getId()) {
                if (((int) (Math.random() * 100.0d)) >= this.a.DownRate) {
                    return;
                }
            } else if (view.getId() != this.n.getId() && view.getId() != this.e.getId()) {
                return;
            }
            c();
        }
    }

    @Override
    public void onCreate(Bundle bundle) {
        requestWindowFeature(1);
        getWindow().setFlags(WXMediaMessage.DESCRIPTION_LENGTH_LIMIT, WXMediaMessage.DESCRIPTION_LENGTH_LIMIT);
        super.onCreate(bundle);
        com.moqi.sdk.g.a().b(this);
        h();
        try {
            this.l = new DownLoadReceiver();
            IntentFilter intentFilter = new IntentFilter();
            intentFilter.addAction("com.progress.CUSTOM_INTENT");
            registerReceiver(this.l, intentFilter);
            this.l.a(this);
        } catch (Exception unused) {
        }
        setContentView(R.layout.activity_ks_landscape_video);
        g();
        TextureView textureView = (TextureView) findViewById(R.id.textureview);
        this.m = textureView;
        textureView.setOnClickListener(this);
        MoQiAd moQiAd = this.a;
        if (moQiAd.height > moQiAd.width) {
            DisplayMetrics displayMetrics = getApplicationContext().getResources().getDisplayMetrics();
            ConstraintLayout.LayoutParams layoutParams = this.m.getLayoutParams();
            int i2 = displayMetrics.heightPixels;
            MoQiAd moQiAd2 = this.a;
            ((ViewGroup.MarginLayoutParams) layoutParams).width = (moQiAd2.width * i2) / moQiAd2.height;
            ((ViewGroup.MarginLayoutParams) layoutParams).height = i2;
            this.m.setLayoutParams(layoutParams);
        }
        w wVar = new w(this);
        this.j = wVar;
        wVar.a(this.m, new a());
        b(this.p);
    }

    @Override
    public void onDestroy() {
        DownLoadReceiver downLoadReceiver = this.l;
        if (downLoadReceiver != null) {
            unregisterReceiver(downLoadReceiver);
        }
        super.onDestroy();
    }

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

    @Override
    public void onPause() {
        super.onPause();
        w wVar = this.j;
        if (wVar != null) {
            this.q = wVar.b();
        }
        com.moqi.sdk.g.a().b();
    }

    @Override
    public void onResume() {
        super.onResume();
        w wVar = this.j;
        if (wVar != null) {
            wVar.e();
            this.y = 0;
            if (this.o) {
                d();
            }
        }
        com.moqi.sdk.g.a().a(null, this.e, 14);
    }

    @Override
    public void onStop() {
        int i2;
        super.onStop();
        w wVar = this.j;
        if (wVar != null) {
            wVar.d();
        }
        MoQiAd moQiAd = this.a;
        if (moQiAd != null && (i2 = this.y) != 0) {
            moQiAd.upActionTimeEvent(111, i2);
        }
        Timer timer = this.w;
        if (timer != null) {
            timer.cancel();
            this.w = null;
        }
    }
}