APK反编译源代码展示 - 南明离火平台提供

应用版本信息
应用名称:Соседи
版本号:3.1.3
包名称:by.imlab.sosedi.kupilka

MD5 校验值:52ffe34fa08a87a6cc4bc36d7eb3dad1

反编译源代码说明

j.java 文件包含反编译后的源代码,请注意,该内容仅供学习和参考使用,不得用于非法用途。


package g;

import android.R;
import android.app.Activity;
import android.app.Dialog;
import android.app.UiModeManager;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
import android.content.ContextWrapper;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.ActivityInfo;
import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.location.Location;
import android.location.LocationManager;
import android.media.AudioManager;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.LocaleList;
import android.os.PowerManager;
import android.text.TextUtils;
import android.util.AndroidRuntimeException;
import android.util.AttributeSet;
import android.util.Log;
import android.util.TypedValue;
import android.view.ActionMode;
import android.view.ContextThemeWrapper;
import android.view.KeyCharacterMap;
import android.view.KeyEvent;
import android.view.KeyboardShortcutGroup;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewConfiguration;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.view.Window;
import android.view.WindowManager;
import android.widget.FrameLayout;
import android.widget.ListAdapter;
import android.widget.PopupWindow;
import android.widget.TextView;
import androidx.appcompat.view.menu.ExpandedMenuView;
import androidx.appcompat.view.menu.d;
import androidx.appcompat.view.menu.f;
import androidx.appcompat.view.menu.j;
import androidx.appcompat.widget.ActionBarContextView;
import androidx.appcompat.widget.AppCompatImageView;
import androidx.appcompat.widget.AppCompatSpinner;
import androidx.appcompat.widget.ContentFrameLayout;
import androidx.appcompat.widget.ViewStubCompat;
import androidx.lifecycle.l;
import bm.g0;
import by.imlab.sosedi.kupilka.C0909R;
import com.huawei.hms.adapter.internal.CommonCode;
import com.huawei.hms.android.HwBuildEx;
import g.p;
import g.s;
import g.t;
import i4.e;
import i4.h0;
import i4.i2;
import i4.j0;
import i4.k0;
import java.lang.ref.WeakReference;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Calendar;
import java.util.List;
import java.util.Map;
import java.util.WeakHashMap;
import k.a;
import k.e;
import m.a2;
import m.e0;
import m.f0;
import m.i0;
import m.i1;
import m.o0;
import m.s0;
import m.t0;
import m.u0;
import m.z1;

public final class j extends g.i implements f.a, LayoutInflater.Factory2 {

    public static final r0.f<String, Integer> f15096u0 = new r0.f<>();

    public static final int[] f15097v0 = {R.attr.windowBackground};

    public static final boolean f15098w0 = !"robolectric".equals(Build.FINGERPRINT);

    public static final boolean f15099x0 = true;
    public boolean A;
    public boolean B;
    public boolean X;
    public boolean Y;
    public boolean Z;

    public k[] f15100a0;

    public k f15101b0;

    public final Object f15102c;

    public boolean f15103c0;

    public final Context f15104d;

    public boolean f15105d0;

    public Window f15106e;

    public boolean f15107e0;

    public f f15108f;

    public boolean f15109f0;

    public final g.h f15110g;

    public Configuration f15111g0;

    public t f15112h;

    public int f15113h0;

    public k.f f15114i;

    public int f15115i0;

    public CharSequence f15116j;

    public boolean f15117j0;

    public t0 f15118k;

    public boolean f15119k0;

    public b f15120l;

    public i f15121l0;

    public l f15122m;

    public g f15123m0;

    public k.a f15124n;

    public boolean f15125n0;

    public ActionBarContextView f15126o;

    public int f15127o0;

    public PopupWindow f15128p;
    public m q;

    public boolean f15129q0;

    public Rect f15131r0;

    public Rect f15133s0;

    public boolean f15134t;

    public p f15135t0;

    public ViewGroup f15136u;

    public TextView f15137v;

    public View f15138w;

    public boolean f15139x;

    public boolean f15140y;

    public boolean f15141z;

    public i2 f15130r = null;

    public boolean f15132s = true;
    public final a p0 = new a();

    public class a implements Runnable {
        public a() {
        }

        @Override
        public final void run() {
            j jVar = j.this;
            if ((jVar.f15127o0 & 1) != 0) {
                jVar.D(0);
            }
            j jVar2 = j.this;
            if ((jVar2.f15127o0 & 4096) != 0) {
                jVar2.D(108);
            }
            j jVar3 = j.this;
            jVar3.f15125n0 = false;
            jVar3.f15127o0 = 0;
        }
    }

    public final class b implements j.a {
        public b() {
        }

        @Override
        public final void b(androidx.appcompat.view.menu.f fVar, boolean z10) {
            j.this.z(fVar);
        }

        @Override
        public final boolean c(androidx.appcompat.view.menu.f fVar) {
            Window.Callback I = j.this.I();
            if (I != null) {
                I.onMenuOpened(108, fVar);
                return true;
            }
            return true;
        }
    }

    public class c implements a.InterfaceC0383a {

        public a.InterfaceC0383a f15144a;

        public class a extends g3.i {
            public a() {
            }

            @Override
            public final void e() {
                j.this.f15126o.setVisibility(8);
                j jVar = j.this;
                PopupWindow popupWindow = jVar.f15128p;
                if (popupWindow != null) {
                    popupWindow.dismiss();
                } else if (jVar.f15126o.getParent() instanceof View) {
                    View view = (View) j.this.f15126o.getParent();
                    WeakHashMap<View, i2> weakHashMap = k0.f17830a;
                    k0.g.c(view);
                }
                j.this.f15126o.h();
                j.this.f15130r.d(null);
                j jVar2 = j.this;
                jVar2.f15130r = null;
                ViewGroup viewGroup = jVar2.f15136u;
                WeakHashMap<View, i2> weakHashMap2 = k0.f17830a;
                k0.g.c(viewGroup);
            }
        }

        public c(e.a aVar) {
            this.f15144a = aVar;
        }

        @Override
        public final boolean a(k.a aVar, MenuItem menuItem) {
            return this.f15144a.a(aVar, menuItem);
        }

        @Override
        public final boolean b(k.a aVar, androidx.appcompat.view.menu.f fVar) {
            ViewGroup viewGroup = j.this.f15136u;
            WeakHashMap<View, i2> weakHashMap = k0.f17830a;
            k0.g.c(viewGroup);
            return this.f15144a.b(aVar, fVar);
        }

        @Override
        public final boolean c(k.a aVar, androidx.appcompat.view.menu.f fVar) {
            return this.f15144a.c(aVar, fVar);
        }

        @Override
        public final void d(k.a aVar) {
            this.f15144a.d(aVar);
            j jVar = j.this;
            if (jVar.f15128p != null) {
                jVar.f15106e.getDecorView().removeCallbacks(j.this.q);
            }
            j jVar2 = j.this;
            if (jVar2.f15126o != null) {
                i2 i2Var = jVar2.f15130r;
                if (i2Var != null) {
                    i2Var.b();
                }
                j jVar3 = j.this;
                i2 a8 = k0.a(jVar3.f15126o);
                a8.a(0.0f);
                jVar3.f15130r = a8;
                j.this.f15130r.d(new a());
            }
            g.h hVar = j.this.f15110g;
            if (hVar != null) {
                hVar.t();
            }
            j jVar4 = j.this;
            jVar4.f15124n = null;
            ViewGroup viewGroup = jVar4.f15136u;
            WeakHashMap<View, i2> weakHashMap = k0.f17830a;
            k0.g.c(viewGroup);
        }
    }

    public static class d {
        public static void a(Configuration configuration, Configuration configuration2, Configuration configuration3) {
            LocaleList locales = configuration.getLocales();
            LocaleList locales2 = configuration2.getLocales();
            if (!locales.equals(locales2)) {
                configuration3.setLocales(locales2);
                configuration3.locale = configuration2.locale;
            }
        }
    }

    public static class e {
        public static void a(Configuration configuration, Configuration configuration2, Configuration configuration3) {
            int i10 = configuration.colorMode & 3;
            int i11 = configuration2.colorMode & 3;
            if (i10 != i11) {
                configuration3.colorMode |= i11;
            }
            int i12 = configuration.colorMode & 12;
            int i13 = configuration2.colorMode & 12;
            if (i12 != i13) {
                configuration3.colorMode |= i13;
            }
        }
    }

    public class g extends h {

        public final PowerManager f15148c;

        public g(Context context) {
            super();
            this.f15148c = (PowerManager) context.getApplicationContext().getSystemService("power");
        }

        @Override
        public final IntentFilter b() {
            IntentFilter intentFilter = new IntentFilter();
            intentFilter.addAction("android.os.action.POWER_SAVE_MODE_CHANGED");
            return intentFilter;
        }

        @Override
        public final int c() {
            if (this.f15148c.isPowerSaveMode()) {
                return 2;
            }
            return 1;
        }

        @Override
        public final void d() {
            j.this.w(true);
        }
    }

    public abstract class h {

        public a f15150a;

        public class a extends BroadcastReceiver {
            public a() {
            }

            @Override
            public final void onReceive(Context context, Intent intent) {
                h.this.d();
            }
        }

        public h() {
        }

        public final void a() {
            a aVar = this.f15150a;
            if (aVar != null) {
                try {
                    j.this.f15104d.unregisterReceiver(aVar);
                } catch (IllegalArgumentException unused) {
                }
                this.f15150a = null;
            }
        }

        public abstract IntentFilter b();

        public abstract int c();

        public abstract void d();

        public final void e() {
            a();
            IntentFilter b10 = b();
            if (b10 != null && b10.countActions() != 0) {
                if (this.f15150a == null) {
                    this.f15150a = new a();
                }
                j.this.f15104d.registerReceiver(this.f15150a, b10);
            }
        }
    }

    public class i extends h {

        public final s f15153c;

        public i(s sVar) {
            super();
            this.f15153c = sVar;
        }

        @Override
        public final IntentFilter b() {
            IntentFilter intentFilter = new IntentFilter();
            intentFilter.addAction("android.intent.action.TIME_SET");
            intentFilter.addAction("android.intent.action.TIMEZONE_CHANGED");
            intentFilter.addAction("android.intent.action.TIME_TICK");
            return intentFilter;
        }

