package com.bytedance.sdk.openadsdk.component.reward.fm;

import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.animation.ValueAnimator;
import android.app.Activity;
import android.view.View;
import androidx.media3.common.C;
import androidx.media3.exoplayer.ExoPlayer;
import com.bytedance.sdk.openadsdk.core.model.ai;
import com.bytedance.sdk.openadsdk.core.model.lse;

/* JADX INFO: loaded from: classes2.dex */
public class fm {
    protected final String ajl;
    protected final lse fm;
    protected com.bytedance.sdk.openadsdk.core.lb.jnr jnr;

    /* JADX INFO: renamed from: lb, reason: collision with root package name */
    protected final int f6914lb;
    protected final Activity ro;
    private com.bytedance.sdk.openadsdk.core.widget.wsy wsy;
    private AnimatorSet wu;
    com.bytedance.sdk.openadsdk.core.widget.wu yz;

    public fm(Activity activity, lse lseVar, int i10, String str) {
        this.ro = activity;
        this.fm = lseVar;
        this.f6914lb = i10;
        this.ajl = str;
    }

    public View ajl() {
        return this.wsy;
    }

    public void fm(com.bytedance.sdk.openadsdk.core.lb.jnr jnrVar) {
        this.jnr = jnrVar;
    }

    public void jnr() {
        com.bytedance.sdk.openadsdk.core.widget.wsy wsyVar = this.wsy;
        if (wsyVar != null) {
            wsyVar.setVisibility(8);
        }
    }

    public void lb() {
        ValueAnimator valueAnimatorOfInt = ValueAnimator.ofInt(1, 80);
        valueAnimatorOfInt.setDuration(ExoPlayer.DEFAULT_DETACH_SURFACE_TIMEOUT_MS);
        valueAnimatorOfInt.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { // from class: com.bytedance.sdk.openadsdk.component.reward.fm.fm.1
            @Override // android.animation.ValueAnimator.AnimatorUpdateListener
            public void onAnimationUpdate(ValueAnimator valueAnimator) {
                int iIntValue = ((Integer) valueAnimator.getAnimatedValue()).intValue();
                com.bytedance.sdk.openadsdk.core.widget.wu wuVar = fm.this.yz;
                if (wuVar != null) {
                    wuVar.setProgress(iIntValue);
                }
            }
        });
        ValueAnimator valueAnimatorOfInt2 = ValueAnimator.ofInt(81, 99);
        valueAnimatorOfInt2.setDuration(C.DEFAULT_MAX_SEEK_TO_PREVIOUS_POSITION_MS);
        valueAnimatorOfInt2.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { // from class: com.bytedance.sdk.openadsdk.component.reward.fm.fm.2
            @Override // android.animation.ValueAnimator.AnimatorUpdateListener
            public void onAnimationUpdate(ValueAnimator valueAnimator) {
                int iIntValue = ((Integer) valueAnimator.getAnimatedValue()).intValue();
                com.bytedance.sdk.openadsdk.core.widget.wu wuVar = fm.this.yz;
                if (wuVar != null) {
                    wuVar.setProgress(iIntValue);
                }
            }
        });
        AnimatorSet animatorSet = new AnimatorSet();
        this.wu = animatorSet;
        animatorSet.play(valueAnimatorOfInt).before(valueAnimatorOfInt2);
        this.wu.addListener(new AnimatorListenerAdapter() { // from class: com.bytedance.sdk.openadsdk.component.reward.fm.fm.3
            @Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
            public void onAnimationEnd(Animator animator) {
                super.onAnimationEnd(animator);
            }
        });
        this.wu.start();
    }

    public void ro() {
        com.bytedance.sdk.openadsdk.core.widget.wsy wsyVar = this.wsy;
        if (wsyVar != null) {
            wsyVar.bringToFront();
        }
    }

    public void yz() {
        AnimatorSet animatorSet = this.wu;
        if (animatorSet != null) {
            animatorSet.cancel();
        }
    }

    public void fm() {
        try {
            if (ai.lb(this.fm)) {
                return;
            }
            com.bytedance.sdk.openadsdk.core.widget.wsy wsyVar = new com.bytedance.sdk.openadsdk.core.widget.wsy(this.ro);
            this.wsy = wsyVar;
            this.yz = wsyVar.getLoadingProgressBar();
            com.bytedance.sdk.openadsdk.core.ajl.wu downloadButton = this.wsy.getDownloadButton();
            if (downloadButton != null) {
                downloadButton.setOnClickListener(this.jnr);
            }
            this.wsy.fm(this.fm, this.f6914lb);
            this.wsy.fm(this.fm, this.ro, this.ajl);
        } catch (Throwable unused) {
        }
    }
}
