package p138.p176.p177.p190.p236;

import android.content.Context;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;
import android.os.Looper;
import android.os.SystemClock;
import android.util.AttributeSet;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.TextView;
import com.google.android.exoplayer2.ExoPlaybackException;
import com.google.android.exoplayer2.ui.DefaultTimeBar;
import java.util.Arrays;
import java.util.Formatter;
import java.util.Iterator;
import java.util.Locale;
import java.util.concurrent.CopyOnWriteArrayList;
import p000.p001.p002.p003.p004.C0567;
import p138.p176.p177.p190.AbstractC3457;
import p138.p176.p177.p190.C3414;
import p138.p176.p177.p190.C3416;
import p138.p176.p177.p190.C3430;
import p138.p176.p177.p190.C3439;
import p138.p176.p177.p190.C3441;
import p138.p176.p177.p190.InterfaceC3415;
import p138.p176.p177.p190.InterfaceC3440;
import p138.p176.p177.p190.InterfaceC3442;
import p138.p176.p177.p190.p217.C3829;
import p138.p176.p177.p190.p235.C4039;
import p138.p176.p177.p190.p236.InterfaceC4070;
import p138.p176.p177.p190.p239.C4150;

/* JADX INFO: renamed from: ދ.ހ.֏.ؠ.ྉ.ކ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes.dex */
public class C4054 extends FrameLayout {

    /* JADX INFO: renamed from: ރ, reason: contains not printable characters */
    public final ViewOnClickListenerC4056 f12862;

    /* JADX INFO: renamed from: ބ, reason: contains not printable characters */
    public final CopyOnWriteArrayList<InterfaceC4058> f12863;

    /* JADX INFO: renamed from: ޅ, reason: contains not printable characters */
    public final View f12864;

    /* JADX INFO: renamed from: ކ, reason: contains not printable characters */
    public final View f12865;

    /* JADX INFO: renamed from: އ, reason: contains not printable characters */
    public final View f12866;

    /* JADX INFO: renamed from: ވ, reason: contains not printable characters */
    public final View f12867;

    /* JADX INFO: renamed from: މ, reason: contains not printable characters */
    public final View f12868;

    /* JADX INFO: renamed from: ފ, reason: contains not printable characters */
    public final View f12869;

    /* JADX INFO: renamed from: ދ, reason: contains not printable characters */
    public final ImageView f12870;

    /* JADX INFO: renamed from: ތ, reason: contains not printable characters */
    public final ImageView f12871;

    /* JADX INFO: renamed from: ލ, reason: contains not printable characters */
    public final View f12872;

    /* JADX INFO: renamed from: ގ, reason: contains not printable characters */
    public final TextView f12873;

    /* JADX INFO: renamed from: ޏ, reason: contains not printable characters */
    public final TextView f12874;

    /* JADX INFO: renamed from: ސ, reason: contains not printable characters */
    public final InterfaceC4070 f12875;

    /* JADX INFO: renamed from: ޑ, reason: contains not printable characters */
    public final StringBuilder f12876;

    /* JADX INFO: renamed from: ޒ, reason: contains not printable characters */
    public final Formatter f12877;

    /* JADX INFO: renamed from: ޓ, reason: contains not printable characters */
    public final AbstractC3457.C3459 f12878;

    /* JADX INFO: renamed from: ޔ, reason: contains not printable characters */
    public final AbstractC3457.C3460 f12879;

    /* JADX INFO: renamed from: ޕ, reason: contains not printable characters */
    public final Runnable f12880;

    /* JADX INFO: renamed from: ޖ, reason: contains not printable characters */
    public final Runnable f12881;

    /* JADX INFO: renamed from: ޗ, reason: contains not printable characters */
    public final Drawable f12882;

    /* JADX INFO: renamed from: ޘ, reason: contains not printable characters */
    public final Drawable f12883;

    /* JADX INFO: renamed from: ޙ, reason: contains not printable characters */
    public final Drawable f12884;

    /* JADX INFO: renamed from: ޚ, reason: contains not printable characters */
    public final String f12885;

    /* JADX INFO: renamed from: ޛ, reason: contains not printable characters */
    public final String f12886;

    /* JADX INFO: renamed from: ޜ, reason: contains not printable characters */
    public final String f12887;

    /* JADX INFO: renamed from: ޝ, reason: contains not printable characters */
    public final Drawable f12888;

    /* JADX INFO: renamed from: ޞ, reason: contains not printable characters */
    public final Drawable f12889;

    /* JADX INFO: renamed from: ޟ, reason: contains not printable characters */
    public final float f12890;

    /* JADX INFO: renamed from: ޠ, reason: contains not printable characters */
    public final float f12891;

    /* JADX INFO: renamed from: ޡ, reason: contains not printable characters */
    public final String f12892;

    /* JADX INFO: renamed from: ޢ, reason: contains not printable characters */
    public final String f12893;

    /* JADX INFO: renamed from: ޣ, reason: contains not printable characters */
    public InterfaceC3442 f12894;

    /* JADX INFO: renamed from: ޤ, reason: contains not printable characters */
    public InterfaceC3415 f12895;

    /* JADX INFO: renamed from: ޥ, reason: contains not printable characters */
    public InterfaceC4057 f12896;

    /* JADX INFO: renamed from: ޱ, reason: contains not printable characters */
    public InterfaceC3440 f12897;

    /* JADX INFO: renamed from: ࢠ, reason: contains not printable characters */
    public boolean f12898;

    /* JADX INFO: renamed from: ࢢ, reason: contains not printable characters */
    public boolean f12899;

    /* JADX INFO: renamed from: ࢣ, reason: contains not printable characters */
    public boolean f12900;