        @Override
        public final int c() {
            boolean z10;
            Location location;
            boolean z11;
            long j10;
            long j11;
            Location location2;
            s sVar = this.f15153c;
            s.a aVar = sVar.f15208c;
            boolean z12 = false;
            if (aVar.f15210b > System.currentTimeMillis()) {
                z10 = true;
            } else {
                z10 = false;
            }
            if (z10) {
                z11 = aVar.f15209a;
            } else {
                Location location3 = null;
                if (g0.j(sVar.f15206a, "android.permission.ACCESS_COARSE_LOCATION") == 0) {
                    try {
                    } catch (Exception e10) {
                        Log.d("TwilightManager", "Failed to get last known location", e10);
                    }
                    if (sVar.f15207b.isProviderEnabled("network")) {
                        location2 = sVar.f15207b.getLastKnownLocation("network");
                        location = location2;
                    }
                    location2 = null;
                    location = location2;
                } else {
                    location = null;
                }
                if (g0.j(sVar.f15206a, "android.permission.ACCESS_FINE_LOCATION") == 0) {
                    try {
                        if (sVar.f15207b.isProviderEnabled("gps")) {
                            location3 = sVar.f15207b.getLastKnownLocation("gps");
                        }
                    } catch (Exception e11) {
                        Log.d("TwilightManager", "Failed to get last known location", e11);
                    }
                }
                if (location3 == null || location == null ? location3 != null : location3.getTime() > location.getTime()) {
                    location = location3;
                }
                if (location != null) {
                    s.a aVar2 = sVar.f15208c;
                    long currentTimeMillis = System.currentTimeMillis();
                    if (r.f15201d == null) {
                        r.f15201d = new r();
                    }
                    r rVar = r.f15201d;
                    rVar.a(currentTimeMillis - 86400000, location.getLatitude(), location.getLongitude());
                    rVar.a(currentTimeMillis, location.getLatitude(), location.getLongitude());
                    if (rVar.f15204c == 1) {
                        z12 = true;
                    }
                    long j12 = rVar.f15203b;
                    long j13 = rVar.f15202a;
                    rVar.a(currentTimeMillis + 86400000, location.getLatitude(), location.getLongitude());
                    long j14 = rVar.f15203b;
                    if (j12 != -1 && j13 != -1) {
                        if (currentTimeMillis > j13) {
                            j11 = j14 + 0;
                        } else if (currentTimeMillis > j12) {
                            j11 = j13 + 0;
                        } else {
                            j11 = j12 + 0;
                        }
                        j10 = j11 + 60000;
                    } else {
                        j10 = 43200000 + currentTimeMillis;
                    }
                    aVar2.f15209a = z12;
                    aVar2.f15210b = j10;
                    z11 = aVar.f15209a;
                } else {
                    Log.i("TwilightManager", "Could not get last known location. This is probably because the app does not have any location permissions. Falling back to hardcoded sunrise/sunset values.");
                    int i10 = Calendar.getInstance().get(11);
                    if (i10 < 6 || i10 >= 22) {
                        z12 = true;
                    }
                    z11 = z12;
                }
            }
            if (!z11) {
                return 1;
            }
            return 2;
        }

        @Override
        public final void d() {
            j.this.w(true);
        }
    }

    public class C0280j extends ContentFrameLayout {
        public C0280j(k.c cVar) {
            super(cVar, null);
        }

        @Override
        public final boolean dispatchKeyEvent(KeyEvent keyEvent) {
            if (!j.this.C(keyEvent) && !super.dispatchKeyEvent(keyEvent)) {
                return false;
            }
            return true;
        }

        @Override
        public final boolean onInterceptTouchEvent(MotionEvent motionEvent) {
            boolean z10;
            if (motionEvent.getAction() == 0) {
                int x8 = (int) motionEvent.getX();
                int y10 = (int) motionEvent.getY();
                if (x8 >= -5 && y10 >= -5 && x8 <= getWidth() + 5 && y10 <= getHeight() + 5) {
                    z10 = false;
                } else {
                    z10 = true;
                }
                if (z10) {
                    j jVar = j.this;
                    jVar.A(jVar.H(0), true);
                    return true;
                }
            }
            return super.onInterceptTouchEvent(motionEvent);
        }

        @Override
        public final void setBackgroundResource(int i10) {
            setBackgroundDrawable(h.a.b(getContext(), i10));
        }
    }

    public static final class k {

        public int f15156a;

        public int f15157b;

        public int f15158c;

        public int f15159d;

        public C0280j f15160e;

        public View f15161f;

        public View f15162g;

        public androidx.appcompat.view.menu.f f15163h;

        public androidx.appcompat.view.menu.d f15164i;

        public k.c f15165j;

        public boolean f15166k;

        public boolean f15167l;

        public boolean f15168m;

        public boolean f15169n = false;

        public boolean f15170o;

        public Bundle f15171p;

        public k(int i10) {
            this.f15156a = i10;
        }
    }

    public final class l implements j.a {
        public l() {
        }

        @Override
        public final void b(androidx.appcompat.view.menu.f fVar, boolean z10) {
            boolean z11;
            int i10;
            k kVar;
            androidx.appcompat.view.menu.f k7 = fVar.k();
            int i11 = 0;
            if (k7 != fVar) {
                z11 = true;
            } else {
                z11 = false;
            }
            j jVar = j.this;
            if (z11) {
                fVar = k7;
            }
            k[] kVarArr = jVar.f15100a0;
            if (kVarArr != null) {
                i10 = kVarArr.length;
            } else {
                i10 = 0;
            }
            while (true) {
                if (i11 < i10) {
                    kVar = kVarArr[i11];
                    if (kVar != null && kVar.f15163h == fVar) {
                        break;
                    } else {
                        i11++;
                    }
                } else {
                    kVar = null;
                    break;
                }
            }
            if (kVar != null) {
                if (z11) {
                    j.this.y(kVar.f15156a, kVar, k7);
                    j.this.A(kVar, true);
                } else {
                    j.this.A(kVar, z10);
                }
            }
        }

        @Override
        public final boolean c(androidx.appcompat.view.menu.f fVar) {
            Window.Callback I;
            if (fVar == fVar.k()) {
                j jVar = j.this;
                if (jVar.f15141z && (I = jVar.I()) != null && !j.this.f15109f0) {
                    I.onMenuOpened(108, fVar);
                    return true;
                }
                return true;
            }
            return true;
        }
    }

    public j(Context context, Window window, g.h hVar, Object obj) {
        r0.f<String, Integer> fVar;
        Integer orDefault;
        g.g gVar;
        this.f15113h0 = -100;
        this.f15104d = context;
        this.f15110g = hVar;
        this.f15102c = obj;
        if (obj instanceof Dialog) {
            while (context != null) {
                if (context instanceof g.g) {
                    gVar = (g.g) context;
                    break;
                } else if (!(context instanceof ContextWrapper)) {
                    break;
                } else {
                    context = ((ContextWrapper) context).getBaseContext();
                }
            }
            gVar = null;
            if (gVar != null) {
                this.f15113h0 = gVar.C().f();
            }
        }
        if (this.f15113h0 == -100 && (orDefault = (fVar = f15096u0).getOrDefault(this.f15102c.getClass().getName(), null)) != null) {
            this.f15113h0 = orDefault.intValue();
            fVar.remove(this.f15102c.getClass().getName());
        }
        if (window != null) {
            x(window);
        }
        m.j.c();
    }

    public static Configuration B(Context context, int i10, Configuration configuration) {
        int i11;
        if (i10 != 1) {
            if (i10 != 2) {
                i11 = context.getApplicationContext().getResources().getConfiguration().uiMode & 48;
            } else {
                i11 = 32;
            }
        } else {
            i11 = 16;
        }
        Configuration configuration2 = new Configuration();
        configuration2.fontScale = 0.0f;
        if (configuration != null) {
            configuration2.setTo(configuration);
        }
        configuration2.uiMode = i11 | (configuration2.uiMode & (-49));
        return configuration2;
    }

    public final void A(k kVar, boolean z10) {
        C0280j c0280j;
        t0 t0Var;
        if (z10 && kVar.f15156a == 0 && (t0Var = this.f15118k) != null && t0Var.a()) {
            z(kVar.f15163h);
            return;
        }
        WindowManager windowManager = (WindowManager) this.f15104d.getSystemService("window");
        if (windowManager != null && kVar.f15168m && (c0280j = kVar.f15160e) != null) {
            windowManager.removeView(c0280j);
            if (z10) {
                y(kVar.f15156a, kVar, null);
            }
        }
        kVar.f15166k = false;
        kVar.f15167l = false;
        kVar.f15168m = false;
        kVar.f15161f = null;
        kVar.f15169n = true;
        if (this.f15101b0 == kVar) {
            this.f15101b0 = null;
        }
    }

    public final boolean C(KeyEvent keyEvent) {
        View decorView;
        boolean z10;
        boolean z11;
        boolean z12;
        boolean z13;
        boolean z14;
        Object obj = this.f15102c;
        boolean z15 = true;
        if (((obj instanceof e.a) || (obj instanceof o)) && (decorView = this.f15106e.getDecorView()) != null && i4.e.a(decorView, keyEvent)) {
            return true;
        }
        if (keyEvent.getKeyCode() == 82 && this.f15108f.f21986a.dispatchKeyEvent(keyEvent)) {
            return true;
        }
        int keyCode = keyEvent.getKeyCode();
        if (keyEvent.getAction() == 0) {
            z10 = true;
        } else {
            z10 = false;
        }
        if (z10) {
            if (keyCode != 4) {
                if (keyCode == 82) {
                    if (keyEvent.getRepeatCount() != 0) {
                        return true;
                    }
                    k H = H(0);
                    if (H.f15168m) {
                        return true;
                    }
                    N(H, keyEvent);
                    return true;
                }
            } else {
                if ((keyEvent.getFlags() & 128) == 0) {
                    z15 = false;
                }
                this.f15103c0 = z15;
            }
        } else if (keyCode != 4) {
            if (keyCode == 82) {
                if (this.f15124n != null) {
                    return true;
                }
                k H2 = H(0);
                t0 t0Var = this.f15118k;
                if (t0Var != null && t0Var.c() && !ViewConfiguration.get(this.f15104d).hasPermanentMenuKey()) {
                    if (!this.f15118k.a()) {
                        if (!this.f15109f0 && N(H2, keyEvent)) {
                            z13 = this.f15118k.g();
                        }
                        z13 = false;
                    } else {
                        z13 = this.f15118k.f();
                    }
                } else {
                    boolean z16 = H2.f15168m;
                    if (!z16 && !H2.f15167l) {
                        if (H2.f15166k) {
                            if (H2.f15170o) {
                                H2.f15166k = false;
                                z14 = N(H2, keyEvent);
                            } else {
                                z14 = true;
                            }
                            if (z14) {
                                L(H2, keyEvent);
                                z13 = true;
                            }
                        }
                        z13 = false;
                    } else {
                        A(H2, true);
                        z13 = z16;
                    }
                }
                if (!z13) {
                    return true;
                }
                AudioManager audioManager = (AudioManager) this.f15104d.getApplicationContext().getSystemService("audio");
                if (audioManager != null) {
                    audioManager.playSoundEffect(0);
                    return true;
                }
                Log.w("AppCompatDelegate", "Couldn't get audio manager");
                return true;
            }
        } else {
            boolean z17 = this.f15103c0;
            this.f15103c0 = false;
            k H3 = H(0);
            if (H3.f15168m) {
                if (z17) {
                    return true;
                }
                A(H3, true);
                return true;
            }
            k.a aVar = this.f15124n;
            if (aVar != null) {
                aVar.c();
            } else {
                J();
                t tVar = this.f15112h;
                if (tVar != null) {
                    u0 u0Var = tVar.f15216e;
                    if (u0Var != null && u0Var.j()) {
                        tVar.f15216e.collapseActionView();
                        z12 = true;
                    } else {
                        z12 = false;
                    }
                }
                z11 = false;
                if (!z11) {
                    return true;
                }
            }
            z11 = true;
            if (!z11) {
            }
        }
        return false;
    }

