package D1;

import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.animation.ValueAnimator;
import android.content.res.Resources;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.LinearInterpolator;
import com.martsnew.tv.R;
import java.util.ArrayList;
import n4.u0;

/* JADX INFO: loaded from: classes.dex */
public final class x {

    /* JADX INFO: renamed from: A, reason: collision with root package name */
    public boolean f1842A;

    /* JADX INFO: renamed from: B, reason: collision with root package name */
    public boolean f1843B;

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final C0093s f1845a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final View f1846b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public final ViewGroup f1847c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public final ViewGroup f1848d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public final ViewGroup f1849e;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public final ViewGroup f1850f;

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    public final ViewGroup f1851g;

    /* JADX INFO: renamed from: h, reason: collision with root package name */
    public final ViewGroup f1852h;
    public final ViewGroup i;

    /* JADX INFO: renamed from: j, reason: collision with root package name */
    public final View f1853j;

    /* JADX INFO: renamed from: k, reason: collision with root package name */
    public final View f1854k;

    /* JADX INFO: renamed from: l, reason: collision with root package name */
    public final AnimatorSet f1855l;

    /* JADX INFO: renamed from: m, reason: collision with root package name */
    public final AnimatorSet f1856m;

    /* JADX INFO: renamed from: n, reason: collision with root package name */
    public final AnimatorSet f1857n;

    /* JADX INFO: renamed from: o, reason: collision with root package name */
    public final AnimatorSet f1858o;

    /* JADX INFO: renamed from: p, reason: collision with root package name */
    public final AnimatorSet f1859p;

    /* JADX INFO: renamed from: q, reason: collision with root package name */
    public final ValueAnimator f1860q;

    /* JADX INFO: renamed from: r, reason: collision with root package name */
    public final ValueAnimator f1861r;

    /* JADX INFO: renamed from: s, reason: collision with root package name */
    public final t f1862s = new t(this, 0);

    /* JADX INFO: renamed from: t, reason: collision with root package name */
    public final t f1863t = new t(this, 3);

    /* JADX INFO: renamed from: u, reason: collision with root package name */
    public final t f1864u = new t(this, 4);

    /* JADX INFO: renamed from: v, reason: collision with root package name */
    public final t f1865v = new t(this, 5);

    /* JADX INFO: renamed from: w, reason: collision with root package name */
    public final t f1866w = new t(this, 6);

    /* JADX INFO: renamed from: x, reason: collision with root package name */
    public final ViewOnLayoutChangeListenerC0081f f1867x = new ViewOnLayoutChangeListenerC0081f(1, this);

    /* JADX INFO: renamed from: C, reason: collision with root package name */
    public boolean f1844C = true;

    /* JADX INFO: renamed from: z, reason: collision with root package name */
    public int f1869z = 0;

    /* JADX INFO: renamed from: y, reason: collision with root package name */
    public final ArrayList f1868y = new ArrayList();

