package ඓ.㸾.K;

import android.app.Activity;
import android.app.DialogFragment;
import android.content.res.Configuration;
import android.os.Build;
import android.util.TypedValue;
import android.view.DisplayCutout;
import androidx.fragment.app.Fragment;
import com.gyf.immersionbar.BarHide;
import ῲ.Ԕ.K.DialogInterface$OnCancelListenerC1529;
import ῲ.ᨨ.㳳.C1841;

/* renamed from: ඓ.㸾.K.㳳  reason: contains not printable characters */
/* compiled from: ImmersionDelegate */
public class RunnableC1384 implements Runnable {

    /* renamed from: ʬ  reason: contains not printable characters */
    public C1365 f5290;

    /* renamed from: ῲ  reason: contains not printable characters */
    public C1387 f5291;

    /* renamed from: 㸾  reason: contains not printable characters */
    public int f5292;

    public RunnableC1384(Object obj) {
        if (obj instanceof Activity) {
            if (this.f5291 == null) {
                this.f5291 = new C1387((Activity) obj);
            }
        } else if (obj instanceof Fragment) {
            if (this.f5291 != null) {
                return;
            }
            if (obj instanceof DialogInterface$OnCancelListenerC1529) {
                this.f5291 = new C1387((DialogInterface$OnCancelListenerC1529) obj);
            } else {
                this.f5291 = new C1387((Fragment) obj);
            }
        } else if ((obj instanceof android.app.Fragment) && this.f5291 == null) {
            if (obj instanceof DialogFragment) {
                this.f5291 = new C1387((DialogFragment) obj);
            } else {
                this.f5291 = new C1387((android.app.Fragment) obj);
            }
        }
    }

    /* JADX WARNING: Removed duplicated region for block: B:44:0x00c8  */
    /* JADX WARNING: Removed duplicated region for block: B:52:0x00f1  */
    /* JADX WARNING: Removed duplicated region for block: B:55:0x0105  */
    /* JADX WARNING: Removed duplicated region for block: B:60:0x0110  */
    /* JADX WARNING: Removed duplicated region for block: B:62:0x0116  */
    public void run() {
        Activity activity;
        boolean z;
        int i;
        int identifier;
        boolean z2;
        C1387 r0 = this.f5291;
        if (r0 != null && (activity = r0.f5317) != null) {
            C1380 k = new C1380(activity);
            this.f5290.m3553(k.f5285);
            this.f5290.m3557(k.f5281);
            this.f5290.m3554(k.f5287);
            this.f5290.m3552(k.f5282);
            this.f5290.m3556(k.f5283);
            boolean z3 = false;
            if (!C1841.m4811(activity) && !C1841.m4761(activity)) {
                try {
                    z2 = activity.getPackageManager().hasSystemFeature("com.oppo.feature.screen.heteromorphism");
                } catch (Exception unused) {
                    z2 = false;
                }
                if (!z2 && !C1841.m4743(activity)) {
                    if (!(C1841.m4780(activity) != null)) {
                        z = false;
                        this.f5290.m3555(z);
                        if (z && this.f5292 == 0) {
                            int r1 = C1387.m3584(activity);
                            DisplayCutout r5 = C1841.m4780(activity);
                            if (Build.VERSION.SDK_INT >= 28 || r5 == null) {
                                int dimensionPixelSize = (C1841.m4811(activity) || (identifier = activity.getResources().getIdentifier("notch_height", "dimen", "android")) <= 0) ? 0 : activity.getResources().getDimensionPixelSize(identifier);
                                if (C1841.m4761(activity)) {
                                    int[] iArr = {0, 0};
                                    try {
                                        Class<?> loadClass = activity.getClassLoader().loadClass("com.huawei.android.util.HwNotchSizeUtil");
                                        iArr = (int[]) loadClass.getMethod("getNotchSize", new Class[0]).invoke(loadClass, new Object[0]);
                                    } catch (ClassNotFoundException | Exception | NoSuchMethodException unused2) {
                                    }
                                    dimensionPixelSize = iArr[1];
                                }
                                if (!C1841.m4743(activity)) {
                                    i = (int) TypedValue.applyDimension(1, (float) 32, activity.getResources().getDisplayMetrics());
                                    if (i < r1) {
                                        i = r1;
                                    }
                                } else {
                                    i = dimensionPixelSize;
                                }
                                z3 = activity.getPackageManager().hasSystemFeature("com.oppo.feature.screen.heteromorphism");
                                if (z3) {
                                    r1 = i;
                                } else if (80 >= r1) {
                                    r1 = 80;
                                }
                            } else {
                                r1 = activity.getResources().getConfiguration().orientation != 1 ? r5.getSafeInsetLeft() == 0 ? r5.getSafeInsetRight() : r5.getSafeInsetLeft() : r5.getSafeInsetTop();
                            }
                            this.f5292 = r1;
                            this.f5290.m3558(this.f5292);
                        }
                        throw null;
                    }
                }
            }
            z = true;
            this.f5290.m3555(z);
            int r12 = C1387.m3584(activity);
            DisplayCutout r52 = C1841.m4780(activity);
            if (Build.VERSION.SDK_INT >= 28) {
            }
            if (C1841.m4811(activity)) {
            }
            if (C1841.m4761(activity)) {
            }
            if (!C1841.m4743(activity)) {
            }
            try {
                z3 = activity.getPackageManager().hasSystemFeature("com.oppo.feature.screen.heteromorphism");
            } catch (Exception unused3) {
            }
            if (z3) {
            }
            this.f5292 = r12;
            this.f5290.m3558(this.f5292);
            throw null;
        }
    }