    /* JADX INFO: renamed from: ࢤ, reason: contains not printable characters */
    public boolean f12901;

    /* JADX INFO: renamed from: ࢥ, reason: contains not printable characters */
    public int f12902;

    /* JADX INFO: renamed from: ࢦ, reason: contains not printable characters */
    public int f12903;

    /* JADX INFO: renamed from: ࢧ, reason: contains not printable characters */
    public int f12904;

    /* JADX INFO: renamed from: ࢨ, reason: contains not printable characters */
    public int f12905;

    /* JADX INFO: renamed from: ࢩ, reason: contains not printable characters */
    public int f12906;

    /* JADX INFO: renamed from: ࢪ, reason: contains not printable characters */
    public boolean f12907;

    /* JADX INFO: renamed from: ࢫ, reason: contains not printable characters */
    public long f12908;

    /* JADX INFO: renamed from: ࢬ, reason: contains not printable characters */
    public long[] f12909;

    /* JADX INFO: renamed from: ೱ, reason: contains not printable characters */
    public boolean[] f12910;

    /* JADX INFO: renamed from: ೲ, reason: contains not printable characters */
    public long[] f12911;

    /* JADX INFO: renamed from: ഩ, reason: contains not printable characters */
    public boolean[] f12912;

    /* JADX INFO: renamed from: ഺ, reason: contains not printable characters */
    public long f12913;

    /* JADX INFO: renamed from: ދ.ހ.֏.ؠ.ྉ.ކ$ؠ, reason: contains not printable characters */
    public final class ViewOnClickListenerC4056 implements InterfaceC3442.InterfaceC3443, InterfaceC4070.InterfaceC4071, View.OnClickListener {
        public /* synthetic */ ViewOnClickListenerC4056(C4055 c4055) {
        }

        /* JADX WARN: Removed duplicated region for block: B:65:0x00b9 A[LOOP:0: B:48:0x009a->B:65:0x00b9, LOOP_END] */
        /* JADX WARN: Removed duplicated region for block: B:78:0x00b7 A[SYNTHETIC] */
        @Override // android.view.View.OnClickListener
        /*
            Code decompiled incorrectly, please refer to instructions dump.
        */
        public void onClick(View view) {
            boolean z;
            int i;
            int i2;
            C4054 c4054 = C4054.this;
            InterfaceC3442 interfaceC3442 = c4054.f12894;
            if (interfaceC3442 == null) {
                return;
            }
            if (c4054.f12865 == view) {
                c4054.m6517(interfaceC3442);
                return;
            }
            if (c4054.f12864 == view) {
                c4054.m6523(interfaceC3442);
                return;
            }
            if (c4054.f12868 == view) {
                if (!interfaceC3442.mo5435() || (i2 = c4054.f12903) <= 0) {
                    return;
                }
                c4054.m6518(interfaceC3442, i2);
                return;
            }
            if (c4054.f12869 == view) {
                if (!interfaceC3442.mo5435() || (i = c4054.f12902) <= 0) {
                    return;
                }
                c4054.m6518(interfaceC3442, -i);
                return;
            }
            if (c4054.f12866 == view) {
                if (interfaceC3442.mo5493() == 1) {
                    InterfaceC3440 interfaceC3440 = C4054.this.f12897;
                    if (interfaceC3440 != null) {
                        interfaceC3440.m5630();
                    }
                } else if (interfaceC3442.mo5493() == 4) {
                    C4054.this.m6521(interfaceC3442, interfaceC3442.mo5510(), -9223372036854775807L);
                }
                if (((C3416) C4054.this.f12895) == null) {
                    throw null;
                }
                interfaceC3442.mo5485(true);
                return;
            }
            if (c4054.f12867 == view) {
                if (((C3416) c4054.f12895) == null) {
                    throw null;
                }
                interfaceC3442.mo5485(false);
                return;
            }
            if (c4054.f12870 != view) {
                if (c4054.f12871 == view) {
                    InterfaceC3415 interfaceC3415 = c4054.f12895;
                    boolean z2 = !interfaceC3442.mo5508();
                    if (((C3416) interfaceC3415) == null) {
                        throw null;
                    }
                    interfaceC3442.mo5489(z2);
                    return;
                }
                return;
            }
            InterfaceC3415 interfaceC34152 = c4054.f12895;
            int iMo5498 = interfaceC3442.mo5498();
            int i3 = C4054.this.f12906;
            int i4 = 1;
            while (true) {
                if (i4 > 2) {
                    break;
                }
                int i5 = (iMo5498 + i4) % 3;
                if (i5 == 0) {
                    if (!z) {
                        iMo5498 = i5;
                        break;
                    }
                    i4++;
                } else {
                    z = i5 == 1;
                    if (!z) {
                    }
                }
            }
            if (((C3416) interfaceC34152) == null) {
                throw null;
            }
            interfaceC3442.mo5491(iMo5498);
        }

        @Override // p138.p176.p177.p190.InterfaceC3442.InterfaceC3443
        /* JADX INFO: renamed from: ֏ */
        public /* synthetic */ void mo1956(ExoPlaybackException exoPlaybackException) {
            C3441.m5633(this, exoPlaybackException);
        }

        @Override // p138.p176.p177.p190.InterfaceC3442.InterfaceC3443
        /* JADX INFO: renamed from: ֏ */
        public /* synthetic */ void mo1957(C3439 c3439) {
            C3441.m5634(this, c3439);
        }

        @Override // p138.p176.p177.p190.InterfaceC3442.InterfaceC3443
        /* JADX INFO: renamed from: ֏ */
        public void mo1958(AbstractC3457 abstractC3457, int i) {
            C4054.this.m6528();
            C4054.this.m6533();
        }

