翰林优商.apk(点击下载) / SpeechVoiceMallLandingActivity.java


package com.xlx.speech.voicereadsdk.ui.activity;

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import android.view.SurfaceView;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.constraintlayout.widget.ConstraintSet;
import com.google.android.exoplayer2.MediaItem;
import com.google.android.exoplayer2.offline.Download;
import com.google.android.exoplayer2.source.ProgressiveMediaSource;
import com.xlx.speech.e.c;
import com.xlx.speech.m0.a;
import com.xlx.speech.m0.e0;
import com.xlx.speech.m0.h0;
import com.xlx.speech.m0.i0;
import com.xlx.speech.m0.n;
import com.xlx.speech.m0.o;
import com.xlx.speech.m0.s;
import com.xlx.speech.o.p;
import com.xlx.speech.o.q;
import com.xlx.speech.o.r;
import com.xlx.speech.voicereadsdk.R;
import com.xlx.speech.voicereadsdk.bean.req.BaseAppInfo;
import com.xlx.speech.voicereadsdk.bean.resp.AdvertGoodsInfo;
import com.xlx.speech.voicereadsdk.bean.resp.SingleAdDetailResult;
import com.xlx.speech.voicereadsdk.component.media.video.ExoDownloadService;
import com.xlx.speech.voicereadsdk.entrance.SpeechVoiceSdk;
import com.xlx.speech.voicereadsdk.ui.widget.AspectRatioFrameLayout;
import com.xlx.speech.y.j;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.List;

public class SpeechVoiceMallLandingActivity extends com.xlx.speech.t.a {
    public static final /* synthetic */ int v = 0;
    public n c;
    public ImageView d;
    public TextView e;
    public TextView f;
    public TextView g;
    public TextView h;
    public ImageView i;
    public TextView j;
    public TextView k;
    public TextView l;
    public TextView m;
    public TextView n;
    public SurfaceView o;
    public View p;
    public com.xlx.speech.voicereadsdk.component.media.video.b q;
    public LinearLayout r;
    public TextView s;
    public AspectRatioFrameLayout t;
    public SingleAdDetailResult u;

    public class a extends s {
        public final /* synthetic */ j b;

        public a(SpeechVoiceMallLandingActivity speechVoiceMallLandingActivity, j jVar) {
            this.b = jVar;
        }

        @Override // com.xlx.speech.m0.s
        public void a(View view) {
            this.b.dismiss();
            a.C0411a.a.a();
            com.xlx.speech.i.b.a("taobao_exit_click");
        }
    }

    public class b extends s {
        public b() {
        }

        @Override // com.xlx.speech.m0.s
        public void a(View view) {
            SpeechVoiceMallLandingActivity speechVoiceMallLandingActivity = SpeechVoiceMallLandingActivity.this;
            SpeechVoiceMallLandingActivity.a(speechVoiceMallLandingActivity, speechVoiceMallLandingActivity.u.advertGoods.getGiftUrl());
            com.xlx.speech.i.b.a("receivecoupons_click");
        }
    }

    public static void a(SpeechVoiceMallLandingActivity speechVoiceMallLandingActivity, String str) {
        speechVoiceMallLandingActivity.getClass();
        BaseAppInfo baseAppInfo = new BaseAppInfo();
        baseAppInfo.setAdId(speechVoiceMallLandingActivity.u.adId);
        baseAppInfo.setTitleId(speechVoiceMallLandingActivity.u.titleId);
        baseAppInfo.setLogId(speechVoiceMallLandingActivity.u.logId);
        baseAppInfo.setSloganId(speechVoiceMallLandingActivity.u.sloganId);
        baseAppInfo.setPageId(speechVoiceMallLandingActivity.u.pageId);
        baseAppInfo.setFromPage("3");
        c.a(baseAppInfo);
        Intent intent = new Intent("android.intent.action.VIEW", Uri.parse(str));
        intent.addFlags(268435456);
        if (intent.resolveActivity(speechVoiceMallLandingActivity.getPackageManager()) != null) {
            speechVoiceMallLandingActivity.startActivity(intent);
        } else {
            h0.a(speechVoiceMallLandingActivity.u.advertGoods.getUnInstallTips());
        }
    }

    public final void b() {
        ((com.xlx.speech.voicereadsdk.component.media.video.a) this.q).b.stop();
        j jVar = new j(this, this.u.advertGoods);
        jVar.a.setOnClickListener(new a(this, jVar));
        jVar.b.setOnClickListener(new b());
        jVar.show();
        com.xlx.speech.i.b.a("taobao_page_view");
    }

    public void onBackPressed() {
    }

