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


package com.xlx.speech.v;

import android.app.Activity;
import android.content.Intent;
import com.google.android.exoplayer2.offline.Download;
import com.google.android.exoplayer2.offline.DownloadManager;
import com.xlx.speech.m0.o;
import com.xlx.speech.u.d;
import com.xlx.speech.u.e;
import com.xlx.speech.voicereadsdk.bean.resp.SingleAdDetailResult;
import com.xlx.speech.voicereadsdk.component.media.video.ExoDownloadService;
import com.xlx.speech.voicereadsdk.component.media.video.a;
import com.xlx.speech.voicereadsdk.component.media.video.b;
import com.xlx.speech.voicereadsdk.ui.activity.SpeechVoiceMallLandingActivity;
import java.io.IOException;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;

public class t extends com.xlx.speech.u.a {
    public static final ExecutorService f = Executors.newCachedThreadPool();
    public Activity a;
    public SingleAdDetailResult b;
    public com.xlx.speech.voicereadsdk.component.media.video.b c;
    public String d;
    public int e = 2;

    public class a implements b.a {
        public final /* synthetic */ String a;
        public final /* synthetic */ CountDownLatch b;

        public a(t tVar, String str, CountDownLatch countDownLatch) {
            this.a = str;
            this.b = countDownLatch;
        }
    }

    public static class b implements Runnable {
        public CountDownLatch a;
        public int b;

        public b(CountDownLatch countDownLatch, int i) {
            this.a = countDownLatch;
            this.b = i;
        }

        public void run() {
            try {
                Thread.sleep(((long) this.b) * 1000);
            } catch (Exception unused) {
            } catch (Throwable th) {
                this.a.countDown();
                throw th;
            }
            this.a.countDown();
        }
    }

    public static class c implements Runnable {
        public Activity a;
        public SingleAdDetailResult b;
        public CountDownLatch c;
        public int d;
        public d.a e;

        public c(Activity activity, SingleAdDetailResult singleAdDetailResult, CountDownLatch countDownLatch, int i, d.a aVar) {
            this.a = activity;
            this.b = singleAdDetailResult;
            this.c = countDownLatch;
            this.d = i;
            this.e = aVar;
        }

        public final void a() {
            Activity activity = this.a;
            SingleAdDetailResult singleAdDetailResult = this.b;
            int i = SpeechVoiceMallLandingActivity.v;
            Intent intent = new Intent(activity, SpeechVoiceMallLandingActivity.class);
            intent.putExtra("data", singleAdDetailResult);
            activity.startActivity(intent);
            this.a.finish();
            ((e) this.e).c();
        }

        public void run() {
            try {
                this.c.await((long) this.d, TimeUnit.SECONDS);
            } catch (Exception unused) {
            } catch (Throwable th) {
                a();
                throw th;
            }
            a();
        }
    }

    public t(Activity activity, SingleAdDetailResult singleAdDetailResult, com.xlx.speech.voicereadsdk.component.media.video.b bVar) {
        this.a = activity;
        this.b = singleAdDetailResult;
        this.c = bVar;
        this.d = singleAdDetailResult.advertGoods.getVideoPath();
        this.e = singleAdDetailResult.advertGoods.getLayerCloseTime();
    }

    /* JADX WARNING: Removed duplicated region for block: B:14:0x0059  */
    /* JADX WARNING: Removed duplicated region for block: B:15:0x005d  */
    @Override // com.xlx.speech.u.d
    public void a(d.a aVar) {
        boolean z;
        CountDownLatch countDownLatch = new CountDownLatch(2);
        ExecutorService executorService = f;
        executorService.execute(new c(this.a, this.b, countDownLatch, Math.max(8, this.e), aVar));
        executorService.execute(new b(countDownLatch, this.e));
        com.xlx.speech.voicereadsdk.component.media.video.b bVar = this.c;
        String str = this.d;
        com.xlx.speech.voicereadsdk.component.media.video.a aVar2 = (com.xlx.speech.voicereadsdk.component.media.video.a) bVar;
        aVar2.getClass();
        try {
            Download download = ExoDownloadService.a.c(aVar2.a).getDownloadIndex().getDownload(o.a(str));
            if (download != null) {
                int i = download.state;
                if (i == 3 || i == 4) {
                    z = true;
                    if (!z) {
                        countDownLatch.countDown();
                        return;
                    }
                    com.xlx.speech.voicereadsdk.component.media.video.b bVar2 = this.c;
                    String str2 = this.d;
                    ((com.xlx.speech.voicereadsdk.component.media.video.a) bVar2).getClass();
                    String a2 = o.a(str2);
                    com.xlx.speech.voicereadsdk.component.media.video.b bVar3 = this.c;
                    a aVar3 = new a(this, a2, countDownLatch);
                    com.xlx.speech.voicereadsdk.component.media.video.a aVar4 = (com.xlx.speech.voicereadsdk.component.media.video.a) bVar3;
                    aVar4.getClass();
                    DownloadManager c2 = ExoDownloadService.a.c(aVar4.a);
                    a.b bVar4 = aVar4.d;
                    if (bVar4 != null) {
                        c2.removeListener(bVar4);
                    }
                    a.b bVar5 = new a.b(aVar3);
                    aVar4.d = bVar5;
                    c2.addListener(bVar5);
                    return;
                }
            }
        } catch (IOException e2) {
            e2.printStackTrace();
        }
        z = false;
        if (!z) {
        }
    }
}