        @Override // p138.p176.p177.p190.InterfaceC3442.InterfaceC3443
        @Deprecated
        /* JADX INFO: renamed from: ֏ */
        public /* synthetic */ void mo1959(AbstractC3457 abstractC3457, Object obj, int i) {
            C3441.m5636(this, abstractC3457, obj, i);
        }

        @Override // p138.p176.p177.p190.InterfaceC3442.InterfaceC3443
        /* JADX INFO: renamed from: ֏ */
        public /* synthetic */ void mo1960(C3829 c3829, C4039 c4039) {
            C3441.m5637(this, c3829, c4039);
        }

        @Override // p138.p176.p177.p190.p236.InterfaceC4070.InterfaceC4071
        /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
        public void mo6534(InterfaceC4070 interfaceC4070, long j) {
            C4054 c4054 = C4054.this;
            c4054.f12901 = true;
            TextView textView = c4054.f12874;
            if (textView != null) {
                textView.setText(C4150.m6759(c4054.f12876, c4054.f12877, j));
            }
        }

        @Override // p138.p176.p177.p190.p236.InterfaceC4070.InterfaceC4071
        /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
        public void mo6535(InterfaceC4070 interfaceC4070, long j, long j2) {
            C4054 c4054 = C4054.this;
            TextView textView = c4054.f12874;
            if (textView != null) {
                textView.setText(C4150.m6759(c4054.f12876, c4054.f12877, j2));
            }
        }

        @Override // p138.p176.p177.p190.p236.InterfaceC4070.InterfaceC4071
        /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
        public void mo6536(InterfaceC4070 interfaceC4070, long j, boolean z) {
            InterfaceC3442 interfaceC3442;
            C4054 c4054 = C4054.this;
            int iMo5510 = 0;
            c4054.f12901 = false;
            if (z || (interfaceC3442 = c4054.f12894) == null) {
                return;
            }
            AbstractC3457 abstractC3457Mo5506 = interfaceC3442.mo5506();
            if (c4054.f12900 && !abstractC3457Mo5506.m5686()) {
                int iMo1228 = abstractC3457Mo5506.mo1228();
                while (true) {
                    long jM5695 = abstractC3457Mo5506.m5684(iMo5510, c4054.f12879).m5695();
                    if (j < jM5695) {
                        break;
                    }
                    if (iMo5510 == iMo1228 - 1) {
                        j = jM5695;
                        break;
                    } else {
                        j -= jM5695;
                        iMo5510++;
                    }
                }
            } else {
                iMo5510 = interfaceC3442.mo5510();
            }
            c4054.m6521(interfaceC3442, iMo5510, j);
        }

        @Override // p138.p176.p177.p190.InterfaceC3442.InterfaceC3443
        /* JADX INFO: renamed from: ֏ */
        public /* synthetic */ void mo1961(boolean z) {
            C3441.m5640(this, z);
        }

        @Override // p138.p176.p177.p190.InterfaceC3442.InterfaceC3443
        /* JADX INFO: renamed from: ֏ */
        public void mo1962(boolean z, int i) {
            C4054.this.m6529();
            C4054.this.m6530();
        }

        @Override // p138.p176.p177.p190.InterfaceC3442.InterfaceC3443
        /* JADX INFO: renamed from: ؠ */
        public /* synthetic */ void mo1963() {
            C3441.m5631(this);
        }

        @Override // p138.p176.p177.p190.InterfaceC3442.InterfaceC3443
        /* JADX INFO: renamed from: ؠ */
        public void mo1964(int i) {
            C4054.this.m6531();
            C4054.this.m6528();
        }

        @Override // p138.p176.p177.p190.InterfaceC3442.InterfaceC3443
        /* JADX INFO: renamed from: ؠ */
        public void mo1965(boolean z) {
            C4054.this.m6532();
            C4054.this.m6528();
        }

        @Override // p138.p176.p177.p190.InterfaceC3442.InterfaceC3443
        /* JADX INFO: renamed from: ހ */
        public /* synthetic */ void mo1966(int i) {
            C3441.m5632(this, i);
        }

        @Override // p138.p176.p177.p190.InterfaceC3442.InterfaceC3443
        /* JADX INFO: renamed from: ހ */
        public void mo1967(boolean z) {
            C4054.this.m6530();
        }

        @Override // p138.p176.p177.p190.InterfaceC3442.InterfaceC3443
        /* JADX INFO: renamed from: ށ */
        public void mo1968(int i) {
            C4054.this.m6528();
            C4054.this.m6533();
        }
    }

    /* JADX INFO: renamed from: ދ.ހ.֏.ؠ.ྉ.ކ$ހ, reason: contains not printable characters */
    public interface InterfaceC4057 {
        /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
        void m6537(long j, long j2);
    }

    /* JADX INFO: renamed from: ދ.ހ.֏.ؠ.ྉ.ކ$ށ, reason: contains not printable characters */
    public interface InterfaceC4058 {
        /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
        void mo6538(int i);
    }

    static {
        C3430.m5578("goog.exo.ui");
    }

