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


package com.xlx.speech.o;

import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.app.Activity;
import android.content.BroadcastReceiver;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.os.SystemClock;
import android.text.Html;
import android.view.View;
import android.view.animation.CycleInterpolator;
import android.widget.TextView;
import android.widget.Toast;
import com.liulishuo.filedownloader.BaseDownloadTask;
import com.xlx.speech.f.d;
import com.xlx.speech.i.a;
import com.xlx.speech.m0.a;
import com.xlx.speech.m0.h0;
import com.xlx.speech.m0.s;
import com.xlx.speech.m0.u;
import com.xlx.speech.voicereadsdk.R;
import com.xlx.speech.voicereadsdk.bean.AdReward;
import com.xlx.speech.voicereadsdk.bean.DownloadInfo;
import com.xlx.speech.voicereadsdk.bean.IAdData;
import com.xlx.speech.voicereadsdk.bean.MultipleRewardAdDataProxy;
import com.xlx.speech.voicereadsdk.bean.SingleAdDataProxy;
import com.xlx.speech.voicereadsdk.bean.req.BaseAppInfo;
import com.xlx.speech.voicereadsdk.bean.resp.AdvertAppInfo;
import com.xlx.speech.voicereadsdk.bean.resp.AppPermission;
import com.xlx.speech.voicereadsdk.bean.resp.ExperienceAdvertPageInfo;
import com.xlx.speech.voicereadsdk.bean.resp.ExperienceCheckResult;
import com.xlx.speech.voicereadsdk.bean.resp.MultipleRewardAdResult;
import com.xlx.speech.voicereadsdk.bean.resp.SingleAdDetailResult;
import com.xlx.speech.voicereadsdk.entrance.SpeechVoiceSdk;
import com.xlx.speech.voicereadsdk.entrance.VoiceAdListener;
import com.xlx.speech.voicereadsdk.ui.activity.SpeechVoiceAppInfoActivity;
import com.xlx.speech.voicereadsdk.ui.activity.SpeechVoiceMultipleRewardReservedActivity;
import com.xlx.speech.y.e;
import com.xlx.speech.y.f;
import com.xlx.speech.y.m;
import com.xlx.speech.y.n;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;

public abstract class i extends com.xlx.speech.t.a implements u.b {
    public IAdData c;
    public u d;
    public SingleAdDetailResult e;
    public n f;
    public int g;
    public boolean h;
    public ExperienceAdvertPageInfo i;
    public HashMap<Float, AdReward> j = new HashMap<>();
    public long k = -1;
    public boolean l;
    public BroadcastReceiver m;

    public class a extends com.xlx.speech.f.b<ExperienceAdvertPageInfo> {
        public a() {
        }

        @Override // com.xlx.speech.f.e, com.xlx.speech.f.b
        public void onError(com.xlx.speech.f.a aVar) {
            super.onError(aVar);
            i.this.getClass();
        }

        /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
        @Override // com.xlx.speech.f.e, com.xlx.speech.f.b
        public void onSuccess(ExperienceAdvertPageInfo experienceAdvertPageInfo) {
            ExperienceAdvertPageInfo experienceAdvertPageInfo2 = experienceAdvertPageInfo;
            i iVar = i.this;
            iVar.i = experienceAdvertPageInfo2;
            iVar.a(experienceAdvertPageInfo2);
            i.this.getClass();
        }
    }

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