    public final void D(int i10) {
        k H = H(i10);
        if (H.f15163h != null) {
            Bundle bundle = new Bundle();
            H.f15163h.t(bundle);
            if (bundle.size() > 0) {
                H.f15171p = bundle;
            }
            H.f15163h.w();
            H.f15163h.clear();
        }
        H.f15170o = true;
        H.f15169n = true;
        if ((i10 == 108 || i10 == 0) && this.f15118k != null) {
            k H2 = H(0);
            H2.f15166k = false;
            N(H2, null);
        }
    }

    public final void E() {
        ViewGroup viewGroup;
        CharSequence charSequence;
        Context context;
        if (!this.f15134t) {
            TypedArray obtainStyledAttributes = this.f15104d.obtainStyledAttributes(a1.t.q);
            if (obtainStyledAttributes.hasValue(117)) {
                if (obtainStyledAttributes.getBoolean(126, false)) {
                    q(1);
                } else if (obtainStyledAttributes.getBoolean(117, false)) {
                    q(108);
                }
                if (obtainStyledAttributes.getBoolean(118, false)) {
                    q(109);
                }
                if (obtainStyledAttributes.getBoolean(119, false)) {
                    q(10);
                }
                this.X = obtainStyledAttributes.getBoolean(0, false);
                obtainStyledAttributes.recycle();
                F();
                this.f15106e.getDecorView();
                LayoutInflater from = LayoutInflater.from(this.f15104d);
                if (!this.Y) {
                    if (this.X) {
                        viewGroup = (ViewGroup) from.inflate(C0909R.layout.abc_dialog_title_material, (ViewGroup) null);
                        this.A = false;
                        this.f15141z = false;
                    } else if (this.f15141z) {
                        TypedValue typedValue = new TypedValue();
                        this.f15104d.getTheme().resolveAttribute(C0909R.attr.actionBarTheme, typedValue, true);
                        if (typedValue.resourceId != 0) {
                            context = new k.c(typedValue.resourceId, this.f15104d);
                        } else {
                            context = this.f15104d;
                        }
                        viewGroup = (ViewGroup) LayoutInflater.from(context).inflate(C0909R.layout.abc_screen_toolbar, (ViewGroup) null);
                        t0 t0Var = (t0) viewGroup.findViewById(C0909R.id.decor_content_parent);
                        this.f15118k = t0Var;
                        t0Var.setWindowCallback(I());
                        if (this.A) {
                            this.f15118k.h(109);
                        }
                        if (this.f15139x) {
                            this.f15118k.h(2);
                        }
                        if (this.f15140y) {
                            this.f15118k.h(5);
                        }
                    } else {
                        viewGroup = null;
                    }
                } else {
                    viewGroup = this.B ? (ViewGroup) from.inflate(C0909R.layout.abc_screen_simple_overlay_action_mode, (ViewGroup) null) : (ViewGroup) from.inflate(C0909R.layout.abc_screen_simple, (ViewGroup) null);
                }
                if (viewGroup != null) {
                    g.k kVar = new g.k(this);
                    WeakHashMap<View, i2> weakHashMap = k0.f17830a;
                    k0.h.u(viewGroup, kVar);
                    if (this.f15118k == null) {
                        this.f15137v = (TextView) viewGroup.findViewById(C0909R.id.title);
                    }
                    Method method = a2.f24497a;
                    try {
                        Method method2 = viewGroup.getClass().getMethod("makeOptionalFitsSystemWindows", new Class[0]);
                        if (!method2.isAccessible()) {
                            method2.setAccessible(true);
                        }
                        method2.invoke(viewGroup, new Object[0]);
                    } catch (IllegalAccessException e10) {
                        Log.d("ViewUtils", "Could not invoke makeOptionalFitsSystemWindows", e10);
                    } catch (NoSuchMethodException unused) {
                        Log.d("ViewUtils", "Could not find method makeOptionalFitsSystemWindows. Oh well...");
                    } catch (InvocationTargetException e11) {
                        Log.d("ViewUtils", "Could not invoke makeOptionalFitsSystemWindows", e11);
                    }
                    ContentFrameLayout contentFrameLayout = (ContentFrameLayout) viewGroup.findViewById(C0909R.id.action_bar_activity_content);
                    ViewGroup viewGroup2 = (ViewGroup) this.f15106e.findViewById(R.id.content);
                    if (viewGroup2 != null) {
                        while (viewGroup2.getChildCount() > 0) {
                            View childAt = viewGroup2.getChildAt(0);
                            viewGroup2.removeViewAt(0);
                            contentFrameLayout.addView(childAt);
                        }
                        viewGroup2.setId(-1);
                        contentFrameLayout.setId(R.id.content);
                        if (viewGroup2 instanceof FrameLayout) {
                            ((FrameLayout) viewGroup2).setForeground(null);
                        }
                    }
                    this.f15106e.setContentView(viewGroup);
                    contentFrameLayout.setAttachListener(new g.l(this));
                    this.f15136u = viewGroup;
                    Object obj = this.f15102c;
                    if (obj instanceof Activity) {
                        charSequence = ((Activity) obj).getTitle();
                    } else {
                        charSequence = this.f15116j;
                    }
                    if (!TextUtils.isEmpty(charSequence)) {
                        t0 t0Var2 = this.f15118k;
                        if (t0Var2 != null) {
                            t0Var2.setWindowTitle(charSequence);
                        } else {
                            t tVar = this.f15112h;
                            if (tVar != null) {
                                tVar.f15216e.setWindowTitle(charSequence);
                            } else {
                                TextView textView = this.f15137v;
                                if (textView != null) {
                                    textView.setText(charSequence);
                                }
                            }
                        }
                    }
                    ContentFrameLayout contentFrameLayout2 = (ContentFrameLayout) this.f15136u.findViewById(R.id.content);
                    View decorView = this.f15106e.getDecorView();
                    contentFrameLayout2.f1282g.set(decorView.getPaddingLeft(), decorView.getPaddingTop(), decorView.getPaddingRight(), decorView.getPaddingBottom());
                    WeakHashMap<View, i2> weakHashMap2 = k0.f17830a;
                    if (k0.f.c(contentFrameLayout2)) {
                        contentFrameLayout2.requestLayout();
                    }
                    TypedArray obtainStyledAttributes2 = this.f15104d.obtainStyledAttributes(a1.t.q);
                    obtainStyledAttributes2.getValue(124, contentFrameLayout2.getMinWidthMajor());
                    obtainStyledAttributes2.getValue(125, contentFrameLayout2.getMinWidthMinor());
                    if (obtainStyledAttributes2.hasValue(122)) {
                        obtainStyledAttributes2.getValue(122, contentFrameLayout2.getFixedWidthMajor());
                    }
                    if (obtainStyledAttributes2.hasValue(123)) {
                        obtainStyledAttributes2.getValue(123, contentFrameLayout2.getFixedWidthMinor());
                    }
                    if (obtainStyledAttributes2.hasValue(120)) {
                        obtainStyledAttributes2.getValue(120, contentFrameLayout2.getFixedHeightMajor());
                    }
                    if (obtainStyledAttributes2.hasValue(121)) {
                        obtainStyledAttributes2.getValue(121, contentFrameLayout2.getFixedHeightMinor());
                    }
                    obtainStyledAttributes2.recycle();
                    contentFrameLayout2.requestLayout();
                    this.f15134t = true;
                    k H = H(0);
                    if (!this.f15109f0 && H.f15163h == null) {
                        this.f15127o0 |= 4096;
                        if (!this.f15125n0) {
                            k0.d.m(this.f15106e.getDecorView(), this.p0);
                            this.f15125n0 = true;
                            return;
                        }
                        return;
                    }
                    return;
                }
                StringBuilder b10 = android.support.v4.media.d.b("AppCompat does not support the current theme features: { windowActionBar: ");
                b10.append(this.f15141z);
                b10.append(", windowActionBarOverlay: ");
                b10.append(this.A);
                b10.append(", android:windowIsFloating: ");
                b10.append(this.X);
                b10.append(", windowActionModeOverlay: ");
                b10.append(this.B);
                b10.append(", windowNoTitle: ");
                b10.append(this.Y);
                b10.append(" }");
                throw new IllegalArgumentException(b10.toString());
            }
            obtainStyledAttributes.recycle();
            throw new IllegalStateException("You need to use a Theme.AppCompat theme (or descendant) with this activity.");
        }
    }

    public final void F() {
        if (this.f15106e == null) {
            Object obj = this.f15102c;
            if (obj instanceof Activity) {
                x(((Activity) obj).getWindow());
            }
        }
        if (this.f15106e != null) {
        } else {
            throw new IllegalStateException("We have not been given a Window");
        }
    }

    public final h G(Context context) {
        if (this.f15121l0 == null) {
            if (s.f15205d == null) {
                Context applicationContext = context.getApplicationContext();
                s.f15205d = new s(applicationContext, (LocationManager) applicationContext.getSystemService("location"));
            }
            this.f15121l0 = new i(s.f15205d);
        }
        return this.f15121l0;
    }

    public final k H(int i10) {
        k[] kVarArr = this.f15100a0;
        if (kVarArr == null || kVarArr.length <= i10) {
            k[] kVarArr2 = new k[i10 + 1];
            if (kVarArr != null) {
                System.arraycopy(kVarArr, 0, kVarArr2, 0, kVarArr.length);
            }
            this.f15100a0 = kVarArr2;
            kVarArr = kVarArr2;
        }
        k kVar = kVarArr[i10];
        if (kVar == null) {
            k kVar2 = new k(i10);
            kVarArr[i10] = kVar2;
            return kVar2;
        }
        return kVar;
    }

    public final Window.Callback I() {
        return this.f15106e.getCallback();
    }

    public final void J() {
        E();
        if (this.f15141z && this.f15112h == null) {
            Object obj = this.f15102c;
            if (obj instanceof Activity) {
                this.f15112h = new t((Activity) this.f15102c, this.A);
            } else if (obj instanceof Dialog) {
                this.f15112h = new t((Dialog) this.f15102c);
            }
            t tVar = this.f15112h;
            if (tVar != null) {
                tVar.e(this.f15129q0);
            }
        }
    }

    public final int K(int i10, Context context) {
        if (i10 == -100) {
            return -1;
        }
        if (i10 != -1) {
            if (i10 != 0) {
                if (i10 != 1 && i10 != 2) {
                    if (i10 == 3) {
                        if (this.f15123m0 == null) {
                            this.f15123m0 = new g(context);
                        }
                        return this.f15123m0.c();
                    }
                    throw new IllegalStateException("Unknown value set for night mode. Please use one of the MODE_NIGHT values from AppCompatDelegate.");
                }
                return i10;
            }
            if (Build.VERSION.SDK_INT >= 23 && ((UiModeManager) context.getApplicationContext().getSystemService("uimode")).getNightMode() == 0) {
                return -1;
            }
            return G(context).c();
        }
        return i10;
    }