    /* renamed from: ʬ  reason: contains not printable characters */
    public void m3575() {
        C1387 r0 = this.f5291;
        if (r0 != null && !r0.f5323 && r0.f5329 && r0.f5330 != null) {
            if (C1841.m4805() && r0.f5330.f5252) {
                r0.m3586();
            } else if (r0.f5330.f5255 != BarHide.FLAG_SHOW_BAR) {
                r0.m3596();
            }
        }
    }

    /* renamed from: ῲ  reason: contains not printable characters */
    public void m3576() {
        C1387 r2;
        this.f5290 = null;
        C1387 r1 = this.f5291;
        if (r1 != null) {
            if (r1.f5317 != null) {
                ViewTreeObserver$OnGlobalLayoutListenerC1385 r22 = r1.f5322;
                if (r22 != null) {
                    r22.m3581();
                    r1.f5322 = null;
                }
                C1370.m3561().m3562(r1);
                C1374.m3569().removeOnNavigationBarListener(r1.f5330.f5246);
            }
            if (r1.f5320 && (r2 = r1.f5316) != null) {
                C1378 r3 = r2.f5330;
                r3.f5256 = r2.f5326;
                if (r3.f5255 != BarHide.FLAG_SHOW_BAR) {
                    r2.m3596();
                }
            }
            r1.f5329 = false;
            this.f5291 = null;
        }
    }

    /* renamed from: K  reason: contains not printable characters */
    public C1387 m3578() {
        return this.f5291;
    }

    /* renamed from: K  reason: contains not printable characters */
    public void m3579(Configuration configuration) {
        C1387 r2 = this.f5291;
        if (r2 != null && r2.f5329) {
            int i = Build.VERSION.SDK_INT;
            AbstractC1381 r22 = r2.f5330.f5250;
        }
    }

    /* renamed from: ῲ  reason: contains not printable characters */
    public void m3577(Configuration configuration) {
        C1387 r2 = this.f5291;
        if (r2 != null) {
            r2.m3597();
            C1387 r22 = this.f5291;
            if (r22 != null && r22.f5329) {
                int i = Build.VERSION.SDK_INT;
                AbstractC1381 r23 = r22.f5330.f5250;
            }
        }
    }
}