    public x(C0093s c0093s) {
        final int i = 2;
        this.f1845a = c0093s;
        final int i5 = 0;
        final int i8 = 3;
        int i9 = 5;
        final int i10 = 1;
        this.f1846b = c0093s.findViewById(R.id.exo_controls_background);
        this.f1847c = (ViewGroup) c0093s.findViewById(R.id.exo_center_controls);
        this.f1849e = (ViewGroup) c0093s.findViewById(R.id.exo_minimal_controls);
        ViewGroup viewGroup = (ViewGroup) c0093s.findViewById(R.id.exo_bottom_bar);
        this.f1848d = viewGroup;
        this.i = (ViewGroup) c0093s.findViewById(R.id.exo_time);
        View viewFindViewById = c0093s.findViewById(R.id.exo_progress);
        this.f1853j = viewFindViewById;
        this.f1850f = (ViewGroup) c0093s.findViewById(R.id.exo_basic_controls);
        this.f1851g = (ViewGroup) c0093s.findViewById(R.id.exo_extra_controls);
        this.f1852h = (ViewGroup) c0093s.findViewById(R.id.exo_extra_controls_scroll_view);
        View viewFindViewById2 = c0093s.findViewById(R.id.exo_overflow_show);
        this.f1854k = viewFindViewById2;
        View viewFindViewById3 = c0093s.findViewById(R.id.exo_overflow_hide);
        if (viewFindViewById2 != null && viewFindViewById3 != null) {
            viewFindViewById2.setOnClickListener(new C5.c(i9, this));
            viewFindViewById3.setOnClickListener(new C5.c(i9, this));
        }
        ValueAnimator valueAnimatorOfFloat = ValueAnimator.ofFloat(1.0f, 0.0f);
        valueAnimatorOfFloat.setInterpolator(new LinearInterpolator());
        valueAnimatorOfFloat.addUpdateListener(new ValueAnimator.AnimatorUpdateListener(this) { // from class: D1.u

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

            {
                this.f1836b = this;
            }

            @Override // android.animation.ValueAnimator.AnimatorUpdateListener
            public final void onAnimationUpdate(ValueAnimator valueAnimator) {
                switch (i8) {
                    case u0.f15495q /* 0 */:
                        x xVar = this.f1836b;
                        xVar.getClass();
                        float fFloatValue = ((Float) valueAnimator.getAnimatedValue()).floatValue();
                        View view = xVar.f1846b;
                        if (view != null) {
                            view.setAlpha(fFloatValue);
                        }
                        ViewGroup viewGroup2 = xVar.f1847c;
                        if (viewGroup2 != null) {
                            viewGroup2.setAlpha(fFloatValue);
                        }
                        ViewGroup viewGroup3 = xVar.f1849e;
                        if (viewGroup3 != null) {
                            viewGroup3.setAlpha(fFloatValue);
                        }
                        break;
                    case 1:
                        x xVar2 = this.f1836b;
                        xVar2.getClass();
                        xVar2.a(((Float) valueAnimator.getAnimatedValue()).floatValue());
                        break;
                    case 2:
                        x xVar3 = this.f1836b;
                        xVar3.getClass();
                        xVar3.a(((Float) valueAnimator.getAnimatedValue()).floatValue());
                        break;
                    default:
                        x xVar4 = this.f1836b;
                        xVar4.getClass();
                        float fFloatValue2 = ((Float) valueAnimator.getAnimatedValue()).floatValue();
                        View view2 = xVar4.f1846b;
                        if (view2 != null) {
                            view2.setAlpha(fFloatValue2);
                        }
                        ViewGroup viewGroup4 = xVar4.f1847c;
                        if (viewGroup4 != null) {
                            viewGroup4.setAlpha(fFloatValue2);
                        }
                        ViewGroup viewGroup5 = xVar4.f1849e;
                        if (viewGroup5 != null) {
                            viewGroup5.setAlpha(fFloatValue2);
                        }
                        break;
                }
            }
        });
        valueAnimatorOfFloat.addListener(new v(this, i5));
        ValueAnimator valueAnimatorOfFloat2 = ValueAnimator.ofFloat(0.0f, 1.0f);
        valueAnimatorOfFloat2.setInterpolator(new LinearInterpolator());
        valueAnimatorOfFloat2.addUpdateListener(new ValueAnimator.AnimatorUpdateListener(this) { // from class: D1.u

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

            {
                this.f1836b = this;
            }

            @Override // android.animation.ValueAnimator.AnimatorUpdateListener
            public final void onAnimationUpdate(ValueAnimator valueAnimator) {
                switch (i5) {
                    case u0.f15495q /* 0 */:
                        x xVar = this.f1836b;
                        xVar.getClass();
                        float fFloatValue = ((Float) valueAnimator.getAnimatedValue()).floatValue();
                        View view = xVar.f1846b;
                        if (view != null) {
                            view.setAlpha(fFloatValue);
                        }
                        ViewGroup viewGroup2 = xVar.f1847c;
                        if (viewGroup2 != null) {
                            viewGroup2.setAlpha(fFloatValue);
                        }
                        ViewGroup viewGroup3 = xVar.f1849e;
                        if (viewGroup3 != null) {
                            viewGroup3.setAlpha(fFloatValue);
                        }
                        break;
                    case 1:
                        x xVar2 = this.f1836b;
                        xVar2.getClass();
                        xVar2.a(((Float) valueAnimator.getAnimatedValue()).floatValue());
                        break;
                    case 2:
                        x xVar3 = this.f1836b;
                        xVar3.getClass();
                        xVar3.a(((Float) valueAnimator.getAnimatedValue()).floatValue());
                        break;
                    default:
                        x xVar4 = this.f1836b;
                        xVar4.getClass();
                        float fFloatValue2 = ((Float) valueAnimator.getAnimatedValue()).floatValue();
                        View view2 = xVar4.f1846b;
                        if (view2 != null) {
                            view2.setAlpha(fFloatValue2);
                        }
                        ViewGroup viewGroup4 = xVar4.f1847c;
                        if (viewGroup4 != null) {
                            viewGroup4.setAlpha(fFloatValue2);
                        }
                        ViewGroup viewGroup5 = xVar4.f1849e;
                        if (viewGroup5 != null) {
                            viewGroup5.setAlpha(fFloatValue2);
                        }
                        break;
                }
            }
        });
        valueAnimatorOfFloat2.addListener(new v(this, i10));
        Resources resources = c0093s.getResources();
        float dimension = resources.getDimension(R.dimen.exo_styled_bottom_bar_height) - resources.getDimension(R.dimen.exo_styled_progress_bar_height);
        float dimension2 = resources.getDimension(R.dimen.exo_styled_bottom_bar_height);
        AnimatorSet animatorSet = new AnimatorSet();
        this.f1855l = animatorSet;
        animatorSet.setDuration(250L);
        animatorSet.addListener(new w(this, c0093s, i5));
        animatorSet.play(valueAnimatorOfFloat).with(d(viewFindViewById, 0.0f, dimension)).with(d(viewGroup, 0.0f, dimension));
        AnimatorSet animatorSet2 = new AnimatorSet();
        this.f1856m = animatorSet2;
        animatorSet2.setDuration(250L);
        animatorSet2.addListener(new w(this, c0093s, i10));
        animatorSet2.play(d(viewFindViewById, dimension, dimension2)).with(d(viewGroup, dimension, dimension2));
        AnimatorSet animatorSet3 = new AnimatorSet();
        this.f1857n = animatorSet3;
        animatorSet3.setDuration(250L);
        animatorSet3.addListener(new w(this, c0093s, i));
        animatorSet3.play(valueAnimatorOfFloat).with(d(viewFindViewById, 0.0f, dimension2)).with(d(viewGroup, 0.0f, dimension2));
        AnimatorSet animatorSet4 = new AnimatorSet();
        this.f1858o = animatorSet4;
        animatorSet4.setDuration(250L);
        animatorSet4.addListener(new v(this, i));
        animatorSet4.play(valueAnimatorOfFloat2).with(d(viewFindViewById, dimension, 0.0f)).with(d(viewGroup, dimension, 0.0f));
        AnimatorSet animatorSet5 = new AnimatorSet();
        this.f1859p = animatorSet5;
        animatorSet5.setDuration(250L);
        animatorSet5.addListener(new v(this, 3));
        animatorSet5.play(valueAnimatorOfFloat2).with(d(viewFindViewById, dimension2, 0.0f)).with(d(viewGroup, dimension2, 0.0f));
        ValueAnimator valueAnimatorOfFloat3 = ValueAnimator.ofFloat(0.0f, 1.0f);
        this.f1860q = valueAnimatorOfFloat3;
        valueAnimatorOfFloat3.setDuration(250L);
        valueAnimatorOfFloat3.addUpdateListener(new ValueAnimator.AnimatorUpdateListener(this) { // from class: D1.u

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

            {
                this.f1836b = this;
            }

            @Override // android.animation.ValueAnimator.AnimatorUpdateListener
            public final void onAnimationUpdate(ValueAnimator valueAnimator) {
                switch (i10) {
                    case u0.f15495q /* 0 */:
                        x xVar = this.f1836b;
                        xVar.getClass();
                        float fFloatValue = ((Float) valueAnimator.getAnimatedValue()).floatValue();
                        View view = xVar.f1846b;
                        if (view != null) {
                            view.setAlpha(fFloatValue);
                        }
                        ViewGroup viewGroup2 = xVar.f1847c;
                        if (viewGroup2 != null) {
                            viewGroup2.setAlpha(fFloatValue);
                        }
                        ViewGroup viewGroup3 = xVar.f1849e;
                        if (viewGroup3 != null) {
                            viewGroup3.setAlpha(fFloatValue);
                        }
                        break;
                    case 1:
                        x xVar2 = this.f1836b;
                        xVar2.getClass();
                        xVar2.a(((Float) valueAnimator.getAnimatedValue()).floatValue());
                        break;
                    case 2:
                        x xVar3 = this.f1836b;
                        xVar3.getClass();
                        xVar3.a(((Float) valueAnimator.getAnimatedValue()).floatValue());
                        break;
                    default:
                        x xVar4 = this.f1836b;
                        xVar4.getClass();
                        float fFloatValue2 = ((Float) valueAnimator.getAnimatedValue()).floatValue();
                        View view2 = xVar4.f1846b;
                        if (view2 != null) {
                            view2.setAlpha(fFloatValue2);
                        }
                        ViewGroup viewGroup4 = xVar4.f1847c;
                        if (viewGroup4 != null) {
                            viewGroup4.setAlpha(fFloatValue2);
                        }
                        ViewGroup viewGroup5 = xVar4.f1849e;
                        if (viewGroup5 != null) {
                            viewGroup5.setAlpha(fFloatValue2);
                        }
                        break;
                }
            }
        });
        valueAnimatorOfFloat3.addListener(new v(this, 4));
        ValueAnimator valueAnimatorOfFloat4 = ValueAnimator.ofFloat(1.0f, 0.0f);
        this.f1861r = valueAnimatorOfFloat4;
        valueAnimatorOfFloat4.setDuration(250L);
        valueAnimatorOfFloat4.addUpdateListener(new ValueAnimator.AnimatorUpdateListener(this) { // from class: D1.u

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

            {
                this.f1836b = this;
            }

            @Override // android.animation.ValueAnimator.AnimatorUpdateListener
            public final void onAnimationUpdate(ValueAnimator valueAnimator) {
                switch (i) {
                    case u0.f15495q /* 0 */:
                        x xVar = this.f1836b;
                        xVar.getClass();
                        float fFloatValue = ((Float) valueAnimator.getAnimatedValue()).floatValue();
                        View view = xVar.f1846b;
                        if (view != null) {
                            view.setAlpha(fFloatValue);
                        }
                        ViewGroup viewGroup2 = xVar.f1847c;
                        if (viewGroup2 != null) {
                            viewGroup2.setAlpha(fFloatValue);
                        }
                        ViewGroup viewGroup3 = xVar.f1849e;
                        if (viewGroup3 != null) {
                            viewGroup3.setAlpha(fFloatValue);
                        }
                        break;
                    case 1:
                        x xVar2 = this.f1836b;
                        xVar2.getClass();
                        xVar2.a(((Float) valueAnimator.getAnimatedValue()).floatValue());
                        break;
                    case 2:
                        x xVar3 = this.f1836b;
                        xVar3.getClass();
                        xVar3.a(((Float) valueAnimator.getAnimatedValue()).floatValue());
                        break;
                    default:
                        x xVar4 = this.f1836b;
                        xVar4.getClass();
                        float fFloatValue2 = ((Float) valueAnimator.getAnimatedValue()).floatValue();
                        View view2 = xVar4.f1846b;
                        if (view2 != null) {
                            view2.setAlpha(fFloatValue2);
                        }
                        ViewGroup viewGroup4 = xVar4.f1847c;
                        if (viewGroup4 != null) {
                            viewGroup4.setAlpha(fFloatValue2);
                        }
                        ViewGroup viewGroup5 = xVar4.f1849e;
                        if (viewGroup5 != null) {
                            viewGroup5.setAlpha(fFloatValue2);
                        }
                        break;
                }
            }
        });
        valueAnimatorOfFloat4.addListener(new v(this, 5));
    }