    public final void L(k kVar, KeyEvent keyEvent) {
        boolean z10;
        boolean z11;
        Context context;
        int i10;
        ViewGroup.LayoutParams layoutParams;
        boolean z12;
        if (!kVar.f15168m && !this.f15109f0) {
            if (kVar.f15156a == 0) {
                if ((this.f15104d.getResources().getConfiguration().screenLayout & 15) == 4) {
                    z12 = true;
                } else {
                    z12 = false;
                }
                if (z12) {
                    return;
                }
            }
            Window.Callback I = I();
            if (I != null && !I.onMenuOpened(kVar.f15156a, kVar.f15163h)) {
                A(kVar, true);
                return;
            }
            WindowManager windowManager = (WindowManager) this.f15104d.getSystemService("window");
            if (windowManager == null || !N(kVar, keyEvent)) {
                return;
            }
            C0280j c0280j = kVar.f15160e;
            if (c0280j != null && !kVar.f15169n) {
                View view = kVar.f15162g;
                if (view != null && (layoutParams = view.getLayoutParams()) != null && layoutParams.width == -1) {
                    i10 = -1;
                    kVar.f15167l = false;
                    WindowManager.LayoutParams layoutParams2 = new WindowManager.LayoutParams(i10, -2, 0, 0, CommonCode.BusInterceptor.PRIVACY_CANCEL, 8519680, -3);
                    layoutParams2.gravity = kVar.f15158c;
                    layoutParams2.windowAnimations = kVar.f15159d;
                    windowManager.addView(kVar.f15160e, layoutParams2);
                    kVar.f15168m = true;
                }
            } else {
                if (c0280j == null) {
                    J();
                    t tVar = this.f15112h;
                    if (tVar != null) {
                        context = tVar.c();
                    } else {
                        context = null;
                    }
                    if (context == null) {
                        context = this.f15104d;
                    }
                    TypedValue typedValue = new TypedValue();
                    Resources.Theme newTheme = context.getResources().newTheme();
                    newTheme.setTo(context.getTheme());
                    newTheme.resolveAttribute(C0909R.attr.actionBarPopupTheme, typedValue, true);
                    int i11 = typedValue.resourceId;
                    if (i11 != 0) {
                        newTheme.applyStyle(i11, true);
                    }
                    newTheme.resolveAttribute(C0909R.attr.panelMenuListTheme, typedValue, true);
                    int i12 = typedValue.resourceId;
                    if (i12 != 0) {
                        newTheme.applyStyle(i12, true);
                    } else {
                        newTheme.applyStyle(C0909R.style.Theme_AppCompat_CompactMenu, true);
                    }
                    k.c cVar = new k.c(0, context);
                    cVar.getTheme().setTo(newTheme);
                    kVar.f15165j = cVar;
                    TypedArray obtainStyledAttributes = cVar.obtainStyledAttributes(a1.t.q);
                    kVar.f15157b = obtainStyledAttributes.getResourceId(86, 0);
                    kVar.f15159d = obtainStyledAttributes.getResourceId(1, 0);
                    obtainStyledAttributes.recycle();
                    kVar.f15160e = new C0280j(kVar.f15165j);
                    kVar.f15158c = 81;
                } else if (kVar.f15169n && c0280j.getChildCount() > 0) {
                    kVar.f15160e.removeAllViews();
                }
                View view2 = kVar.f15162g;
                if (view2 != null) {
                    kVar.f15161f = view2;
                } else {
                    if (kVar.f15163h != null) {
                        if (this.f15122m == null) {
                            this.f15122m = new l();
                        }
                        l lVar = this.f15122m;
                        if (kVar.f15164i == null) {
                            androidx.appcompat.view.menu.d dVar = new androidx.appcompat.view.menu.d(kVar.f15165j);
                            kVar.f15164i = dVar;
                            dVar.f1081e = lVar;
                            androidx.appcompat.view.menu.f fVar = kVar.f15163h;
                            fVar.b(dVar, fVar.f1092a);
                        }
                        androidx.appcompat.view.menu.d dVar2 = kVar.f15164i;
                        C0280j c0280j2 = kVar.f15160e;
                        if (dVar2.f1080d == null) {
                            dVar2.f1080d = (ExpandedMenuView) dVar2.f1078b.inflate(C0909R.layout.abc_expanded_menu_layout, (ViewGroup) c0280j2, false);
                            if (dVar2.f1082f == null) {
                                dVar2.f1082f = new d.a();
                            }
                            dVar2.f1080d.setAdapter((ListAdapter) dVar2.f1082f);
                            dVar2.f1080d.setOnItemClickListener(dVar2);
                        }
                        ExpandedMenuView expandedMenuView = dVar2.f1080d;
                        kVar.f15161f = expandedMenuView;
                    }
                    z10 = false;
                    if (z10) {
                        if (kVar.f15161f != null) {
                            if (kVar.f15162g == null) {
                                androidx.appcompat.view.menu.d dVar3 = kVar.f15164i;
                                if (dVar3.f1082f == null) {
                                    dVar3.f1082f = new d.a();
                                }
                            }
                            z11 = true;
                            if (z11) {
                                ViewGroup.LayoutParams layoutParams3 = kVar.f15161f.getLayoutParams();
                                if (layoutParams3 == null) {
                                    layoutParams3 = new ViewGroup.LayoutParams(-2, -2);
                                }
                                kVar.f15160e.setBackgroundResource(kVar.f15157b);
                                ViewParent parent = kVar.f15161f.getParent();
                                if (parent instanceof ViewGroup) {
                                    ((ViewGroup) parent).removeView(kVar.f15161f);
                                }
                                kVar.f15160e.addView(kVar.f15161f, layoutParams3);
                                if (!kVar.f15161f.hasFocus()) {
                                    kVar.f15161f.requestFocus();
                                }
                            }
                        }
                        z11 = false;
                        if (z11) {
                        }
                    }
                    kVar.f15169n = true;
                    return;
                }
                z10 = true;
                if (z10) {
                }
                kVar.f15169n = true;
                return;
            }
            i10 = -2;
            kVar.f15167l = false;
            WindowManager.LayoutParams layoutParams22 = new WindowManager.LayoutParams(i10, -2, 0, 0, CommonCode.BusInterceptor.PRIVACY_CANCEL, 8519680, -3);
            layoutParams22.gravity = kVar.f15158c;
            layoutParams22.windowAnimations = kVar.f15159d;
            windowManager.addView(kVar.f15160e, layoutParams22);
            kVar.f15168m = true;
        }
    }

    public final boolean M(k kVar, int i10, KeyEvent keyEvent) {
        androidx.appcompat.view.menu.f fVar;
        if (keyEvent.isSystem()) {
            return false;
        }
        if ((!kVar.f15166k && !N(kVar, keyEvent)) || (fVar = kVar.f15163h) == null) {
            return false;
        }
        return fVar.performShortcut(i10, keyEvent, 1);
    }

    public final boolean N(k kVar, KeyEvent keyEvent) {
        boolean z10;
        t0 t0Var;
        t0 t0Var2;
        Resources.Theme theme;
        int i10;
        boolean z11;
        t0 t0Var3;
        t0 t0Var4;
        if (this.f15109f0) {
            return false;
        }
        if (kVar.f15166k) {
            return true;
        }
        k kVar2 = this.f15101b0;
        if (kVar2 != null && kVar2 != kVar) {
            A(kVar2, false);
        }
        Window.Callback I = I();
        if (I != null) {
            kVar.f15162g = I.onCreatePanelView(kVar.f15156a);
        }
        int i11 = kVar.f15156a;
        if (i11 != 0 && i11 != 108) {
            z10 = false;
        } else {
            z10 = true;
        }
        if (z10 && (t0Var4 = this.f15118k) != null) {
            t0Var4.b();
        }
        if (kVar.f15162g == null) {
            androidx.appcompat.view.menu.f fVar = kVar.f15163h;
            if (fVar == null || kVar.f15170o) {
                if (fVar == null) {
                    Context context = this.f15104d;
                    int i12 = kVar.f15156a;
                    if ((i12 == 0 || i12 == 108) && this.f15118k != null) {
                        TypedValue typedValue = new TypedValue();
                        Resources.Theme theme2 = context.getTheme();
                        theme2.resolveAttribute(C0909R.attr.actionBarTheme, typedValue, true);
                        if (typedValue.resourceId != 0) {
                            theme = context.getResources().newTheme();
                            theme.setTo(theme2);
                            theme.applyStyle(typedValue.resourceId, true);
                            theme.resolveAttribute(C0909R.attr.actionBarWidgetTheme, typedValue, true);
                        } else {
                            theme2.resolveAttribute(C0909R.attr.actionBarWidgetTheme, typedValue, true);
                            theme = null;
                        }
                        if (typedValue.resourceId != 0) {
                            if (theme == null) {
                                theme = context.getResources().newTheme();
                                theme.setTo(theme2);
                            }
                            theme.applyStyle(typedValue.resourceId, true);
                        }
                        if (theme != null) {
                            k.c cVar = new k.c(0, context);
                            cVar.getTheme().setTo(theme);
                            context = cVar;
                        }
                    }
                    androidx.appcompat.view.menu.f fVar2 = new androidx.appcompat.view.menu.f(context);
                    fVar2.f1096e = this;
                    androidx.appcompat.view.menu.f fVar3 = kVar.f15163h;
                    if (fVar2 != fVar3) {
                        if (fVar3 != null) {
                            fVar3.r(kVar.f15164i);
                        }
                        kVar.f15163h = fVar2;
                        androidx.appcompat.view.menu.d dVar = kVar.f15164i;
                        if (dVar != null) {
                            fVar2.b(dVar, fVar2.f1092a);
                        }
                    }
                    if (kVar.f15163h == null) {
                        return false;
                    }
                }
                if (z10 && (t0Var2 = this.f15118k) != null) {
                    if (this.f15120l == null) {
                        this.f15120l = new b();
                    }
                    t0Var2.d(kVar.f15163h, this.f15120l);
                }
                kVar.f15163h.w();
                if (!I.onCreatePanelMenu(kVar.f15156a, kVar.f15163h)) {
                    androidx.appcompat.view.menu.f fVar4 = kVar.f15163h;
                    if (fVar4 != null) {
                        if (fVar4 != null) {
                            fVar4.r(kVar.f15164i);
                        }
                        kVar.f15163h = null;
                    }
                    if (z10 && (t0Var = this.f15118k) != null) {
                        t0Var.d(null, this.f15120l);
                    }
                    return false;
                }
                kVar.f15170o = false;
            }
            kVar.f15163h.w();
            Bundle bundle = kVar.f15171p;
            if (bundle != null) {
                kVar.f15163h.s(bundle);
                kVar.f15171p = null;
            }
            if (!I.onPreparePanel(0, kVar.f15162g, kVar.f15163h)) {
                if (z10 && (t0Var3 = this.f15118k) != null) {
                    t0Var3.d(null, this.f15120l);
                }
                kVar.f15163h.v();
                return false;
            }
            if (keyEvent != null) {
                i10 = keyEvent.getDeviceId();
            } else {
                i10 = -1;
            }
            if (KeyCharacterMap.load(i10).getKeyboardType() != 1) {
                z11 = true;
            } else {
                z11 = false;
            }
            kVar.f15163h.setQwertyMode(z11);
            kVar.f15163h.v();
        }
        kVar.f15166k = true;
        kVar.f15167l = false;
        this.f15101b0 = kVar;
        return true;
    }

    public final void O() {
        if (!this.f15134t) {
        } else {
            throw new AndroidRuntimeException("Window feature must be requested before adding content");
        }
    }

