package p000.p001.p002.p003.p004;

import android.graphics.drawable.Drawable;
import android.os.Bundle;
import androidx.preference.Preference;
import androidx.preference.PreferenceScreen;
import ar.tvplayer.core.data.prefs.ރ;
import ar.tvplayer.core.domain.ލ;
import ar.tvplayer.core.domain.ޏ;
import ar.tvplayer.core.domain.ޑ;
import ar.tvplayer.core.util.CommonUtilsKt;
import ar.tvplayer.tv.player.ui.SleepTimerWorker;
import java.util.concurrent.TimeUnit;
import p000.p001.p002.p003.C0663;
import p000.p001.p021.C1255;
import p000.p001.p021.p022.C1219;
import p037.p089.p090.ActivityC1999;
import p037.p091.p093.AbstractC2098;
import p037.p123.C2565;
import p037.p123.EnumC2556;
import p037.p123.p124.C2604;
import p402.C6549;
import p402.p411.p413.C6635;

/* JADX INFO: renamed from: ނ.֏.֏.֏.֏.ၹ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes.dex */
public final class C0657 extends AbstractC2098 {

    /* JADX INFO: renamed from: ލ, reason: contains not printable characters */
    public String f3099;

    @Override // p037.p106.AbstractC2273, androidx.fragment.app.Fragment
    public /* synthetic */ void onDestroyView() {
        super.onDestroyView();
    }

    @Override // p037.p106.AbstractC2273
    /* JADX INFO: renamed from: ֏ */
    public void mo1836(Bundle bundle, String str) {
        String string;
        PreferenceScreen preferenceScreenM4334 = this.f7243.m4334(getContext());
        preferenceScreenM4334.m389((CharSequence) getString(C0663.player_sleep_timer));
        m4320(preferenceScreenM4334);
        char c = 0;
        Drawable drawable = ލ.֏(this, false, 1);
        Drawable drawable2 = ލ.ޅ(this);
        Integer[] numArr = {0, 15, 30, 45, 60, 90, 120};
        int i = 0;
        while (i < 7) {
            int iIntValue = numArr[i].intValue();
            String strValueOf = String.valueOf(iIntValue);
            if (iIntValue == 0) {
                string = getString(C0663.off);
            } else {
                int i2 = C0663.player_sleep_timer_min;
                Object[] objArr = new Object[1];
                objArr[c] = Integer.valueOf(iIntValue);
                string = getString(i2, objArr);
            }
            String str2 = string;
            C6635.m9823((Object) str2, "if (it == 0) getString(R…ayer_sleep_timer_min, it)");
            ރ r1 = ރ.ߠ;
            if (r1 == null) {
                throw null;
            }
            boolean z = iIntValue == ((Number) ރ.т.m9835(r1, ރ.ށ[192])).intValue();
            int i3 = i;
            ލ.֏(this, strValueOf, str2, (CharSequence) null, z ? drawable2 : drawable, false, false, 0, 116);
            if (z) {
                this.f3099 = strValueOf;
                m4319(strValueOf);
            }
            i = i3 + 1;
            c = 0;
        }
    }

    /* JADX WARN: Removed duplicated region for block: B:27:0x004d  */
    @Override // p037.p106.AbstractC2273, p037.p106.C2287.InterfaceC2290
    /* JADX INFO: renamed from: ؠ */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public boolean mo1837(Preference preference) {
        boolean z;
        if (preference == null) {
            C6635.m9824("pref");
            throw null;
        }
        if (super.mo1837(preference)) {
            return true;
        }
        if (!(ޏ.ވ.ހ().length() > 0)) {
            if (CommonUtilsKt.ރ()) {
                ޏ r1 = ޏ.ވ;
                if (r1 == null) {
                    throw null;
                }
                boolean z2 = ((Number) ޏ.ބ.m9835(r1, ޏ.ށ[2])).intValue() == 2;
                boolean z3 = ޑ.֏;
                boolean z4 = C1255.f4369;
                boolean z5 = ލ.ؠ;
                if (z2 && z3 && (!z4 || z5)) {
                    z = true;
                }
            }
            z = false;
        }
        if (!z) {
            ލ.ތ(this);
            return true;
        }
        if (!C6635.m9825((Object) preference.f1018, (Object) this.f3099)) {
            String str = preference.f1018;
            C6635.m9823((Object) str, "pref.key");
            int i = Integer.parseInt(str);
            if (i != 0) {
                ރ r3 = ރ.ߠ;
                long jCurrentTimeMillis = System.currentTimeMillis();
                if (r3 == null) {
                    throw null;
                }
                long jLongValue = Long.valueOf(jCurrentTimeMillis).longValue();
                ރ r32 = ރ.ߠ;
                if (r32 == null) {
                    throw null;
                }
                ރ.Г.m9836(r32, ރ.ށ[191], Long.valueOf(jLongValue));
                C6549 c6549 = C6549.f19328;
                if (ރ.ߠ == null) {
                    throw null;
                }
                int iIntValue = Integer.valueOf(i).intValue();
                ރ r5 = ރ.ߠ;
                if (r5 == null) {
                    throw null;
                }
                ރ.т.m9836(r5, ރ.ށ[192], Integer.valueOf(iIntValue));
                C6549 c65492 = C6549.f19328;
                C2565.C2566 c2566 = new C2565.C2566(SleepTimerWorker.class);
                c2566.f8093.f8326 = TimeUnit.MINUTES.toMillis(i);
                if (Long.MAX_VALUE - System.currentTimeMillis() <= c2566.f8093.f8326) {
                    throw new IllegalArgumentException("The given initial delay is too large and will cause an overflow!");
                }
                C2565 c2565M4635 = c2566.m4635();
                C6635.m9823((Object) c2565M4635, "OneTimeWorkRequestBuilde…MINUTES)\n        .build()");
                C2604.m4662(C1255.m2551()).m4633("sleep_timer_work", EnumC2556.REPLACE, c2565M4635);
                C1219.m2512(getContext(), C0663.player_sleep_timer_on);
            } else {
                if (ރ.ߠ == null) {
                    throw null;
                }
                Long l = 0L;
                long jLongValue2 = l.longValue();
                ރ r11 = ރ.ߠ;
                if (r11 == null) {
                    throw null;
                }
                ރ.Г.m9836(r11, ރ.ށ[191], Long.valueOf(jLongValue2));
                C6549 c65493 = C6549.f19328;
                if (ރ.ߠ == null) {
                    throw null;
                }
                Integer num = 0;
                int iIntValue2 = num.intValue();
                ރ r33 = ރ.ߠ;
                if (r33 == null) {
                    throw null;
                }
                ރ.т.m9836(r33, ރ.ށ[192], Integer.valueOf(iIntValue2));
                C6549 c65494 = C6549.f19328;
                C2604.m4662(C1255.m2551()).mo4632("sleep_timer_work");
                C1219.m2512(getContext(), C0663.player_sleep_timer_off);
            }
        }
        ActivityC1999 activity = getActivity();
        if (activity != null) {
            activity.finishAfterTransition();
        }
        return true;
    }
}