    public static int c(View view) {
        if (view == null) {
            return 0;
        }
        int width = view.getWidth();
        ViewGroup.LayoutParams layoutParams = view.getLayoutParams();
        if (!(layoutParams instanceof ViewGroup.MarginLayoutParams)) {
            return width;
        }
        ViewGroup.MarginLayoutParams marginLayoutParams = (ViewGroup.MarginLayoutParams) layoutParams;
        return marginLayoutParams.leftMargin + marginLayoutParams.rightMargin + width;
    }

    public static ObjectAnimator d(View view, float f3, float f7) {
        return ObjectAnimator.ofFloat(view, "translationY", f3, f7);
    }

    public static boolean j(View view) {
        int id = view.getId();
        return id == R.id.exo_bottom_bar || id == R.id.exo_prev || id == R.id.exo_next || id == R.id.exo_rew || id == R.id.exo_rew_with_amount || id == R.id.exo_ffwd || id == R.id.exo_ffwd_with_amount;
    }

    public final void a(float f3) {
        ViewGroup viewGroup = this.f1852h;
        if (viewGroup != null) {
            viewGroup.setTranslationX((int) ((1.0f - f3) * viewGroup.getWidth()));
        }
        ViewGroup viewGroup2 = this.i;
        if (viewGroup2 != null) {
            viewGroup2.setAlpha(1.0f - f3);
        }
        ViewGroup viewGroup3 = this.f1850f;
        if (viewGroup3 != null) {
            viewGroup3.setAlpha(1.0f - f3);
        }
    }

