package xyz.stream.view.refresh.layout;

import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ValueAnimator;
import xyz.stream.view.refresh.layout.api.RefreshComponent;
import xyz.stream.view.refresh.layout.constant.RefreshState;
import xyz.stream.view.refresh.layout.util.AutoUtil;

/* JADX INFO: loaded from: classes3.dex */
public final /* synthetic */ class a implements Runnable {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final /* synthetic */ int f36636a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final /* synthetic */ AutoRefreshLayout f36637b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public final /* synthetic */ int f36638c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public final /* synthetic */ float f36639d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public final /* synthetic */ boolean f36640e;

    public /* synthetic */ a(AutoRefreshLayout autoRefreshLayout, int i10, float f10, boolean z10, int i11) {
        this.f36636a = i11;
        this.f36637b = autoRefreshLayout;
        this.f36638c = i10;
        this.f36639d = f10;
        this.f36640e = z10;
    }

    @Override // java.lang.Runnable
    public final void run() {
        int i10 = this.f36636a;
        final boolean z10 = this.f36640e;
        float f10 = this.f36639d;
        int i11 = this.f36638c;
        final AutoRefreshLayout autoRefreshLayout = this.f36637b;
        switch (i10) {
            case 0:
                if (autoRefreshLayout.mViceState == RefreshState.Loading) {
                    ValueAnimator valueAnimator = autoRefreshLayout.reboundAnimator;
                    if (valueAnimator != null) {
                        valueAnimator.setDuration(0L);
                        autoRefreshLayout.reboundAnimator.cancel();
                        autoRefreshLayout.reboundAnimator = null;
                    }
                    autoRefreshLayout.mLastTouchX = autoRefreshLayout.getMeasuredWidth() / 2.0f;
                    autoRefreshLayout.mKernel.setState(RefreshState.PullUpToLoad);
                    RefreshComponent refreshComponent = autoRefreshLayout.mRefreshFooter;
                    if (refreshComponent == null || !refreshComponent.autoOpen(i11, f10, z10)) {
                        int i12 = autoRefreshLayout.mFooterHeight;
                        float f11 = i12 == 0 ? autoRefreshLayout.mFooterTriggerRate : i12;
                        if (f10 < 10.0f) {
                            f10 *= f11;
                        }
                        ValueAnimator valueAnimatorOfInt = ValueAnimator.ofInt(autoRefreshLayout.mSpinner, -((int) f10));
                        autoRefreshLayout.reboundAnimator = valueAnimatorOfInt;
                        valueAnimatorOfInt.setDuration(i11);
                        autoRefreshLayout.reboundAnimator.setInterpolator(new AutoUtil(AutoUtil.INTERPOLATOR_VISCOUS_FLUID));
                        autoRefreshLayout.reboundAnimator.addUpdateListener(new b(autoRefreshLayout, 2));
                        autoRefreshLayout.reboundAnimator.addListener(new AnimatorListenerAdapter() { // from class: xyz.stream.view.refresh.layout.AutoRefreshLayout.7
                            @Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
                            public void onAnimationEnd(Animator animator) {
                                AutoRefreshLayout.this.mKernel.onAutoLoadMoreAnimationEnd(animator, z10);
                            }
                        });
                        autoRefreshLayout.reboundAnimator.start();
                    }
                    break;
                }
                break;
            default:
                if (autoRefreshLayout.mViceState == RefreshState.Refreshing) {
                    ValueAnimator valueAnimator2 = autoRefreshLayout.reboundAnimator;
                    if (valueAnimator2 != null) {
                        valueAnimator2.setDuration(0L);
                        autoRefreshLayout.reboundAnimator.cancel();
                        autoRefreshLayout.reboundAnimator = null;
                    }
                    autoRefreshLayout.mLastTouchX = autoRefreshLayout.getMeasuredWidth() / 2.0f;
                    autoRefreshLayout.mKernel.setState(RefreshState.PullDownToRefresh);
                    RefreshComponent refreshComponent2 = autoRefreshLayout.mRefreshHeader;
                    if (refreshComponent2 == null || !refreshComponent2.autoOpen(i11, f10, z10)) {
                        int i13 = autoRefreshLayout.mHeaderHeight;
                        float f12 = i13 == 0 ? autoRefreshLayout.mHeaderTriggerRate : i13;
                        if (f10 < 10.0f) {
                            f10 *= f12;
                        }
                        ValueAnimator valueAnimatorOfInt2 = ValueAnimator.ofInt(autoRefreshLayout.mSpinner, (int) f10);
                        autoRefreshLayout.reboundAnimator = valueAnimatorOfInt2;
                        valueAnimatorOfInt2.setDuration(i11);
                        autoRefreshLayout.reboundAnimator.setInterpolator(new AutoUtil(AutoUtil.INTERPOLATOR_VISCOUS_FLUID));
                        autoRefreshLayout.reboundAnimator.addUpdateListener(new b(autoRefreshLayout, 1));
                        autoRefreshLayout.reboundAnimator.addListener(new AnimatorListenerAdapter() { // from class: xyz.stream.view.refresh.layout.AutoRefreshLayout.6
                            @Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
                            public void onAnimationEnd(Animator animator) {
                                AutoRefreshLayout.this.mKernel.onAutoRefreshAnimationEnd(animator, z10);
                            }
                        });
                        autoRefreshLayout.reboundAnimator.start();
                    }
                    break;
                }
                break;
        }
    }
}