    public C4054(Context context, AttributeSet attributeSet, int i, AttributeSet attributeSet2) {
        super(context, attributeSet, i);
        int resourceId = C4066.exo_player_control_view;
        this.f12902 = 5000;
        this.f12903 = 15000;
        this.f12904 = 5000;
        this.f12906 = 0;
        this.f12905 = 200;
        this.f12908 = -9223372036854775807L;
        this.f12907 = false;
        if (attributeSet2 != null) {
            TypedArray typedArrayObtainStyledAttributes = context.getTheme().obtainStyledAttributes(attributeSet2, C4068.PlayerControlView, 0, 0);
            try {
                this.f12902 = typedArrayObtainStyledAttributes.getInt(C4068.PlayerControlView_rewind_increment, this.f12902);
                this.f12903 = typedArrayObtainStyledAttributes.getInt(C4068.PlayerControlView_fastforward_increment, this.f12903);
                this.f12904 = typedArrayObtainStyledAttributes.getInt(C4068.PlayerControlView_show_timeout, this.f12904);
                resourceId = typedArrayObtainStyledAttributes.getResourceId(C4068.PlayerControlView_controller_layout_id, resourceId);
                this.f12906 = typedArrayObtainStyledAttributes.getInt(C4068.PlayerControlView_repeat_toggle_modes, this.f12906);
                this.f12907 = typedArrayObtainStyledAttributes.getBoolean(C4068.PlayerControlView_show_shuffle_button, this.f12907);
                setTimeBarMinUpdateInterval(typedArrayObtainStyledAttributes.getInt(C4068.PlayerControlView_time_bar_min_update_interval, this.f12905));
            } finally {
                typedArrayObtainStyledAttributes.recycle();
            }
        }
        this.f12863 = new CopyOnWriteArrayList<>();
        this.f12878 = new AbstractC3457.C3459();
        this.f12879 = new AbstractC3457.C3460();
        this.f12876 = new StringBuilder();
        this.f12877 = new Formatter(this.f12876, Locale.getDefault());
        this.f12909 = new long[0];
        this.f12910 = new boolean[0];
        this.f12911 = new long[0];
        this.f12912 = new boolean[0];
        this.f12862 = new ViewOnClickListenerC4056(null);
        this.f12895 = new C3416();
        this.f12880 = new Runnable() { // from class: ދ.ހ.֏.ؠ.ྉ.ބ
            @Override // java.lang.Runnable
            public final void run() {
                this.f12860.m6530();
            }
        };
        this.f12881 = new Runnable() { // from class: ދ.ހ.֏.ؠ.ྉ.֏
            @Override // java.lang.Runnable
            public final void run() {
                this.f12848.m6516();
            }
        };
        LayoutInflater.from(context).inflate(resourceId, this);
        setDescendantFocusability(262144);
        InterfaceC4070 interfaceC4070 = (InterfaceC4070) findViewById(C4064.exo_progress);
        View viewFindViewById = findViewById(C4064.exo_progress_placeholder);
        if (interfaceC4070 != null) {
            this.f12875 = interfaceC4070;
        } else if (viewFindViewById != null) {
            DefaultTimeBar defaultTimeBar = new DefaultTimeBar(context, null, 0, attributeSet2);
            defaultTimeBar.setId(C4064.exo_progress);
            defaultTimeBar.setLayoutParams(viewFindViewById.getLayoutParams());
            ViewGroup viewGroup = (ViewGroup) viewFindViewById.getParent();
            int iIndexOfChild = viewGroup.indexOfChild(viewFindViewById);
            viewGroup.removeView(viewFindViewById);
            viewGroup.addView(defaultTimeBar, iIndexOfChild);
            this.f12875 = defaultTimeBar;
        } else {
            this.f12875 = null;
        }
        this.f12873 = (TextView) findViewById(C4064.exo_duration);
        this.f12874 = (TextView) findViewById(C4064.exo_position);
        InterfaceC4070 interfaceC40702 = this.f12875;
        if (interfaceC40702 != null) {
            interfaceC40702.mo1268(this.f12862);
        }
        View viewFindViewById2 = findViewById(C4064.exo_play);
        this.f12866 = viewFindViewById2;
        if (viewFindViewById2 != null) {
            viewFindViewById2.setOnClickListener(this.f12862);
        }
        View viewFindViewById3 = findViewById(C4064.exo_pause);
        this.f12867 = viewFindViewById3;
        if (viewFindViewById3 != null) {
            viewFindViewById3.setOnClickListener(this.f12862);
        }
        View viewFindViewById4 = findViewById(C4064.exo_prev);
        this.f12864 = viewFindViewById4;
        if (viewFindViewById4 != null) {
            viewFindViewById4.setOnClickListener(this.f12862);
        }
        View viewFindViewById5 = findViewById(C4064.exo_next);
        this.f12865 = viewFindViewById5;
        if (viewFindViewById5 != null) {
            viewFindViewById5.setOnClickListener(this.f12862);
        }
        View viewFindViewById6 = findViewById(C4064.exo_rew);
        this.f12869 = viewFindViewById6;
        if (viewFindViewById6 != null) {
            viewFindViewById6.setOnClickListener(this.f12862);
        }
        View viewFindViewById7 = findViewById(C4064.exo_ffwd);
        this.f12868 = viewFindViewById7;
        if (viewFindViewById7 != null) {
            viewFindViewById7.setOnClickListener(this.f12862);
        }
        ImageView imageView = (ImageView) findViewById(C4064.exo_repeat_toggle);
        this.f12870 = imageView;
        if (imageView != null) {
            imageView.setOnClickListener(this.f12862);
        }
        ImageView imageView2 = (ImageView) findViewById(C4064.exo_shuffle);
        this.f12871 = imageView2;
        if (imageView2 != null) {
            imageView2.setOnClickListener(this.f12862);
        }
        this.f12872 = findViewById(C4064.exo_vr);
        setShowVrButton(false);
        Resources resources = context.getResources();
        this.f12890 = resources.getInteger(C4065.exo_media_button_opacity_percentage_enabled) / 100.0f;
        this.f12891 = resources.getInteger(C4065.exo_media_button_opacity_percentage_disabled) / 100.0f;
        this.f12882 = resources.getDrawable(C4063.exo_controls_repeat_off);
        this.f12883 = resources.getDrawable(C4063.exo_controls_repeat_one);
        this.f12884 = resources.getDrawable(C4063.exo_controls_repeat_all);
        this.f12888 = resources.getDrawable(C4063.exo_controls_shuffle_on);
        this.f12889 = resources.getDrawable(C4063.exo_controls_shuffle_off);
        this.f12885 = resources.getString(C4067.exo_controls_repeat_off_description);
        this.f12886 = resources.getString(C4067.exo_controls_repeat_one_description);
        this.f12887 = resources.getString(C4067.exo_controls_repeat_all_description);
        this.f12892 = resources.getString(C4067.exo_controls_shuffle_on_description);
        this.f12893 = resources.getString(C4067.exo_controls_shuffle_off_description);
    }