        @Override // com.xlx.speech.m0.s
        public void a(View view) {
            com.xlx.speech.i.b.a(i.this.f.e ? "experience_page_click" : "unexperience_page_click");
            if (i.this.d.d()) {
                i iVar = i.this;
                if (!iVar.h) {
                    iVar.g = 1;
                }
                iVar.d.f();
                return;
            }
            i.this.f.dismiss();
            i.this.j();
        }
    }

    public class c implements DialogInterface.OnDismissListener {
        public c(i iVar) {
        }

        public void onDismiss(DialogInterface dialogInterface) {
            a.C0411a.a.a();
        }
    }

    public void a(ExperienceAdvertPageInfo experienceAdvertPageInfo) {
        n nVar = this.f;
        if (nVar != null) {
            nVar.a(experienceAdvertPageInfo, c().getRewardInfo());
        }
    }

    public void a(boolean z) {
        ExperienceAdvertPageInfo experienceAdvertPageInfo = this.i;
        boolean z2 = true;
        if (experienceAdvertPageInfo == null || experienceAdvertPageInfo.getCanDownloadPause() != 1) {
            z2 = false;
        }
        if (!this.d.b() || !z2 || !z) {
            m();
        } else {
            k();
        }
    }

    public f b() {
        m mVar = new m(this);
        mVar.b.setText(c().getRewardInfo());
        return mVar;
    }

    public AdReward c() {
        SingleAdDetailResult singleAdDetailResult = (SingleAdDetailResult) getIntent().getParcelableExtra("data");
        int i2 = 1;
        boolean z = singleAdDetailResult != null && singleAdDetailResult.readingNoReward == 0;
        HashMap<Float, AdReward> hashMap = this.j;
        IAdData iAdData = this.c;
        float icpmTwo = z ? iAdData.getIcpmTwo() : iAdData.getIcpmOne();
        if (z) {
            i2 = 2;
        }
        return com.xlx.speech.a.b.a(hashMap, icpmTwo, i2);
    }

    public ExperienceAdvertPageInfo d() {
        if (this.i == null) {
            l();
        }
        return this.i;
    }

    public abstract int e();

    public AdReward f() {
        return com.xlx.speech.a.b.a(this.j, this.c.getIcpmOne(), 1);
    }

    public void g() {
        u a2 = u.a(this, this.c.getAdId(), this.c.getLogId(), this.c.getPackageName());
        this.d = a2;
        a2.a(this);
        this.d.g = this.c.getTagId();
        this.d.l = new i$$ExternalSyntheticLambda0(this);
    }

    public void h() {
        this.d.a((Activity) this, true);
    }

    public n i() {
        if (this.f == null) {
            n nVar = new n(this);
            this.f = nVar;
            ExperienceAdvertPageInfo experienceAdvertPageInfo = this.i;
            if (experienceAdvertPageInfo != null) {
                nVar.a(experienceAdvertPageInfo, c().getRewardInfo());
            } else {
                String rewardInfo = c().getRewardInfo();
                nVar.a.setText(String.format("放弃%s奖励", rewardInfo));
                nVar.b.setText(Html.fromHtml(String.format("再完成一下内容,即可领取<font color='#FF7800'>%s</font>!", rewardInfo)));
            }
            this.f.c.setOnClickListener(new b());
        }
        return this.f;
    }

    public void j() {
        ExperienceAdvertPageInfo experienceAdvertPageInfo;
        if (this.i == null) {
            l();
        }
        n();
        if (this.d.d()) {
            if (!this.h) {
                this.g = 1;
            }
            this.d.f();
        } else if (this.d.c()) {
            h();
        } else {
            if (!this.d.b()) {
                u uVar = this.d;
                if (!(uVar.d.b(uVar.d.a(uVar.a())) == -2) && (experienceAdvertPageInfo = this.i) != null && experienceAdvertPageInfo.getDownloadTips() == 1 && this.i.getAdvertAppInfo() != null && this.i.getAdvertAppInfo().hasAdvertAppInfo) {
                    String adId = this.c.getAdId();
                    String logId = this.c.getLogId();
                    String adName = this.c.getAdName();
                    String iconUrl = this.c.getIconUrl();
                    String packageName = this.c.getPackageName();
                    String downloadUrl = this.c.getDownloadUrl();
                    String adContent = this.c.getAdContent();
                    AdvertAppInfo advertAppInfo = this.i.getAdvertAppInfo();
                    List<AppPermission> appPermissionList = this.i.getAppPermissionList();
                    SingleAdDetailResult singleAdDetailResult = new SingleAdDetailResult();
                    singleAdDetailResult.adId = adId;
                    singleAdDetailResult.logId = logId;
                    singleAdDetailResult.adName = adName;
                    singleAdDetailResult.iconUrl = iconUrl;
                    singleAdDetailResult.packageName = packageName;
                    singleAdDetailResult.advertAppInfo = advertAppInfo;
                    singleAdDetailResult.icpmOne = 0.0f;
                    singleAdDetailResult.appPermissionList = appPermissionList;
                    singleAdDetailResult.titleId = "";
                    singleAdDetailResult.sloganId = "";
                    singleAdDetailResult.pageId = "";
                    singleAdDetailResult.downloadUrl = downloadUrl;
                    singleAdDetailResult.adContent = adContent;
                    Intent intent = new Intent(this, SpeechVoiceAppInfoActivity.class);
                    intent.putExtra("data", singleAdDetailResult);
                    intent.putExtra("isFinish", true);
                    startActivity(intent);
                    return;
                }
            }
            a(false);
        }
    }

    public void k() {
        BaseDownloadTask baseDownloadTask = this.d.d.d;
        if (baseDownloadTask != null) {
            baseDownloadTask.pause();
        }
    }

    public void l() {
        com.xlx.speech.i.a aVar = a.C0409a.a;
        String tagId = this.c.getTagId();
        String rewardInfo = c().getRewardInfo();
        aVar.getClass();
        HashMap hashMap = new HashMap();
        hashMap.put("tagId", tagId);
        hashMap.put("reward", rewardInfo);
        aVar.a.v(d.a(hashMap)).enqueue(new a());
    }

    public void m() {
        DownloadInfo downloadInfo = new DownloadInfo();
        downloadInfo.setTitle(this.c.getAdName());
        downloadInfo.setUrl(this.c.getDownloadUrl());
        downloadInfo.setDescription(this.c.getAdContent());
        downloadInfo.setAdId(this.c.getAdId());
        downloadInfo.setPackageName(this.c.getPackageName());
        downloadInfo.setLogId(this.c.getLogId());
        downloadInfo.setTagId(this.c.getTagId());
        this.d.a(downloadInfo);
    }

    public void n() {
        if (!this.l && (!(this instanceof SpeechVoiceMultipleRewardReservedActivity))) {
            BaseAppInfo baseAppInfo = new BaseAppInfo();
            baseAppInfo.setAdId(this.c.getAdId());
            baseAppInfo.setLogId(this.c.getLogId());
            baseAppInfo.setTagId(this.c.getTagId());
            baseAppInfo.setFromPage("3");
            com.xlx.speech.e.c.a(baseAppInfo);
            com.xlx.speech.i.b.a("landing_download_click", Collections.singletonMap("adId", this.c.getAdId()));
            this.l = true;
        }
    }

    public void onActivityResult(int i2, int i3, Intent intent) {
        super.onActivityResult(i2, i3, intent);
    }

    @Override // com.xlx.speech.t.a
    public void onCreate(Bundle bundle) {
        HashMap<Float, AdReward> hashMap;
        super.onCreate(bundle);
        if (bundle != null) {
            this.h = bundle.getBoolean("STATE_REWARD_CPA", false);
            this.g = bundle.getInt("STATE_START_EXPERIENCE", 0);
            this.i = (ExperienceAdvertPageInfo) bundle.getParcelable("STATE_ADVERT_PAGE_INFO");
            if (this.g == 1) {
                this.g = 2;
            }
            HashMap<Float, AdReward> hashMap2 = com.xlx.speech.a.b.a;
            try {
                HashMap<Float, AdReward> hashMap3 = com.xlx.speech.a.b.a;
                if (hashMap3 == null || hashMap3.isEmpty()) {
                    com.xlx.speech.a.b.a = (HashMap) bundle.getSerializable("STATE_REWARD_MAP");
                }
            } catch (Exception unused) {
            }
        }
        SingleAdDetailResult singleAdDetailResult = (SingleAdDetailResult) getIntent().getParcelableExtra("data");
        this.e = singleAdDetailResult;
        if (singleAdDetailResult == null) {
            com.xlx.speech.a.a.a(this);
            if (SpeechVoiceSdk.getAdManger().getVoiceAdListener() != null) {
                SpeechVoiceSdk.getAdManger().getVoiceAdListener().onAdShow();
            }
            MultipleRewardAdResult multipleRewardAdResult = (MultipleRewardAdResult) getIntent().getParcelableExtra("EXTRA_MULTIPLE_REWARD");
            this.c = new MultipleRewardAdDataProxy(multipleRewardAdResult);
            hashMap = multipleRewardAdResult.getRewardMap();
        } else {
            this.c = new SingleAdDataProxy(singleAdDetailResult);
            hashMap = this.e.rewardMap;
        }
        this.j = hashMap;
        IntentFilter intentFilter = new IntentFilter("android.intent.action.SCREEN_ON");
        intentFilter.addAction("android.intent.action.SCREEN_OFF");
        k kVar = new k(this);
        this.m = kVar;
        registerReceiver(kVar, intentFilter);
    }

    @Override // com.xlx.speech.t.a
    public void onDestroy() {
        super.onDestroy();
        try {
            this.d.b(this);
            BroadcastReceiver broadcastReceiver = this.m;
            if (broadcastReceiver != null) {
                unregisterReceiver(broadcastReceiver);
                this.m = null;
            }
        } catch (Throwable unused) {
        }
    }

    @Override // com.xlx.speech.t.a
    public void onPause() {
        super.onPause();
    }

    @Override // com.xlx.speech.t.a
    public void onResume() {
        super.onResume();
        if (this.g >= 2 && !this.h) {
            com.xlx.speech.y.i.a(this).show();
            com.xlx.speech.i.a aVar = a.C0409a.a;
            String tagId = this.c.getTagId();
            int e2 = e();
            aVar.getClass();
            HashMap hashMap = new HashMap();
            hashMap.put("tagId", tagId);
            hashMap.put("stepNum", Integer.valueOf(e2));
            aVar.a.m(d.a(hashMap)).enqueue(new j(this));
            ExperienceAdvertPageInfo experienceAdvertPageInfo = this.i;
            if (experienceAdvertPageInfo == null || experienceAdvertPageInfo.getBeginExperienceMode() != 1) {
                this.g = 0;
            } else {
                this.g = 1;
            }
        }
        if (this.k > -1) {
            if (SystemClock.elapsedRealtime() - this.k > 500) {
                n i2 = i();
                i2.getClass();
                try {
                    ExperienceAdvertPageInfo experienceAdvertPageInfo2 = i2.h;
                    if (experienceAdvertPageInfo2 != null) {
                        List<String> secondGuideTip = experienceAdvertPageInfo2.getSecondReward().getSecondGuideTip();
                        ((TextView) i2.g.getChildAt(secondGuideTip.size() - 1).findViewById(R.id.xlx_voice_tv_task)).setText(secondGuideTip.get(secondGuideTip.size() - 1).replaceFirst("(\\d+\\.|、)", "$1继续"));
                    }
                } catch (Exception unused) {
                }
            }
            this.k = -1;
        }
    }

    public void onSaveInstanceState(Bundle bundle) {
        bundle.putBoolean("STATE_REWARD_CPA", this.h);
        bundle.putInt("STATE_START_EXPERIENCE", this.g);
        bundle.putParcelable("STATE_ADVERT_PAGE_INFO", this.i);
        bundle.putSerializable("STATE_REWARD_MAP", com.xlx.speech.a.b.a);
        super.onSaveInstanceState(bundle);
    }

    public void onStart() {
        super.onStart();
        if (this.i == null) {
            l();
        }
    }

    public void onStop() {
        super.onStop();
        if (this.g == 1 && !this.h && !isFinishing()) {
            this.g = 2;
            com.xlx.speech.i.a aVar = a.C0409a.a;
            String tagId = this.c.getTagId();
            aVar.getClass();
            HashMap hashMap = new HashMap();
            hashMap.put("tagId", tagId);
            aVar.a.A(d.a(hashMap)).enqueue(new com.xlx.speech.f.c());
            ExperienceAdvertPageInfo experienceAdvertPageInfo = this.i;
            Toast.makeText(this, Html.fromHtml(String.format("<font color='#ff295b'>%s</font>%s", experienceAdvertPageInfo != null ? experienceAdvertPageInfo.getGuideList().get(1).getTitle() : "注册体验", String.format("【%s】后,请返回【%s】领取奖励", this.c.getAdName(), com.xlx.speech.m0.c.a(this)))), 1).show();
        }
    }

    public void a(ExperienceCheckResult experienceCheckResult) {
        n i2 = i();
        i2.e = false;
        if (!i2.isShowing()) {
            i2.show();
        }
        if (experienceCheckResult != null) {
            try {
                ExperienceAdvertPageInfo experienceAdvertPageInfo = i2.h;
                if (experienceAdvertPageInfo != null) {
                    List<String> secondGuideTip = experienceAdvertPageInfo.getSecondReward().getSecondGuideTip();
                    View childAt = i2.g.getChildAt(secondGuideTip.size() - 1);
                    String replaceFirst = secondGuideTip.get(secondGuideTip.size() - 1).replaceFirst("(\\d+\\.|、)", "$1继续");
                    ((TextView) childAt.findViewById(R.id.xlx_voice_tv_task)).setText(replaceFirst.replaceFirst("\\d+秒", experienceCheckResult.getNeedSecond() + "秒"));
                }
            } catch (Exception unused) {
            }
        }
        ArrayList arrayList = new ArrayList(i2.g.getChildCount());
        for (int i3 = 0; i3 < i2.g.getChildCount(); i3++) {
            ObjectAnimator ofFloat = ObjectAnimator.ofFloat(i2.g.getChildAt(i3), "translationX", 0.0f, 10.0f);
            ofFloat.setInterpolator(new CycleInterpolator(2.0f));
            ofFloat.setRepeatCount(1);
            ofFloat.setDuration(1000L);
            arrayList.add(ofFloat);
        }
        AnimatorSet animatorSet = new AnimatorSet();
        animatorSet.playSequentially(arrayList);
        animatorSet.start();
    }

    public void b(int i2) {
        VoiceAdListener voiceAdListener = SpeechVoiceSdk.getAdManger().getVoiceAdListener();
        if (voiceAdListener != null) {
            String tagId = this.c.getTagId();
            SingleAdDetailResult singleAdDetailResult = (SingleAdDetailResult) getIntent().getParcelableExtra("data");
            voiceAdListener.onRewardVerify(tagId, singleAdDetailResult != null && singleAdDetailResult.readingNoReward == 0 ? this.c.getIcpmTwo() : this.c.getIcpmOne(), e());
        }
        this.h = true;
        f b2 = b();
        b2.setOnDismissListener(new c(this));
        b2.show();
        if (i2 <= 0) {
            i2 = 4;
        }
        if (i2 > 0 && b2.a == null) {
            e eVar = new e(b2, ((long) i2) * 1000, 1000);
            b2.a = eVar;
            eVar.start();
        }
    }

    @Override // com.xlx.speech.m0.u.b
    public void a(String str) {
        this.k = SystemClock.elapsedRealtime();
        n i2 = i();
        i2.e = true;
        i2.show();
        try {
            ExperienceAdvertPageInfo experienceAdvertPageInfo = this.i;
            h0.a((experienceAdvertPageInfo != null ? experienceAdvertPageInfo.getPrepareExperienceTips() : "${appName}提醒您:请返回${appName}继续下一步哦!").replace("${appName}", com.xlx.speech.m0.c.a(this)));
        } catch (Throwable unused) {
        }
    }
}