    @Override
    public final boolean a(androidx.appcompat.view.menu.f fVar, MenuItem menuItem) {
        int i10;
        k kVar;
        Window.Callback I = I();
        if (I != null && !this.f15109f0) {
            androidx.appcompat.view.menu.f k7 = fVar.k();
            k[] kVarArr = this.f15100a0;
            if (kVarArr != null) {
                i10 = kVarArr.length;
            } else {
                i10 = 0;
            }
            int i11 = 0;
            while (true) {
                if (i11 < i10) {
                    kVar = kVarArr[i11];
                    if (kVar != null && kVar.f15163h == k7) {
                        break;
                    }
                    i11++;
                } else {
                    kVar = null;
                    break;
                }
            }
            if (kVar != null) {
                return I.onMenuItemSelected(kVar.f15156a, menuItem);
            }
        }
        return false;
    }

    @Override
    public final void b(androidx.appcompat.view.menu.f fVar) {
        t0 t0Var = this.f15118k;
        if (t0Var != null && t0Var.c() && (!ViewConfiguration.get(this.f15104d).hasPermanentMenuKey() || this.f15118k.e())) {
            Window.Callback I = I();
            if (this.f15118k.a()) {
                this.f15118k.f();
                if (!this.f15109f0) {
                    I.onPanelClosed(108, H(0).f15163h);
                    return;
                }
                return;
            }
            if (I != null && !this.f15109f0) {
                if (this.f15125n0 && (1 & this.f15127o0) != 0) {
                    this.f15106e.getDecorView().removeCallbacks(this.p0);
                    this.p0.run();
                }
                k H = H(0);
                androidx.appcompat.view.menu.f fVar2 = H.f15163h;
                if (fVar2 != null && !H.f15170o && I.onPreparePanel(0, H.f15162g, fVar2)) {
                    I.onMenuOpened(108, H.f15163h);
                    this.f15118k.g();
                    return;
                }
                return;
            }
            return;
        }
        k H2 = H(0);
        H2.f15169n = true;
        A(H2, false);
        L(H2, null);
    }

    @Override
    public final void c(View view, ViewGroup.LayoutParams layoutParams) {
        E();
        ((ViewGroup) this.f15136u.findViewById(R.id.content)).addView(view, layoutParams);
        this.f15108f.f21986a.onContentChanged();
    }

    @Override
    public final Context d(Context context) {
        Configuration configuration;
        boolean z10;
        this.f15105d0 = true;
        int i10 = this.f15113h0;
        if (i10 == -100) {
            i10 = -100;
        }
        int K = K(i10, context);
        if (f15099x0 && (context instanceof ContextThemeWrapper)) {
            try {
                ((ContextThemeWrapper) context).applyOverrideConfiguration(B(context, K, null));
                return context;
            } catch (IllegalStateException unused) {
            }
        }
        if (context instanceof k.c) {
            try {
                ((k.c) context).a(B(context, K, null));
                return context;
            } catch (IllegalStateException unused2) {
            }
        }
        if (!f15098w0) {
            return context;
        }
        int i11 = Build.VERSION.SDK_INT;
        Configuration configuration2 = new Configuration();
        configuration2.uiMode = -1;
        configuration2.fontScale = 0.0f;
        Configuration configuration3 = context.createConfigurationContext(configuration2).getResources().getConfiguration();
        Configuration configuration4 = context.getResources().getConfiguration();
        configuration3.uiMode = configuration4.uiMode;
        if (!configuration3.equals(configuration4)) {
            configuration = new Configuration();
            configuration.fontScale = 0.0f;
            if (configuration3.diff(configuration4) != 0) {
                float f10 = configuration3.fontScale;
                float f11 = configuration4.fontScale;
                if (f10 != f11) {
                    configuration.fontScale = f11;
                }
                int i12 = configuration3.mcc;
                int i13 = configuration4.mcc;
                if (i12 != i13) {
                    configuration.mcc = i13;
                }
                int i14 = configuration3.mnc;
                int i15 = configuration4.mnc;
                if (i14 != i15) {
                    configuration.mnc = i15;
                }
                if (i11 >= 24) {
                    d.a(configuration3, configuration4, configuration);
                } else if (!h4.b.a(configuration3.locale, configuration4.locale)) {
                    configuration.locale = configuration4.locale;
                }
                int i16 = configuration3.touchscreen;
                int i17 = configuration4.touchscreen;
                if (i16 != i17) {
                    configuration.touchscreen = i17;
                }
                int i18 = configuration3.keyboard;
                int i19 = configuration4.keyboard;
                if (i18 != i19) {
                    configuration.keyboard = i19;
                }
                int i20 = configuration3.keyboardHidden;
                int i21 = configuration4.keyboardHidden;
                if (i20 != i21) {
                    configuration.keyboardHidden = i21;
                }
                int i22 = configuration3.navigation;
                int i23 = configuration4.navigation;
                if (i22 != i23) {
                    configuration.navigation = i23;
                }
                int i24 = configuration3.navigationHidden;
                int i25 = configuration4.navigationHidden;
                if (i24 != i25) {
                    configuration.navigationHidden = i25;
                }
                int i26 = configuration3.orientation;
                int i27 = configuration4.orientation;
                if (i26 != i27) {
                    configuration.orientation = i27;
                }
                int i28 = configuration3.screenLayout & 15;
                int i29 = configuration4.screenLayout & 15;
                if (i28 != i29) {
                    configuration.screenLayout |= i29;
                }
                int i30 = configuration3.screenLayout & 192;
                int i31 = configuration4.screenLayout & 192;
                if (i30 != i31) {
                    configuration.screenLayout |= i31;
                }
                int i32 = configuration3.screenLayout & 48;
                int i33 = configuration4.screenLayout & 48;
                if (i32 != i33) {
                    configuration.screenLayout |= i33;
                }
                int i34 = configuration3.screenLayout & 768;
                int i35 = configuration4.screenLayout & 768;
                if (i34 != i35) {
                    configuration.screenLayout |= i35;
                }
                if (i11 >= 26) {
                    e.a(configuration3, configuration4, configuration);
                }
                int i36 = configuration3.uiMode & 15;
                int i37 = configuration4.uiMode & 15;
                if (i36 != i37) {
                    configuration.uiMode |= i37;
                }
                int i38 = configuration3.uiMode & 48;
                int i39 = configuration4.uiMode & 48;
                if (i38 != i39) {
                    configuration.uiMode |= i39;
                }
                int i40 = configuration3.screenWidthDp;
                int i41 = configuration4.screenWidthDp;
                if (i40 != i41) {
                    configuration.screenWidthDp = i41;
                }
                int i42 = configuration3.screenHeightDp;
                int i43 = configuration4.screenHeightDp;
                if (i42 != i43) {
                    configuration.screenHeightDp = i43;
                }
                int i44 = configuration3.smallestScreenWidthDp;
                int i45 = configuration4.smallestScreenWidthDp;
                if (i44 != i45) {
                    configuration.smallestScreenWidthDp = i45;
                }
                int i46 = configuration3.densityDpi;
                int i47 = configuration4.densityDpi;
                if (i46 != i47) {
                    configuration.densityDpi = i47;
                }
            }
        } else {
            configuration = null;
        }
        Configuration B = B(context, K, configuration);
        k.c cVar = new k.c(C0909R.style.Theme_AppCompat_Empty, context);
        cVar.a(B);
        if (context.getTheme() != null) {
            z10 = true;
            if (z10) {
                Resources.Theme theme = cVar.getTheme();
                int i48 = Build.VERSION.SDK_INT;
                if (i48 >= 29) {
                    x3.j.a(theme);
                } else if (i48 >= 23) {
                    synchronized (x3.h.f36583a) {
                        if (!x3.h.f36585c) {
                            try {
                                Method declaredMethod = Resources.Theme.class.getDeclaredMethod("rebase", new Class[0]);
                                x3.h.f36584b = declaredMethod;
                                declaredMethod.setAccessible(true);
                            } catch (NoSuchMethodException e10) {
                                Log.i("ResourcesCompat", "Failed to retrieve rebase() method", e10);
                            }
                            x3.h.f36585c = true;
                        }
                        Method method = x3.h.f36584b;
                        if (method != null) {
                            try {
                                method.invoke(theme, new Object[0]);
                            } catch (IllegalAccessException | InvocationTargetException e11) {
                                Log.i("ResourcesCompat", "Failed to invoke rebase() method via reflection", e11);
                                x3.h.f36584b = null;
                            }
                        }
                    }
                }
            }
            return cVar;
        }
        z10 = false;
        if (z10) {
        }
        return cVar;
    }

    @Override
    public final <T extends View> T e(int i10) {
        E();
        return (T) this.f15106e.findViewById(i10);
    }

    @Override
    public final int f() {
        return this.f15113h0;
    }

    @Override
    public final MenuInflater g() {
        Context context;
        if (this.f15114i == null) {
            J();
            t tVar = this.f15112h;
            if (tVar != null) {
                context = tVar.c();
            } else {
                context = this.f15104d;
            }
            this.f15114i = new k.f(context);
        }
        return this.f15114i;
    }

    @Override
    public final void h() {
        LayoutInflater from = LayoutInflater.from(this.f15104d);
        if (from.getFactory() == null) {
            from.setFactory2(this);
        } else if (!(from.getFactory2() instanceof j)) {
            Log.i("AppCompatDelegate", "The Activity's LayoutInflater already has a Factory installed so we can not install AppCompat's");
        }
    }

    @Override
    public final void i() {
        if (this.f15112h != null) {
            J();
            this.f15112h.getClass();
            this.f15127o0 |= 1;
            if (!this.f15125n0) {
                View decorView = this.f15106e.getDecorView();
                a aVar = this.p0;
                WeakHashMap<View, i2> weakHashMap = k0.f17830a;
                k0.d.m(decorView, aVar);
                this.f15125n0 = true;
            }
        }
    }

    @Override
    public final void j() {
        if (this.f15141z && this.f15134t) {
            J();
            t tVar = this.f15112h;
            if (tVar != null) {
                tVar.f(tVar.f15212a.getResources().getBoolean(C0909R.bool.abc_action_bar_embed_tabs));
            }
        }
        m.j a8 = m.j.a();
        Context context = this.f15104d;
        synchronized (a8) {
            i1 i1Var = a8.f24587a;
            synchronized (i1Var) {
                r0.d<WeakReference<Drawable.ConstantState>> dVar = i1Var.f24581d.get(context);
                if (dVar != null) {
                    int i10 = dVar.f30248d;
                    Object[] objArr = dVar.f30247c;
                    for (int i11 = 0; i11 < i10; i11++) {
                        objArr[i11] = null;
                    }
                    dVar.f30248d = 0;
                    dVar.f30245a = false;
                }
            }
        }
        this.f15111g0 = new Configuration(this.f15104d.getResources().getConfiguration());
        w(false);
    }

    @Override
    public final void k() {
        this.f15105d0 = true;
        w(false);
        F();
        Object obj = this.f15102c;
        if (obj instanceof Activity) {
            String str = null;
            try {
                Activity activity = (Activity) obj;
                try {
                    str = v3.n.c(activity, activity.getComponentName());
                } catch (PackageManager.NameNotFoundException e10) {
                    throw new IllegalArgumentException(e10);
                }
            } catch (IllegalArgumentException unused) {
            }
            if (str != null) {
                t tVar = this.f15112h;
                if (tVar == null) {
                    this.f15129q0 = true;
                } else {
                    tVar.e(true);
                }
            }
            synchronized (g.i.f15095b) {
                g.i.p(this);
                g.i.f15094a.add(new WeakReference<>(this));
            }
        }
        this.f15111g0 = new Configuration(this.f15104d.getResources().getConfiguration());
        this.f15107e0 = true;
    }