    /* JADX WARNING: Removed duplicated region for block: B:30:0x02c2  */
    /* JADX WARNING: Removed duplicated region for block: B:33:0x033e  */
    /* JADX WARNING: Removed duplicated region for block: B:42:? A[RETURN, SYNTHETIC] */
    @Override // com.xlx.speech.t.a
    public void onCreate(Bundle bundle) {
        String str;
        TextView textView;
        float f2;
        super.onCreate(bundle);
        e0.a((Activity) this);
        getWindow().addFlags(128);
        setContentView(R.layout.xlx_voice_activity_mall_landing);
        this.u = (SingleAdDetailResult) getIntent().getParcelableExtra("data");
        this.c = new n();
        this.d = (ImageView) findViewById(R.id.xlx_voice_iv_merchant_logo);
        this.e = (TextView) findViewById(R.id.xlx_voice_tv_merchant_name);
        this.f = (TextView) findViewById(R.id.xlx_voice_tv_sales);
        this.g = (TextView) findViewById(R.id.xlx_voice_tv_count_down);
        this.h = (TextView) findViewById(R.id.xlx_voice_tv_skip);
        this.i = (ImageView) findViewById(R.id.xlx_voice_iv_goods_logo);
        this.j = (TextView) findViewById(R.id.xlx_voice_tv_goods_name);
        this.k = (TextView) findViewById(R.id.xlx_voice_tv_goods_desc);
        this.l = (TextView) findViewById(R.id.xlx_voice_tv_special_offer);
        this.m = (TextView) findViewById(R.id.xlx_voice_tv_original_price);
        this.n = (TextView) findViewById(R.id.xlx_voice_tv_buy);
        this.o = (SurfaceView) findViewById(R.id.xlx_voice_player_view);
        this.p = findViewById(R.id.xlx_voice_divider_line);
        this.r = (LinearLayout) findViewById(R.id.xlx_voice_layout_tag);
        this.s = (TextView) findViewById(R.id.xlx_voice_tv_reward_tips);
        this.t = (AspectRatioFrameLayout) findViewById(R.id.xlx_voice_ratio_frame);
        com.xlx.speech.voicereadsdk.component.media.video.a aVar = new com.xlx.speech.voicereadsdk.component.media.video.a(this);
        this.q = aVar;
        aVar.b.setVideoSurfaceHolder(this.o.getHolder());
        com.xlx.speech.voicereadsdk.component.media.video.a aVar2 = (com.xlx.speech.voicereadsdk.component.media.video.a) this.q;
        aVar2.e = this.t;
        aVar2.b.setMediaSource(new ProgressiveMediaSource.Factory(aVar2.c).createMediaSource(MediaItem.fromUri(this.u.advertGoods.getVideoPath())));
        aVar2.b.prepare();
        ((com.xlx.speech.voicereadsdk.component.media.video.a) this.q).b.play();
        com.xlx.speech.i.b.a("video_page_view");
        AdvertGoodsInfo advertGoodsInfo = this.u.advertGoods;
        com.xlx.speech.m0.j.a().loadImage(this, advertGoodsInfo.getShopPic(), this.d);
        this.e.setText(advertGoodsInfo.getShopNickName());
        this.f.setText(advertGoodsInfo.getSubtitle());
        List<String> goodsTags = advertGoodsInfo.getGoodsTags();
        this.r.removeAllViews();
        int dimensionPixelSize = getResources().getDimensionPixelSize(R.dimen.xlx_voice_dp_5);
        int[] iArr = {R.drawable.xlx_voice_bg_mall_tag_red, R.drawable.xlx_voice_bg_mall_tag_yellow, R.drawable.xlx_voice_bg_mall_tag_blue};
        int i2 = 0;
        while (i2 < goodsTags.size() && i2 < 3) {
            TextView textView2 = new TextView(this);
            textView2.setPadding(dimensionPixelSize, 0, dimensionPixelSize, 0);
            textView2.setTextSize(0, (float) getResources().getDimensionPixelSize(R.dimen.xlx_voice_dp_10));
            textView2.setTextColor(-1);
            textView2.setText(goodsTags.get(i2));
            textView2.setGravity(17);
            textView2.setBackgroundResource(iArr[i2 % 3]);
            LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(-2, getResources().getDimensionPixelSize(R.dimen.xlx_voice_dp_18));
            if (i2 > 0) {
                layoutParams.setMarginStart(getResources().getDimensionPixelSize(R.dimen.xlx_voice_dp_10));
            }
            this.r.addView(textView2, layoutParams);
            i2++;
        }
        this.s.setText(advertGoodsInfo.getMessageList().getMessage());
        com.xlx.speech.m0.j.a().loadImage(this, advertGoodsInfo.getGoodPic(), this.i);
        this.j.setText(advertGoodsInfo.getGoodsName());
        List<AdvertGoodsInfo.RewardListDTO> rewardList = advertGoodsInfo.getRewardList();
        if (rewardList == null || rewardList.size() <= 0) {
            textView = this.k;
            str = String.format("优惠券:¥%s | 淘礼金:¥%s", advertGoodsInfo.getCouponPrice(), advertGoodsInfo.getGiftPrice());
        } else {
            StringBuilder sb = new StringBuilder();
            for (int size = rewardList.size() - 1; size >= 0; size--) {
                AdvertGoodsInfo.RewardListDTO rewardListDTO = rewardList.get(size);
                sb.append(rewardListDTO.getRewardTypeName());
                sb.append(":¥");
                sb.append(rewardListDTO.getMoney());
                if (size != 0) {
                    sb.append(" | ");
                }
            }
            textView = this.k;
            str = sb.toString();
        }
        textView.setText(str);
        this.l.setText(String.format("¥%s", advertGoodsInfo.getRealPrice()));
        this.m.setText(String.format("¥%s", advertGoodsInfo.getOriginalPrice()));
        this.n.setText(advertGoodsInfo.getBuyButton());
        this.h.setOnClickListener(new p(this));
        findViewById(R.id.xlx_voice_layout_buy).setOnClickListener(new q(this, advertGoodsInfo));
        com.xlx.speech.voicereadsdk.component.media.video.b bVar = this.q;
        String videoPath = advertGoodsInfo.getVideoPath();
        com.xlx.speech.voicereadsdk.component.media.video.a aVar3 = (com.xlx.speech.voicereadsdk.component.media.video.a) bVar;
        aVar3.getClass();
        try {
            Download download = ExoDownloadService.a.c(aVar3.a).getDownloadIndex().getDownload(o.a(videoPath));
            if (download != null) {
                f2 = download.getPercentDownloaded();
                Log.i("MyLogger", "percentDownloaded = " + f2);
                if (advertGoodsInfo.getShowType() == 2) {
                    ViewGroup.LayoutParams layoutParams2 = this.t.getLayoutParams();
                    layoutParams2.height = 0;
                    this.t.setLayoutParams(layoutParams2);
                    ConstraintSet constraintSet = new ConstraintSet();
                    ConstraintLayout constraintLayout = (ConstraintLayout) this.t.getParent();
                    constraintSet.clone(constraintLayout);
                    constraintSet.setDimensionRatio(R.id.xlx_voice_ratio_frame, "w,23:36");
                    constraintSet.constrainedHeight(R.id.xlx_voice_ratio_frame, true);
                    this.t.setResizeMode(0);
                    constraintSet.applyTo(constraintLayout);
                    this.t.setBackgroundColor(-16777216);
                }
                this.h.setVisibility(8);
                this.p.setVisibility(8);
                AdvertGoodsInfo advertGoodsInfo2 = this.u.advertGoods;
                BigDecimal scale = new BigDecimal(advertGoodsInfo2.getVideoLength()).setScale(3, 5);
                BigDecimal bigDecimal = new BigDecimal(advertGoodsInfo2.getVideoJumpShowTime());
                n nVar = this.c;
                n.a aVar4 = new n.a(new r(this, scale, bigDecimal));
                nVar.a = aVar4;
                nVar.postDelayed(aVar4, 100);
                if (SpeechVoiceSdk.getAdManger().getVoiceAdListener() == null) {
                    SingleAdDetailResult singleAdDetailResult = this.u;
                    i0.a(singleAdDetailResult.logId, singleAdDetailResult.icpmOne);
                    return;
                }
                return;
            }
        } catch (IOException e2) {
            e2.printStackTrace();
        }
        f2 = -1.0f;
        Log.i("MyLogger", "percentDownloaded = " + f2);
        if (advertGoodsInfo.getShowType() == 2) {
        }
        this.h.setVisibility(8);
        this.p.setVisibility(8);
        AdvertGoodsInfo advertGoodsInfo22 = this.u.advertGoods;
        BigDecimal scale2 = new BigDecimal(advertGoodsInfo22.getVideoLength()).setScale(3, 5);
        BigDecimal bigDecimal2 = new BigDecimal(advertGoodsInfo22.getVideoJumpShowTime());
        n nVar2 = this.c;
        n.a aVar42 = new n.a(new r(this, scale2, bigDecimal2));
        nVar2.a = aVar42;
        nVar2.postDelayed(aVar42, 100);
        if (SpeechVoiceSdk.getAdManger().getVoiceAdListener() == null) {
        }
    }

    @Override // com.xlx.speech.t.a
    public void onDestroy() {
        super.onDestroy();
        ((com.xlx.speech.voicereadsdk.component.media.video.a) this.q).a();
        this.c.a();
        this.c.a();
    }

    @Override // com.xlx.speech.t.a
    public void onPause() {
        super.onPause();
        ((com.xlx.speech.voicereadsdk.component.media.video.a) this.q).b.pause();
    }

    @Override // com.xlx.speech.t.a
    public void onResume() {
        super.onResume();
        com.xlx.speech.voicereadsdk.component.media.video.a aVar = (com.xlx.speech.voicereadsdk.component.media.video.a) this.q;
        if (!aVar.b.isPlaying()) {
            aVar.b.play();
        }
    }
}