    public final boolean b(View view) {
        return view != null && this.f1868y.contains(view);
    }

    public final void e(Runnable runnable, long j8) {
        if (j8 >= 0) {
            this.f1845a.postDelayed(runnable, j8);
        }
    }

    public final void f() {
        t tVar = this.f1866w;
        C0093s c0093s = this.f1845a;
        c0093s.removeCallbacks(tVar);
        c0093s.removeCallbacks(this.f1863t);
        c0093s.removeCallbacks(this.f1865v);
        c0093s.removeCallbacks(this.f1864u);
    }

    public final void g() {
        if (this.f1869z == 3) {
            return;
        }
        f();
        int showTimeoutMs = this.f1845a.getShowTimeoutMs();
        if (showTimeoutMs > 0) {
            if (!this.f1844C) {
                e(this.f1866w, showTimeoutMs);
            } else if (this.f1869z == 1) {
                e(this.f1864u, 2000L);
            } else {
                e(this.f1865v, showTimeoutMs);
            }
        }
    }

    public final void h(View view, boolean z8) {
        if (view == null) {
            return;
        }
        ArrayList arrayList = this.f1868y;
        if (!z8) {
            view.setVisibility(8);
            arrayList.remove(view);
            return;
        }
        if (this.f1842A && j(view)) {
            view.setVisibility(4);
        } else {
            view.setVisibility(0);
        }
        arrayList.add(view);
    }

    public final void i(int i) {
        int i5 = this.f1869z;
        this.f1869z = i;
        C0093s c0093s = this.f1845a;
        if (i == 2) {
            c0093s.setVisibility(8);
        } else if (i5 == 2) {
            c0093s.setVisibility(0);
        }
        if (i5 != i) {
            for (r rVar : c0093s.f1819t) {
                c0093s.getVisibility();
                A a3 = (A) rVar;
                a3.getClass();
                a3.f1653s.m();
            }
        }
    }

    public final void k() {
        if (!this.f1844C) {
            i(0);
            g();
            return;
        }
        int i = this.f1869z;
        if (i == 1) {
            this.f1858o.start();
        } else if (i == 2) {
            this.f1859p.start();
        } else if (i == 3) {
            this.f1843B = true;
        } else if (i == 4) {
            return;
        }
        g();
    }
}