    @Override
    public final void l() {
        i iVar;
        g gVar;
        if (this.f15102c instanceof Activity) {
            synchronized (g.i.f15095b) {
                g.i.p(this);
            }
        }
        if (this.f15125n0) {
            this.f15106e.getDecorView().removeCallbacks(this.p0);
        }
        this.f15109f0 = true;
        if (this.f15113h0 != -100) {
            Object obj = this.f15102c;
            if ((obj instanceof Activity) && ((Activity) obj).isChangingConfigurations()) {
                f15096u0.put(this.f15102c.getClass().getName(), Integer.valueOf(this.f15113h0));
                iVar = this.f15121l0;
                if (iVar != null) {
                    iVar.a();
                }
                gVar = this.f15123m0;
                if (gVar == null) {
                    gVar.a();
                    return;
                }
                return;
            }
        }
        f15096u0.remove(this.f15102c.getClass().getName());
        iVar = this.f15121l0;
        if (iVar != null) {
        }
        gVar = this.f15123m0;
        if (gVar == null) {
        }
    }

    @Override
    public final void m() {
        J();
        t tVar = this.f15112h;
        if (tVar != null) {
            tVar.f15231u = true;
        }
    }

    @Override
    public final void n() {
        w(true);
    }

    @Override
    public final void o() {
        J();
        t tVar = this.f15112h;
        if (tVar != null) {
            tVar.f15231u = false;
            k.g gVar = tVar.f15230t;
            if (gVar != null) {
                gVar.a();
            }
        }
    }