    @Override // android.view.ViewGroup, android.view.View
    public boolean dispatchKeyEvent(KeyEvent keyEvent) {
        return m6520(keyEvent) || super.dispatchKeyEvent(keyEvent);
    }

    @Override // android.view.ViewGroup, android.view.View
    public final boolean dispatchTouchEvent(MotionEvent motionEvent) {
        if (motionEvent.getAction() == 0) {
            removeCallbacks(this.f12881);
        } else if (motionEvent.getAction() == 1) {
            m6522();
        }
        return super.dispatchTouchEvent(motionEvent);
    }

    public InterfaceC3442 getPlayer() {
        return this.f12894;
    }

    public int getRepeatToggleModes() {
        return this.f12906;
    }

    public boolean getShowShuffleButton() {
        return this.f12907;
    }

    public int getShowTimeoutMs() {
        return this.f12904;
    }

    public boolean getShowVrButton() {
        View view = this.f12872;
        return view != null && view.getVisibility() == 0;
    }

    @Override // android.view.ViewGroup, android.view.View
    public void onAttachedToWindow() {
        super.onAttachedToWindow();
        this.f12898 = true;
        long j = this.f12908;
        if (j != -9223372036854775807L) {
            long jUptimeMillis = j - SystemClock.uptimeMillis();
            if (jUptimeMillis <= 0) {
                m6516();
            } else {
                postDelayed(this.f12881, jUptimeMillis);
            }
        } else if (m6524()) {
            m6522();
        }
        m6527();
    }

    @Override // android.view.ViewGroup, android.view.View
    public void onDetachedFromWindow() {
        super.onDetachedFromWindow();
        this.f12898 = false;
        removeCallbacks(this.f12880);
        removeCallbacks(this.f12881);
    }

    public void setControlDispatcher(InterfaceC3415 interfaceC3415) {
        if (interfaceC3415 == null) {
            interfaceC3415 = new C3416();
        }
        this.f12895 = interfaceC3415;
    }

    public void setFastForwardIncrementMs(int i) {
        this.f12903 = i;
        m6528();
    }

    public void setPlaybackPreparer(InterfaceC3440 interfaceC3440) {
        this.f12897 = interfaceC3440;
    }

    public void setPlayer(InterfaceC3442 interfaceC3442) {
        boolean z = true;
        C0567.m1932(Looper.myLooper() == Looper.getMainLooper());
        if (interfaceC3442 != null && interfaceC3442.mo5507() != Looper.getMainLooper()) {
            z = false;
        }
        C0567.m1896(z);
        InterfaceC3442 interfaceC34422 = this.f12894;
        if (interfaceC34422 == interfaceC3442) {
            return;
        }
        if (interfaceC34422 != null) {
            interfaceC34422.mo5488(this.f12862);
        }
        this.f12894 = interfaceC3442;
        if (interfaceC3442 != null) {
            interfaceC3442.mo5484(this.f12862);
        }
        m6527();
    }

    public void setProgressUpdateListener(InterfaceC4057 interfaceC4057) {
        this.f12896 = interfaceC4057;
    }

    public void setRepeatToggleModes(int i) {
        this.f12906 = i;
        InterfaceC3442 interfaceC3442 = this.f12894;
        if (interfaceC3442 != null) {
            int iMo5498 = interfaceC3442.mo5498();
            if (i == 0 && iMo5498 != 0) {
                InterfaceC3415 interfaceC3415 = this.f12895;
                InterfaceC3442 interfaceC34422 = this.f12894;
                if (((C3416) interfaceC3415) == null) {
                    throw null;
                }
                interfaceC34422.mo5491(0);
            } else if (i == 1 && iMo5498 == 2) {
                InterfaceC3415 interfaceC34152 = this.f12895;
                InterfaceC3442 interfaceC34423 = this.f12894;
                if (((C3416) interfaceC34152) == null) {
                    throw null;
                }
                interfaceC34423.mo5491(1);
            } else if (i == 2 && iMo5498 == 1) {
                InterfaceC3415 interfaceC34153 = this.f12895;
                InterfaceC3442 interfaceC34424 = this.f12894;
                if (((C3416) interfaceC34153) == null) {
                    throw null;
                }
                interfaceC34424.mo5491(2);
            }
        }
        m6531();
    }

    public void setRewindIncrementMs(int i) {
        this.f12902 = i;
        m6528();
    }

    public void setShowMultiWindowTimeBar(boolean z) {
        this.f12899 = z;
        m6533();
    }

    public void setShowShuffleButton(boolean z) {
        this.f12907 = z;
        m6532();
    }

    public void setShowTimeoutMs(int i) {
        this.f12904 = i;
        if (m6524()) {
            m6522();
        }
    }

    public void setShowVrButton(boolean z) {
        View view = this.f12872;
        if (view != null) {
            view.setVisibility(z ? 0 : 8);
        }
    }

    public void setTimeBarMinUpdateInterval(int i) {
        this.f12905 = C4150.m6743(i, 16, 1000);
    }