    @Override
    public final View onCreateView(View view, String str, Context context, AttributeSet attributeSet) {
        View f0Var;
        if (this.f15135t0 == null) {
            String string = this.f15104d.obtainStyledAttributes(a1.t.q).getString(116);
            if (string == null) {
                this.f15135t0 = new p();
            } else {
                try {
                    this.f15135t0 = (p) this.f15104d.getClassLoader().loadClass(string).getDeclaredConstructor(new Class[0]).newInstance(new Object[0]);
                } catch (Throwable th2) {
                    Log.i("AppCompatDelegate", "Failed to instantiate custom view inflater " + string + ". Falling back to default.", th2);
                    this.f15135t0 = new p();
                }
            }
        }
        p pVar = this.f15135t0;
        int i10 = z1.f24760a;
        pVar.getClass();
        char c10 = 4;
        TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, a1.t.F, 0, 0);
        int resourceId = obtainStyledAttributes.getResourceId(4, 0);
        if (resourceId != 0) {
            Log.i("AppCompatViewInflater", "app:theme is now deprecated. Please move to using android:theme instead.");
        }
        obtainStyledAttributes.recycle();
        Context cVar = (resourceId == 0 || ((context instanceof k.c) && ((k.c) context).f21926a == resourceId)) ? context : new k.c(resourceId, context);
        str.getClass();
        switch (str.hashCode()) {
            case -1946472170:
                if (str.equals("RatingBar")) {
                    c10 = 0;
                    break;
                }
                c10 = 65535;
                break;
            case -1455429095:
                if (str.equals("CheckedTextView")) {
                    c10 = 1;
                    break;
                }
                c10 = 65535;
                break;
            case -1346021293:
                if (str.equals("MultiAutoCompleteTextView")) {
                    c10 = 2;
                    break;
                }
                c10 = 65535;
                break;
            case -938935918:
                if (str.equals("TextView")) {
                    c10 = 3;
                    break;
                }
                c10 = 65535;
                break;
            case -937446323:
                break;
            case -658531749:
                if (str.equals("SeekBar")) {
                    c10 = 5;
                    break;
                }
                c10 = 65535;
                break;
            case -339785223:
                if (str.equals("Spinner")) {
                    c10 = 6;
                    break;
                }
                c10 = 65535;
                break;
            case 776382189:
                if (str.equals("RadioButton")) {
                    c10 = 7;
                    break;
                }
                c10 = 65535;
                break;
            case 799298502:
                if (str.equals("ToggleButton")) {
                    c10 = '\b';
                    break;
                }
                c10 = 65535;
                break;
            case 1125864064:
                if (str.equals("ImageView")) {
                    c10 = '\t';
                    break;
                }
                c10 = 65535;
                break;
            case 1413872058:
                if (str.equals("AutoCompleteTextView")) {
                    c10 = '\n';
                    break;
                }
                c10 = 65535;
                break;
            case 1601505219:
                if (str.equals("CheckBox")) {
                    c10 = 11;
                    break;
                }
                c10 = 65535;
                break;
            case 1666676343:
                if (str.equals("EditText")) {
                    c10 = '\f';
                    break;
                }
                c10 = 65535;
                break;
            case 2001146706:
                if (str.equals("Button")) {
                    c10 = '\r';
                    break;
                }
                c10 = 65535;
                break;
            default:
                c10 = 65535;
                break;
        }
        View view2 = null;
        switch (c10) {
            case 0:
                f0Var = new f0(cVar, attributeSet);
                break;
            case 1:
                f0Var = new m.g(cVar, attributeSet);
                break;
            case 2:
                f0Var = new m.p(cVar, attributeSet);
                break;
            case 3:
                f0Var = new o0(cVar, attributeSet);
                break;
            case 4:
                f0Var = new m.n(cVar, attributeSet, C0909R.attr.imageButtonStyle);
                break;
            case 5:
                f0Var = new i0(cVar, attributeSet);
                break;
            case 6:
                f0Var = new AppCompatSpinner(cVar, attributeSet, C0909R.attr.spinnerStyle);
                break;
            case 7:
                f0Var = new e0(cVar, attributeSet);
                break;
            case '\b':
                f0Var = new s0(cVar, attributeSet);
                break;
            case '\t':
                f0Var = new AppCompatImageView(cVar, attributeSet);
                break;
            case '\n':
                f0Var = new m.c(cVar, attributeSet);
                break;
            case 11:
                f0Var = new m.f(cVar, attributeSet);
                break;
            case HwBuildEx.VersionCodes.EMUI_5_1:
                f0Var = new m.k(cVar, attributeSet);
                break;
            case '\r':
                f0Var = new m.e(cVar, attributeSet);
                break;
            default:
                f0Var = null;
                break;
        }
        if (f0Var == null && context != cVar) {
            if (str.equals("view")) {
                str = attributeSet.getAttributeValue(null, "class");
            }
            try {
                Object[] objArr = pVar.f15188a;
                objArr[0] = cVar;
                objArr[1] = attributeSet;
                if (-1 == str.indexOf(46)) {
                    int i11 = 0;
                    while (true) {
                        String[] strArr = p.f15186g;
                        if (i11 < 3) {
                            View a8 = pVar.a(cVar, str, strArr[i11]);
                            if (a8 != null) {
                                Object[] objArr2 = pVar.f15188a;
                                objArr2[0] = null;
                                objArr2[1] = null;
                                view2 = a8;
                            } else {
                                i11++;
                            }
                        }
                    }
                } else {
                    View a10 = pVar.a(cVar, str, null);
                    Object[] objArr3 = pVar.f15188a;
                    objArr3[0] = null;
                    objArr3[1] = null;
                    view2 = a10;
                }
            } catch (Exception unused) {
            } finally {
                Object[] objArr4 = pVar.f15188a;
                objArr4[0] = null;
                objArr4[1] = null;
            }
            f0Var = view2;
        }
        if (f0Var != null) {
            Context context2 = f0Var.getContext();
            if (context2 instanceof ContextWrapper) {
                WeakHashMap<View, i2> weakHashMap = k0.f17830a;
                if (k0.c.a(f0Var)) {
                    TypedArray obtainStyledAttributes2 = context2.obtainStyledAttributes(attributeSet, p.f15182c);
                    String string2 = obtainStyledAttributes2.getString(0);
                    if (string2 != null) {
                        f0Var.setOnClickListener(new p.a(f0Var, string2));
                    }
                    obtainStyledAttributes2.recycle();
                }
            }
            if (Build.VERSION.SDK_INT <= 28) {
                TypedArray obtainStyledAttributes3 = cVar.obtainStyledAttributes(attributeSet, p.f15183d);
                if (obtainStyledAttributes3.hasValue(0)) {
                    boolean z10 = obtainStyledAttributes3.getBoolean(0, false);
                    WeakHashMap<View, i2> weakHashMap2 = k0.f17830a;
                    new j0().e(f0Var, Boolean.valueOf(z10));
                }
                obtainStyledAttributes3.recycle();
                TypedArray obtainStyledAttributes4 = cVar.obtainStyledAttributes(attributeSet, p.f15184e);
                if (obtainStyledAttributes4.hasValue(0)) {
                    k0.k(f0Var, obtainStyledAttributes4.getString(0));
                }
                obtainStyledAttributes4.recycle();
                TypedArray obtainStyledAttributes5 = cVar.obtainStyledAttributes(attributeSet, p.f15185f);
                if (obtainStyledAttributes5.hasValue(0)) {
                    boolean z11 = obtainStyledAttributes5.getBoolean(0, false);
                    WeakHashMap<View, i2> weakHashMap3 = k0.f17830a;
                    new h0().e(f0Var, Boolean.valueOf(z11));
                }
                obtainStyledAttributes5.recycle();
            }
        }
        return f0Var;
    }

    @Override
    public final boolean q(int i10) {
        if (i10 == 8) {
            Log.i("AppCompatDelegate", "You should now use the AppCompatDelegate.FEATURE_SUPPORT_ACTION_BAR id when requesting this feature.");
            i10 = 108;
        } else if (i10 == 9) {
            Log.i("AppCompatDelegate", "You should now use the AppCompatDelegate.FEATURE_SUPPORT_ACTION_BAR_OVERLAY id when requesting this feature.");
            i10 = 109;
        }
        if (this.Y && i10 == 108) {
            return false;
        }
        if (this.f15141z && i10 == 1) {
            this.f15141z = false;
        }
        if (i10 != 1) {
            if (i10 != 2) {
                if (i10 != 5) {
                    if (i10 != 10) {
                        if (i10 != 108) {
                            if (i10 != 109) {
                                return this.f15106e.requestFeature(i10);
                            }
                            O();
                            this.A = true;
                            return true;
                        }
                        O();
                        this.f15141z = true;
                        return true;
                    }
                    O();
                    this.B = true;
                    return true;
                }
                O();
                this.f15140y = true;
                return true;
            }
            O();
            this.f15139x = true;
            return true;
        }
        O();
        this.Y = true;
        return true;
    }

    @Override
    public final void r(int i10) {
        E();
        ViewGroup viewGroup = (ViewGroup) this.f15136u.findViewById(R.id.content);
        viewGroup.removeAllViews();
        LayoutInflater.from(this.f15104d).inflate(i10, viewGroup);
        this.f15108f.f21986a.onContentChanged();
    }

    @Override
    public final void s(View view) {
        E();
        ViewGroup viewGroup = (ViewGroup) this.f15136u.findViewById(R.id.content);
        viewGroup.removeAllViews();
        viewGroup.addView(view);
        this.f15108f.f21986a.onContentChanged();
    }

    @Override
    public final void t(View view, ViewGroup.LayoutParams layoutParams) {
        E();
        ViewGroup viewGroup = (ViewGroup) this.f15136u.findViewById(R.id.content);
        viewGroup.removeAllViews();
        viewGroup.addView(view, layoutParams);
        this.f15108f.f21986a.onContentChanged();
    }

    @Override
    public final void u(int i10) {
        this.f15115i0 = i10;
    }

    @Override
    public final void v(CharSequence charSequence) {
        this.f15116j = charSequence;
        t0 t0Var = this.f15118k;
        if (t0Var != null) {
            t0Var.setWindowTitle(charSequence);
            return;
        }
        t tVar = this.f15112h;
        if (tVar != null) {
            tVar.f15216e.setWindowTitle(charSequence);
            return;
        }
        TextView textView = this.f15137v;
        if (textView != null) {
            textView.setText(charSequence);
        }
    }

    public final boolean w(boolean z10) {
        boolean z11;
        Configuration configuration;
        int i10;
        int i11;
        boolean z12;
        Object obj;
        Object obj2;
        int i12;
        boolean z13;
        boolean z14 = false;
        if (this.f15109f0) {
            return false;
        }
        int i13 = this.f15113h0;
        if (i13 == -100) {
            i13 = -100;
        }
        Map map = null;
        r4 = null;
        r4 = null;
        Object obj3 = null;
        Object obj4 = null;
        Configuration B = B(this.f15104d, K(i13, this.f15104d), null);
        boolean z15 = true;
        z15 = true;
        z15 = true;
        z15 = true;
        z15 = true;
        z15 = true;
        z15 = true;
        if (!this.f15119k0 && (this.f15102c instanceof Activity)) {
            PackageManager packageManager = this.f15104d.getPackageManager();
            if (packageManager == null) {
                z11 = false;
                configuration = this.f15111g0;
                if (configuration == null) {
                    configuration = this.f15104d.getResources().getConfiguration();
                }
                i10 = configuration.uiMode & 48;
                i11 = B.uiMode & 48;
                if (i10 != i11 && z10 && !z11 && this.f15105d0 && (f15098w0 || this.f15107e0)) {
                    obj2 = this.f15102c;
                    if ((obj2 instanceof Activity) && !((Activity) obj2).isChild()) {
                        Activity activity = (Activity) this.f15102c;
                        int i14 = v3.b.f34809c;
                        if (Build.VERSION.SDK_INT < 28) {
                            activity.recreate();
                        } else {
                            new Handler(activity.getMainLooper()).post(new u.u0(z15 ? 1 : 0, activity));
                        }
                        z12 = true;
                        if (z12 && i10 != i11) {
                            Resources resources = this.f15104d.getResources();
                            Configuration configuration2 = new Configuration(resources.getConfiguration());
                            configuration2.uiMode = i11 | (resources.getConfiguration().uiMode & (-49));
                            resources.updateConfiguration(configuration2, null);
                            int i15 = Build.VERSION.SDK_INT;
                            if (i15 < 26 && i15 < 28) {
                                if (i15 >= 24) {
                                    if (!q.f15200h) {
                                        try {
                                            Field declaredField = Resources.class.getDeclaredField("mResourcesImpl");
                                            q.f15199g = declaredField;
                                            declaredField.setAccessible(true);
                                        } catch (NoSuchFieldException e10) {
                                            Log.e("ResourcesFlusher", "Could not retrieve Resources#mResourcesImpl field", e10);
                                        }
                                        q.f15200h = true;
                                    }
                                    Field field = q.f15199g;
                                    if (field != null) {
                                        try {
                                            obj = field.get(resources);
                                        } catch (IllegalAccessException e11) {
                                            Log.e("ResourcesFlusher", "Could not retrieve value from Resources#mResourcesImpl", e11);
                                            obj = null;
                                        }
                                        if (obj != null) {
                                            if (!q.f15194b) {
                                                try {
                                                    Field declaredField2 = obj.getClass().getDeclaredField("mDrawableCache");
                                                    q.f15193a = declaredField2;
                                                    declaredField2.setAccessible(true);
                                                } catch (NoSuchFieldException e12) {
                                                    Log.e("ResourcesFlusher", "Could not retrieve ResourcesImpl#mDrawableCache field", e12);
                                                }
                                                q.f15194b = true;
                                            }
                                            Field field2 = q.f15193a;
                                            if (field2 != null) {
                                                try {
                                                    obj3 = field2.get(obj);
                                                } catch (IllegalAccessException e13) {
                                                    Log.e("ResourcesFlusher", "Could not retrieve value from ResourcesImpl#mDrawableCache", e13);
                                                }
                                            }
                                            if (obj3 != null) {
                                                q.a(obj3);
                                            }
                                        }
                                    }
                                } else if (i15 >= 23) {
                                    if (!q.f15194b) {
                                        try {
                                            Field declaredField3 = Resources.class.getDeclaredField("mDrawableCache");
                                            q.f15193a = declaredField3;
                                            declaredField3.setAccessible(true);
                                        } catch (NoSuchFieldException e14) {
                                            Log.e("ResourcesFlusher", "Could not retrieve Resources#mDrawableCache field", e14);
                                        }
                                        q.f15194b = true;
                                    }
                                    Field field3 = q.f15193a;
                                    if (field3 != null) {
                                        try {
                                            obj4 = field3.get(resources);
                                        } catch (IllegalAccessException e15) {
                                            Log.e("ResourcesFlusher", "Could not retrieve value from Resources#mDrawableCache", e15);
                                        }
                                    }
                                    if (obj4 != null) {
                                        q.a(obj4);
                                    }
                                } else {
                                    if (!q.f15194b) {
                                        try {
                                            Field declaredField4 = Resources.class.getDeclaredField("mDrawableCache");
                                            q.f15193a = declaredField4;
                                            declaredField4.setAccessible(true);
                                        } catch (NoSuchFieldException e16) {
                                            Log.e("ResourcesFlusher", "Could not retrieve Resources#mDrawableCache field", e16);
                                        }
                                        q.f15194b = true;
                                    }
                                    Field field4 = q.f15193a;
                                    if (field4 != null) {
                                        try {
                                            map = (Map) field4.get(resources);
                                        } catch (IllegalAccessException e17) {
                                            Log.e("ResourcesFlusher", "Could not retrieve value from Resources#mDrawableCache", e17);
                                        }
                                        if (map != null) {
                                            map.clear();
                                        }
                                    }
                                }
                            }
                            int i16 = this.f15115i0;
                            if (i16 != 0) {
                                this.f15104d.setTheme(i16);
                                if (Build.VERSION.SDK_INT >= 23) {
                                    this.f15104d.getTheme().applyStyle(this.f15115i0, true);
                                }
                            }
                            if (z11) {
                                Object obj5 = this.f15102c;
                                if (obj5 instanceof Activity) {
                                    Activity activity2 = (Activity) obj5;
                                    if (activity2 instanceof androidx.lifecycle.q) {
                                        if (((androidx.lifecycle.q) activity2).a().b().compareTo(l.b.CREATED) >= 0) {
                                            z14 = true;
                                        }
                                        if (z14) {
                                            activity2.onConfigurationChanged(configuration2);
                                        }
                                    } else if (this.f15107e0 && !this.f15109f0) {
                                        activity2.onConfigurationChanged(configuration2);
                                    }
                                }
                            }
                        } else {
                            z15 = z12;
                        }
                        if (z15) {
                            Object obj6 = this.f15102c;
                            if (obj6 instanceof g.g) {
                                ((g.g) obj6).getClass();
                            }
                        }
                        if (i13 != 0) {
                            G(this.f15104d).e();
                        } else {
                            i iVar = this.f15121l0;
                            if (iVar != null) {
                                iVar.a();
                            }
                        }
                        if (i13 != 3) {
                            Context context = this.f15104d;
                            if (this.f15123m0 == null) {
                                this.f15123m0 = new g(context);
                            }
                            this.f15123m0.e();
                        } else {
                            g gVar = this.f15123m0;
                            if (gVar != null) {
                                gVar.a();
                            }
                        }
                        return z15;
                    }
                }
                z12 = false;
                if (z12) {
                }
                z15 = z12;
                if (z15) {
                }
                if (i13 != 0) {
                }
                if (i13 != 3) {
                }
                return z15;
            }
            try {
                int i17 = Build.VERSION.SDK_INT;
                if (i17 >= 29) {
                    i12 = 269221888;
                } else if (i17 >= 24) {
                    i12 = 786432;
                } else {
                    i12 = 0;
                }
                ActivityInfo activityInfo = packageManager.getActivityInfo(new ComponentName(this.f15104d, this.f15102c.getClass()), i12);
                if (activityInfo != null && (activityInfo.configChanges & 512) != 0) {
                    z13 = true;
                } else {
                    z13 = false;
                }
                this.f15117j0 = z13;
            } catch (PackageManager.NameNotFoundException e18) {
                Log.d("AppCompatDelegate", "Exception while getting ActivityInfo", e18);
                this.f15117j0 = false;
            }
        }
        this.f15119k0 = true;
        z11 = this.f15117j0;
        configuration = this.f15111g0;
        if (configuration == null) {
        }
        i10 = configuration.uiMode & 48;
        i11 = B.uiMode & 48;
        if (i10 != i11) {
            obj2 = this.f15102c;
            if (obj2 instanceof Activity) {
                Activity activity3 = (Activity) this.f15102c;
                int i142 = v3.b.f34809c;
                if (Build.VERSION.SDK_INT < 28) {
                }
                z12 = true;
                if (z12) {
                }
                z15 = z12;
                if (z15) {
                }
                if (i13 != 0) {
                }
                if (i13 != 3) {
                }
                return z15;
            }
        }
        z12 = false;
        if (z12) {
        }
        z15 = z12;
        if (z15) {
        }
        if (i13 != 0) {
        }
        if (i13 != 3) {
        }
        return z15;
    }

    public final void x(Window window) {
        int resourceId;
        Drawable g10;
        if (this.f15106e == null) {
            Window.Callback callback = window.getCallback();
            if (!(callback instanceof f)) {
                f fVar = new f(callback);
                this.f15108f = fVar;
                window.setCallback(fVar);
                Context context = this.f15104d;
                Drawable drawable = null;
                TypedArray obtainStyledAttributes = context.obtainStyledAttributes((AttributeSet) null, f15097v0);
                if (obtainStyledAttributes.hasValue(0) && (resourceId = obtainStyledAttributes.getResourceId(0, 0)) != 0) {
                    m.j a8 = m.j.a();
                    synchronized (a8) {
                        g10 = a8.f24587a.g(context, resourceId, true);
                    }
                    drawable = g10;
                }
                if (drawable != null) {
                    window.setBackgroundDrawable(drawable);
                }
                obtainStyledAttributes.recycle();
                this.f15106e = window;
                return;
            }
            throw new IllegalStateException("AppCompat has already installed itself into the Window");
        }
        throw new IllegalStateException("AppCompat has already installed itself into the Window");
    }

    public final void y(int i10, k kVar, androidx.appcompat.view.menu.f fVar) {
        if (fVar == null) {
            if (kVar == null && i10 >= 0) {
                k[] kVarArr = this.f15100a0;
                if (i10 < kVarArr.length) {
                    kVar = kVarArr[i10];
                }
            }
            if (kVar != null) {
                fVar = kVar.f15163h;
            }
        }
        if ((kVar == null || kVar.f15168m) && !this.f15109f0) {
            this.f15108f.f21986a.onPanelClosed(i10, fVar);
        }
    }

    public final void z(androidx.appcompat.view.menu.f fVar) {
        if (this.Z) {
            return;
        }
        this.Z = true;
        this.f15118k.i();
        Window.Callback I = I();
        if (I != null && !this.f15109f0) {
            I.onPanelClosed(108, fVar);
        }
        this.Z = false;
    }

    public class f extends k.k {
        public f(Window.Callback callback) {
            super(callback);
        }

        public final k.e a(ActionMode.Callback callback) {
            g.h hVar;
            Context context;
            Context context2;
            g.h hVar2;
            e.a aVar = new e.a(j.this.f15104d, callback);
            j jVar = j.this;
            k.a aVar2 = jVar.f15124n;
            if (aVar2 != null) {
                aVar2.c();
            }
            c cVar = new c(aVar);
            jVar.J();
            t tVar = jVar.f15112h;
            boolean z10 = true;
            if (tVar != null) {
                t.d dVar = tVar.f15220i;
                if (dVar != null) {
                    dVar.c();
                }
                tVar.f15214c.setHideOnContentScrollEnabled(false);
                tVar.f15217f.h();
                t.d dVar2 = new t.d(tVar.f15217f.getContext(), cVar);
                dVar2.f15240d.w();
                try {
                    if (dVar2.f15241e.c(dVar2, dVar2.f15240d)) {
                        tVar.f15220i = dVar2;
                        dVar2.i();
                        tVar.f15217f.f(dVar2);
                        tVar.a(true);
                    } else {
                        dVar2 = null;
                    }
                    jVar.f15124n = dVar2;
                    if (dVar2 != null && (hVar2 = jVar.f15110g) != null) {
                        hVar2.w();
                    }
                } finally {
                    dVar2.f15240d.v();
                }
            }
            if (jVar.f15124n == null) {
                i2 i2Var = jVar.f15130r;
                if (i2Var != null) {
                    i2Var.b();
                }
                k.a aVar3 = jVar.f15124n;
                if (aVar3 != null) {
                    aVar3.c();
                }
                g.h hVar3 = jVar.f15110g;
                if (hVar3 != null && !jVar.f15109f0) {
                    try {
                        hVar3.n();
                    } catch (AbstractMethodError unused) {
                    }
                }
                if (jVar.f15126o == null) {
                    if (jVar.X) {
                        TypedValue typedValue = new TypedValue();
                        Resources.Theme theme = jVar.f15104d.getTheme();
                        theme.resolveAttribute(C0909R.attr.actionBarTheme, typedValue, true);
                        if (typedValue.resourceId != 0) {
                            Resources.Theme newTheme = jVar.f15104d.getResources().newTheme();
                            newTheme.setTo(theme);
                            newTheme.applyStyle(typedValue.resourceId, true);
                            context2 = new k.c(0, jVar.f15104d);
                            context2.getTheme().setTo(newTheme);
                        } else {
                            context2 = jVar.f15104d;
                        }
                        jVar.f15126o = new ActionBarContextView(context2, null);
                        PopupWindow popupWindow = new PopupWindow(context2, (AttributeSet) null, C0909R.attr.actionModePopupWindowStyle);
                        jVar.f15128p = popupWindow;
                        n4.i.b(popupWindow, 2);
                        jVar.f15128p.setContentView(jVar.f15126o);
                        jVar.f15128p.setWidth(-1);
                        context2.getTheme().resolveAttribute(C0909R.attr.actionBarSize, typedValue, true);
                        jVar.f15126o.setContentHeight(TypedValue.complexToDimensionPixelSize(typedValue.data, context2.getResources().getDisplayMetrics()));
                        jVar.f15128p.setHeight(-2);
                        jVar.q = new m(jVar);
                    } else {
                        ViewStubCompat viewStubCompat = (ViewStubCompat) jVar.f15136u.findViewById(C0909R.id.action_mode_bar_stub);
                        if (viewStubCompat != null) {
                            jVar.J();
                            t tVar2 = jVar.f15112h;
                            if (tVar2 != null) {
                                context = tVar2.c();
                            } else {
                                context = null;
                            }
                            if (context == null) {
                                context = jVar.f15104d;
                            }
                            viewStubCompat.setLayoutInflater(LayoutInflater.from(context));
                            jVar.f15126o = (ActionBarContextView) viewStubCompat.a();
                        }
                    }
                }
                if (jVar.f15126o != null) {
                    i2 i2Var2 = jVar.f15130r;
                    if (i2Var2 != null) {
                        i2Var2.b();
                    }
                    jVar.f15126o.h();
                    k.d dVar3 = new k.d(jVar.f15126o.getContext(), jVar.f15126o, cVar);
                    if (cVar.c(dVar3, dVar3.f21936h)) {
                        dVar3.i();
                        jVar.f15126o.f(dVar3);
                        jVar.f15124n = dVar3;
                        if (jVar.f15134t && (r1 = jVar.f15136u) != null) {
                            WeakHashMap<View, i2> weakHashMap = k0.f17830a;
                        }
                        z10 = false;
                        if (z10) {
                            jVar.f15126o.setAlpha(0.0f);
                            i2 a8 = k0.a(jVar.f15126o);
                            a8.a(1.0f);
                            jVar.f15130r = a8;
                            a8.d(new n(jVar));
                        } else {
                            jVar.f15126o.setAlpha(1.0f);
                            jVar.f15126o.setVisibility(0);
                            if (jVar.f15126o.getParent() instanceof View) {
                                View view = (View) jVar.f15126o.getParent();
                                WeakHashMap<View, i2> weakHashMap2 = k0.f17830a;
                                k0.g.c(view);
                            }
                        }
                        if (jVar.f15128p != null) {
                            jVar.f15106e.getDecorView().post(jVar.q);
                        }
                    } else {
                        jVar.f15124n = null;
                    }
                }
                if (jVar.f15124n != null && (hVar = jVar.f15110g) != null) {
                    hVar.w();
                }
                jVar.f15124n = jVar.f15124n;
            }
            k.a aVar4 = jVar.f15124n;
            if (aVar4 == null) {
                return null;
            }
            return aVar.e(aVar4);
        }

        @Override
        public final boolean dispatchKeyEvent(KeyEvent keyEvent) {
            if (!j.this.C(keyEvent) && !super.dispatchKeyEvent(keyEvent)) {
                return false;
            }
            return true;
        }

        @Override
        public final boolean dispatchKeyShortcutEvent(KeyEvent keyEvent) {
            boolean z10;
            boolean z11;
            androidx.appcompat.view.menu.f fVar;
            boolean z12;
            if (super.dispatchKeyShortcutEvent(keyEvent)) {
                return true;
            }
            j jVar = j.this;
            int keyCode = keyEvent.getKeyCode();
            jVar.J();
            t tVar = jVar.f15112h;
            if (tVar != null) {
                t.d dVar = tVar.f15220i;
                if (dVar != null && (fVar = dVar.f15240d) != null) {
                    if (KeyCharacterMap.load(keyEvent.getDeviceId()).getKeyboardType() != 1) {
                        z12 = true;
                    } else {
                        z12 = false;
                    }
                    fVar.setQwertyMode(z12);
                    z11 = fVar.performShortcut(keyCode, keyEvent, 0);
                } else {
                    z11 = false;
                }
            }
            k kVar = jVar.f15101b0;
            if (kVar != null && jVar.M(kVar, keyEvent.getKeyCode(), keyEvent)) {
                k kVar2 = jVar.f15101b0;
                if (kVar2 != null) {
                    kVar2.f15167l = true;
                }
            } else {
                if (jVar.f15101b0 == null) {
                    k H = jVar.H(0);
                    jVar.N(H, keyEvent);
                    boolean M = jVar.M(H, keyEvent.getKeyCode(), keyEvent);
                    H.f15166k = false;
                }
                z10 = false;
                if (!z10) {
                    return true;
                }
                return false;
            }
            z10 = true;
            if (!z10) {
            }
        }

        @Override
        public final void onContentChanged() {
        }

        @Override
        public final boolean onCreatePanelMenu(int i10, Menu menu) {
            if (i10 == 0 && !(menu instanceof androidx.appcompat.view.menu.f)) {
                return false;
            }
            return super.onCreatePanelMenu(i10, menu);
        }

        @Override
        public final View onCreatePanelView(int i10) {
            return super.onCreatePanelView(i10);
        }

        @Override
        public final boolean onMenuOpened(int i10, Menu menu) {
            super.onMenuOpened(i10, menu);
            j jVar = j.this;
            if (i10 == 108) {
                jVar.J();
                t tVar = jVar.f15112h;
                if (tVar != null) {
                    tVar.b(true);
                }
            } else {
                jVar.getClass();
            }
            return true;
        }

        @Override
        public final void onPanelClosed(int i10, Menu menu) {
            super.onPanelClosed(i10, menu);
            j jVar = j.this;
            if (i10 == 108) {
                jVar.J();
                t tVar = jVar.f15112h;
                if (tVar != null) {
                    tVar.b(false);
                    return;
                }
                return;
            }
            if (i10 == 0) {
                k H = jVar.H(i10);
                if (H.f15168m) {
                    jVar.A(H, false);
                    return;
                }
                return;
            }
            jVar.getClass();
        }

        @Override
        public final boolean onPreparePanel(int i10, View view, Menu menu) {
            androidx.appcompat.view.menu.f fVar;
            if (menu instanceof androidx.appcompat.view.menu.f) {
                fVar = (androidx.appcompat.view.menu.f) menu;
            } else {
                fVar = null;
            }
            if (i10 == 0 && fVar == null) {
                return false;
            }
            if (fVar != null) {
                fVar.f1114x = true;
            }
            boolean onPreparePanel = super.onPreparePanel(i10, view, menu);
            if (fVar != null) {
                fVar.f1114x = false;
            }
            return onPreparePanel;
        }

        @Override
        public final void onProvideKeyboardShortcuts(List<KeyboardShortcutGroup> list, Menu menu, int i10) {
            androidx.appcompat.view.menu.f fVar = j.this.H(0).f15163h;
            if (fVar != null) {
                super.onProvideKeyboardShortcuts(list, fVar, i10);
            } else {
                super.onProvideKeyboardShortcuts(list, menu, i10);
            }
        }

        @Override
        public final ActionMode onWindowStartingActionMode(ActionMode.Callback callback) {
            if (Build.VERSION.SDK_INT >= 23) {
                return null;
            }
            if (j.this.f15132s) {
                return a(callback);
            }
            return super.onWindowStartingActionMode(callback);
        }

        @Override
        public final ActionMode onWindowStartingActionMode(ActionMode.Callback callback, int i10) {
            if (j.this.f15132s && i10 == 0) {
                return a(callback);
            }
            return super.onWindowStartingActionMode(callback, i10);
        }
    }

    @Override
    public final View onCreateView(String str, Context context, AttributeSet attributeSet) {
        return onCreateView(null, str, context, attributeSet);
    }
}