    public void setVrButtonListener(View.OnClickListener onClickListener) {
        View view = this.f12872;
        if (view != null) {
            view.setOnClickListener(onClickListener);
        }
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public void m6516() {
        if (m6524()) {
            setVisibility(8);
            Iterator<InterfaceC4058> it = this.f12863.iterator();
            while (it.hasNext()) {
                it.next().mo6538(getVisibility());
            }
            removeCallbacks(this.f12880);
            removeCallbacks(this.f12881);
            this.f12908 = -9223372036854775807L;
        }
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public final void m6517(InterfaceC3442 interfaceC3442) {
        AbstractC3457 abstractC3457Mo5506 = interfaceC3442.mo5506();
        if (abstractC3457Mo5506.m5686() || interfaceC3442.mo5496()) {
            return;
        }
        int iMo5510 = interfaceC3442.mo5510();
        int iMo5436 = interfaceC3442.mo5436();
        if (iMo5436 != -1) {
            m6521(interfaceC3442, iMo5436, -9223372036854775807L);
        } else if (abstractC3457Mo5506.m5684(iMo5510, this.f12879).f10234) {
            m6521(interfaceC3442, iMo5510, -9223372036854775807L);
        }
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public final void m6518(InterfaceC3442 interfaceC3442, long j) {
        long jMo5512 = interfaceC3442.mo5512() + j;
        long jMo5494 = interfaceC3442.mo5494();
        if (jMo5494 != -9223372036854775807L) {
            jMo5512 = Math.min(jMo5512, jMo5494);
        }
        m6521(interfaceC3442, interfaceC3442.mo5510(), Math.max(jMo5512, 0L));
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public final void m6519(boolean z, View view) {
        if (view == null) {
            return;
        }
        view.setEnabled(z);
        view.setAlpha(z ? this.f12890 : this.f12891);
        view.setVisibility(0);
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public boolean m6520(KeyEvent keyEvent) {
        int i;
        int i2;
        int keyCode = keyEvent.getKeyCode();
        InterfaceC3442 interfaceC3442 = this.f12894;
        if (interfaceC3442 != null) {
            if (keyCode == 90 || keyCode == 89 || keyCode == 85 || keyCode == 126 || keyCode == 127 || keyCode == 87 || keyCode == 88) {
                if (keyEvent.getAction() == 0) {
                    if (keyCode == 90) {
                        if (interfaceC3442.mo5435() && (i2 = this.f12903) > 0) {
                            m6518(interfaceC3442, i2);
                        }
                    } else if (keyCode == 89) {
                        if (interfaceC3442.mo5435() && (i = this.f12902) > 0) {
                            m6518(interfaceC3442, -i);
                        }
                    } else if (keyEvent.getRepeatCount() == 0) {
                        if (keyCode == 85) {
                            InterfaceC3415 interfaceC3415 = this.f12895;
                            boolean z = !interfaceC3442.mo5500();
                            if (((C3416) interfaceC3415) == null) {
                                throw null;
                            }
                            interfaceC3442.mo5485(z);
                        } else if (keyCode == 87) {
                            m6517(interfaceC3442);
                        } else if (keyCode == 88) {
                            m6523(interfaceC3442);
                        } else if (keyCode != 126) {
                            if (keyCode == 127) {
                                if (((C3416) this.f12895) == null) {
                                    throw null;
                                }
                                interfaceC3442.mo5485(false);
                            }
                        } else {
                            if (((C3416) this.f12895) == null) {
                                throw null;
                            }
                            interfaceC3442.mo5485(true);
                        }
                    }
                }
                return true;
            }
        }
        return false;
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public final boolean m6521(InterfaceC3442 interfaceC3442, int i, long j) {
        if (((C3416) this.f12895) == null) {
            throw null;
        }
        interfaceC3442.mo5480(i, j);
        return true;
    }

    /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
    public final void m6522() {
        removeCallbacks(this.f12881);
        if (this.f12904 <= 0) {
            this.f12908 = -9223372036854775807L;
            return;
        }
        long jUptimeMillis = SystemClock.uptimeMillis();
        int i = this.f12904;
        this.f12908 = jUptimeMillis + ((long) i);
        if (this.f12898) {
            postDelayed(this.f12881, i);
        }
    }

    /* JADX WARN: Code restructure failed: missing block: B:14:0x0033, code lost:
    
        if (r2.f10233 == false) goto L15;
     */
    /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final void m6523(InterfaceC3442 interfaceC3442) {
        AbstractC3457 abstractC3457Mo5506 = interfaceC3442.mo5506();
        if (abstractC3457Mo5506.m5686() || interfaceC3442.mo5496()) {
            return;
        }
        int iMo5510 = interfaceC3442.mo5510();
        abstractC3457Mo5506.m5684(iMo5510, this.f12879);
        int iMo5433 = interfaceC3442.mo5433();
        if (iMo5433 != -1) {
            if (interfaceC3442.mo5512() > 3000) {
                AbstractC3457.C3460 c3460 = this.f12879;
                if (c3460.f10234) {
                }
            }
            m6521(interfaceC3442, iMo5433, -9223372036854775807L);
            return;
        }
        m6521(interfaceC3442, iMo5510, 0L);
    }

    /* JADX INFO: renamed from: ހ, reason: contains not printable characters */
    public boolean m6524() {
        return getVisibility() == 0;
    }

    /* JADX INFO: renamed from: ށ, reason: contains not printable characters */
    public final void m6525() {
        View view;
        View view2;
        boolean zM6526 = m6526();
        if (!zM6526 && (view2 = this.f12866) != null) {
            view2.requestFocus();
        } else {
            if (!zM6526 || (view = this.f12867) == null) {
                return;
            }
            view.requestFocus();
        }
    }

    /* JADX INFO: renamed from: ނ, reason: contains not printable characters */
    public final boolean m6526() {
        InterfaceC3442 interfaceC3442 = this.f12894;
        return (interfaceC3442 == null || interfaceC3442.mo5493() == 4 || this.f12894.mo5493() == 1 || !this.f12894.mo5500()) ? false : true;
    }

    /* JADX INFO: renamed from: ރ, reason: contains not printable characters */
    public final void m6527() {
        m6529();
        m6528();
        m6531();
        m6532();
        m6533();
    }

    /* JADX WARN: Removed duplicated region for block: B:38:0x0061  */
    /* JADX INFO: renamed from: ބ, reason: contains not printable characters */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final void m6528() {
        boolean z;
        boolean z2;
        boolean z3;
        boolean z4;
        if (m6524() && this.f12898) {
            InterfaceC3442 interfaceC3442 = this.f12894;
            if (interfaceC3442 != null) {
                AbstractC3457 abstractC3457Mo5506 = interfaceC3442.mo5506();
                if (abstractC3457Mo5506.m5686() || interfaceC3442.mo5496()) {
                    z = false;
                    z2 = false;
                    z3 = false;
                    z4 = false;
                } else {
                    abstractC3457Mo5506.m5684(interfaceC3442.mo5510(), this.f12879);
                    AbstractC3457.C3460 c3460 = this.f12879;
                    z2 = c3460.f10233;
                    boolean z5 = z2 || !c3460.f10234 || interfaceC3442.hasPrevious();
                    z3 = z2 && this.f12902 > 0;
                    z4 = z2 && this.f12903 > 0;
                    z = this.f12879.f10234 || interfaceC3442.hasNext();
                    z = z5;
                }
            }
            m6519(z, this.f12864);
            m6519(z3, this.f12869);
            m6519(z4, this.f12868);
            m6519(z, this.f12865);
            InterfaceC4070 interfaceC4070 = this.f12875;
            if (interfaceC4070 != null) {
                interfaceC4070.setEnabled(z2);
            }
        }
    }

    /* JADX INFO: renamed from: ޅ, reason: contains not printable characters */
    public final void m6529() {
        boolean z;
        if (m6524() && this.f12898) {
            boolean zM6526 = m6526();
            View view = this.f12866;
            if (view != null) {
                z = (zM6526 && view.isFocused()) | false;
                this.f12866.setVisibility(zM6526 ? 8 : 0);
            } else {
                z = false;
            }
            View view2 = this.f12867;
            if (view2 != null) {
                z |= !zM6526 && view2.isFocused();
                this.f12867.setVisibility(zM6526 ? 0 : 8);
            }
            if (z) {
                m6525();
            }
        }
    }

    /* JADX INFO: renamed from: ކ, reason: contains not printable characters */
    public final void m6530() {
        long jMo5509;
        if (m6524() && this.f12898) {
            InterfaceC3442 interfaceC3442 = this.f12894;
            long jMo5497 = 0;
            if (interfaceC3442 != null) {
                jMo5497 = this.f12913 + interfaceC3442.mo5497();
                jMo5509 = this.f12913 + interfaceC3442.mo5509();
            } else {
                jMo5509 = 0;
            }
            TextView textView = this.f12874;
            if (textView != null && !this.f12901) {
                textView.setText(C4150.m6759(this.f12876, this.f12877, jMo5497));
            }
            InterfaceC4070 interfaceC4070 = this.f12875;
            if (interfaceC4070 != null) {
                interfaceC4070.setPosition(jMo5497);
                this.f12875.setBufferedPosition(jMo5509);
            }
            InterfaceC4057 interfaceC4057 = this.f12896;
            if (interfaceC4057 != null) {
                interfaceC4057.m6537(jMo5497, jMo5509);
            }
            removeCallbacks(this.f12880);
            int iMo5493 = interfaceC3442 == null ? 1 : interfaceC3442.mo5493();
            if (interfaceC3442 == null || !interfaceC3442.mo5434()) {
                if (iMo5493 == 4 || iMo5493 == 1) {
                    return;
                }
                postDelayed(this.f12880, 1000L);
                return;
            }
            InterfaceC4070 interfaceC40702 = this.f12875;
            long jMin = Math.min(interfaceC40702 != null ? interfaceC40702.getPreferredUpdateDelay() : 1000L, 1000 - (jMo5497 % 1000));
            float f = interfaceC3442.mo5490().f10163;
            postDelayed(this.f12880, C4150.m6789(f > 0.0f ? (long) (jMin / f) : 1000L, this.f12905, 1000L));
        }
    }

    /* JADX INFO: renamed from: އ, reason: contains not printable characters */
    public final void m6531() {
        ImageView imageView;
        if (m6524() && this.f12898 && (imageView = this.f12870) != null) {
            if (this.f12906 == 0) {
                imageView.setVisibility(8);
                return;
            }
            InterfaceC3442 interfaceC3442 = this.f12894;
            if (interfaceC3442 == null) {
                m6519(false, (View) imageView);
                this.f12870.setImageDrawable(this.f12882);
                this.f12870.setContentDescription(this.f12885);
                return;
            }
            m6519(true, (View) imageView);
            int iMo5498 = interfaceC3442.mo5498();
            if (iMo5498 == 0) {
                this.f12870.setImageDrawable(this.f12882);
                this.f12870.setContentDescription(this.f12885);
            } else if (iMo5498 == 1) {
                this.f12870.setImageDrawable(this.f12883);
                this.f12870.setContentDescription(this.f12886);
            } else if (iMo5498 == 2) {
                this.f12870.setImageDrawable(this.f12884);
                this.f12870.setContentDescription(this.f12887);
            }
            this.f12870.setVisibility(0);
        }
    }

    /* JADX INFO: renamed from: ވ, reason: contains not printable characters */
    public final void m6532() {
        ImageView imageView;
        if (m6524() && this.f12898 && (imageView = this.f12871) != null) {
            InterfaceC3442 interfaceC3442 = this.f12894;
            if (!this.f12907) {
                imageView.setVisibility(8);
                return;
            }
            if (interfaceC3442 == null) {
                m6519(false, (View) imageView);
                this.f12871.setImageDrawable(this.f12889);
                this.f12871.setContentDescription(this.f12893);
            } else {
                m6519(true, (View) imageView);
                this.f12871.setImageDrawable(interfaceC3442.mo5508() ? this.f12888 : this.f12889);
                this.f12871.setContentDescription(interfaceC3442.mo5508() ? this.f12892 : this.f12893);
            }
        }
    }

    /* JADX WARN: Removed duplicated region for block: B:18:0x0039  */
    /* JADX WARN: Removed duplicated region for block: B:19:0x003b  */
    /* JADX WARN: Removed duplicated region for block: B:50:0x00bc  */
    /* JADX WARN: Removed duplicated region for block: B:58:0x00f7  */
    /* JADX INFO: renamed from: މ, reason: contains not printable characters */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final void m6533() {
        boolean z;
        int i;
        AbstractC3457.C3460 c3460;
        long j;
        boolean z2;
        InterfaceC3442 interfaceC3442 = this.f12894;
        if (interfaceC3442 == null) {
            return;
        }
        long j2 = -9223372036854775807L;
        boolean z3 = true;
        if (this.f12899) {
            AbstractC3457 abstractC3457Mo5506 = interfaceC3442.mo5506();
            AbstractC3457.C3460 c34602 = this.f12879;
            if (abstractC3457Mo5506.mo1228() > 100) {
                z2 = false;
                z = !z2;
            } else {
                int iMo1228 = abstractC3457Mo5506.mo1228();
                for (int i2 = 0; i2 < iMo1228; i2++) {
                    if (abstractC3457Mo5506.m5684(i2, c34602).f10238 == -9223372036854775807L) {
                        z2 = false;
                        break;
                    }
                }
                z2 = true;
                if (!z2) {
                }
            }
        }
        this.f12900 = z;
        long j3 = 0;
        this.f12913 = 0L;
        AbstractC3457 abstractC3457Mo55062 = interfaceC3442.mo5506();
        if (abstractC3457Mo55062.m5686()) {
            i = 0;
        } else {
            int iMo5510 = interfaceC3442.mo5510();
            int i3 = this.f12900 ? 0 : iMo5510;
            int iMo12282 = this.f12900 ? abstractC3457Mo55062.mo1228() - 1 : iMo5510;
            long j4 = 0;
            i = 0;
            while (true) {
                if (i3 > iMo12282) {
                    break;
                }
                if (i3 == iMo5510) {
                    this.f12913 = C3414.m5459(j4);
                }
                abstractC3457Mo55062.m5684(i3, this.f12879);
                AbstractC3457.C3460 c34603 = this.f12879;
                if (c34603.f10238 == j2) {
                    C0567.m1932(this.f12900 ^ z3);
                    break;
                }
                int i4 = c34603.f10235;
                while (true) {
                    c3460 = this.f12879;
                    if (i4 <= c3460.f10236) {
                        abstractC3457Mo55062.m5682(i4, this.f12878);
                        int i5 = this.f12878.f10228.f11789;
                        int i6 = 0;
                        while (i6 < i5) {
                            long jM5688 = this.f12878.m5688(i6);
                            if (jM5688 == Long.MIN_VALUE) {
                                long j5 = this.f12878.f10226;
                                if (j5 != j2) {
                                    jM5688 = j5;
                                    j = jM5688 + this.f12878.f10227;
                                    if (j < 0) {
                                        long[] jArr = this.f12909;
                                        if (i == jArr.length) {
                                            int length = jArr.length == 0 ? 1 : jArr.length * 2;
                                            this.f12909 = Arrays.copyOf(this.f12909, length);
                                            this.f12910 = Arrays.copyOf(this.f12910, length);
                                        }
                                        this.f12909[i] = C3414.m5459(j + j4);
                                        this.f12910[i] = !this.f12878.f10228.f11791[i6].m6211();
                                        i++;
                                    }
                                }
                            } else {
                                j = jM5688 + this.f12878.f10227;
                                if (j < 0) {
                                }
                            }
                            i6++;
                            j2 = -9223372036854775807L;
                        }
                        i4++;
                        j2 = -9223372036854775807L;
                    }
                }
                j4 += c3460.f10238;
                i3++;
                j2 = -9223372036854775807L;
                z3 = true;
            }
            j3 = j4;
        }
        long jM5459 = C3414.m5459(j3);
        TextView textView = this.f12873;
        if (textView != null) {
            textView.setText(C4150.m6759(this.f12876, this.f12877, jM5459));
        }
        InterfaceC4070 interfaceC4070 = this.f12875;
        if (interfaceC4070 != null) {
            interfaceC4070.setDuration(jM5459);
            int length2 = this.f12911.length;
            int i7 = i + length2;
            long[] jArr2 = this.f12909;
            if (i7 > jArr2.length) {
                this.f12909 = Arrays.copyOf(jArr2, i7);
                this.f12910 = Arrays.copyOf(this.f12910, i7);
            }
            System.arraycopy(this.f12911, 0, this.f12909, i, length2);
            System.arraycopy(this.f12912, 0, this.f12910, i, length2);
            this.f12875.mo1270(this.f12909, this.f12910, i7);
        }
        m6530();
    }
}
