package androidx.fragment.app; import android.content.Context; import android.content.res.TypedArray; import android.util.AttributeSet; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import p047p0.C1536c; /* renamed from: androidx.fragment.app.k */ /* loaded from: classes.dex */ public class LayoutInflater$Factory2C0319k implements LayoutInflater.Factory2 { /* renamed from: d */ public final AbstractC0330m f1332d; /* renamed from: androidx.fragment.app.k$a */ /* loaded from: classes.dex */ public class View$OnAttachStateChangeListenerC0320a implements View.OnAttachStateChangeListener { /* renamed from: d */ public final /* synthetic */ C0372s f1333d; public View$OnAttachStateChangeListenerC0320a(C0372s c0372s) { this.f1333d = c0372s; } @Override // android.view.View.OnAttachStateChangeListener public void onViewAttachedToWindow(View view) { Fragment m3829k = this.f1333d.m3829k(); this.f1333d.m3827m(); AbstractC0360q0.m3862n((ViewGroup) m3829k.f1162K.getParent(), LayoutInflater$Factory2C0319k.this.f1332d).m3866j(); } @Override // android.view.View.OnAttachStateChangeListener public void onViewDetachedFromWindow(View view) { } } public LayoutInflater$Factory2C0319k(AbstractC0330m abstractC0330m) { this.f1332d = abstractC0330m; } /* JADX WARN: Removed duplicated region for block: B:51:0x014b */ /* JADX WARN: Removed duplicated region for block: B:58:0x016a */ @Override // android.view.LayoutInflater.Factory2 /* Code decompiled incorrectly, please refer to instructions dump. */ public View onCreateView(View view, String str, Context context, AttributeSet attributeSet) { C0372s m3954t; StringBuilder sb; String str2; View view2; if (C0311g.class.getName().equals(str)) { return new C0311g(context, attributeSet, this.f1332d); } if (!"fragment".equals(str)) { return null; } String attributeValue = attributeSet.getAttributeValue(null, "class"); TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, C1536c.f3413d); if (attributeValue == null) { attributeValue = obtainStyledAttributes.getString(C1536c.f3414e); } int resourceId = obtainStyledAttributes.getResourceId(C1536c.f3415f, -1); String string = obtainStyledAttributes.getString(C1536c.f3416g); obtainStyledAttributes.recycle(); if (attributeValue == null || !C0315i.m4082b(context.getClassLoader(), attributeValue)) { return null; } int id = view != null ? view.getId() : 0; if (id == -1 && resourceId == -1 && string == null) { throw new IllegalArgumentException(attributeSet.getPositionDescription() + ": Must specify unique android:id, android:tag, or have a parent with an id for " + attributeValue); } Fragment m3990d0 = resourceId != -1 ? this.f1332d.m3990d0(resourceId) : null; if (m3990d0 == null && string != null) { m3990d0 = this.f1332d.m3987e0(string); } if (m3990d0 == null && id != -1) { m3990d0 = this.f1332d.m3990d0(id); } if (m3990d0 == null) { m3990d0 = this.f1332d.m3967m0().mo3937a(context.getClassLoader(), attributeValue); m3990d0.f1194q = true; m3990d0.f1203z = resourceId != 0 ? resourceId : id; m3990d0.f1152A = id; m3990d0.f1153B = string; m3990d0.f1195r = true; AbstractC0330m abstractC0330m = this.f1332d; m3990d0.f1199v = abstractC0330m; m3990d0.f1200w = abstractC0330m.m3961p0(); m3990d0.m4182u0(this.f1332d.m3961p0().m4075k(), attributeSet, m3990d0.f1182e); m3954t = this.f1332d.m3982g(m3990d0); if (AbstractC0330m.m4049B0(2)) { sb = new StringBuilder(); sb.append("Fragment "); sb.append(m3990d0); str2 = " has been inflated via the tag: id=0x"; sb.append(str2); sb.append(Integer.toHexString(resourceId)); Log.v("FragmentManager", sb.toString()); } m3990d0.f1161J = (ViewGroup) view; m3954t.m3827m(); m3954t.m3830j(); view2 = m3990d0.f1162K; if (view2 != null) { throw new IllegalStateException("Fragment " + attributeValue + " did not create a view."); } if (resourceId != 0) { view2.setId(resourceId); } if (m3990d0.f1162K.getTag() == null) { m3990d0.f1162K.setTag(string); } m3990d0.f1162K.addOnAttachStateChangeListener(new View$OnAttachStateChangeListenerC0320a(m3954t)); return m3990d0.f1162K; } else if (m3990d0.f1195r) { throw new IllegalArgumentException(attributeSet.getPositionDescription() + ": Duplicate id 0x" + Integer.toHexString(resourceId) + ", tag " + string + ", or parent id 0x" + Integer.toHexString(id) + " with another fragment for " + attributeValue); } else { m3990d0.f1195r = true; AbstractC0330m abstractC0330m2 = this.f1332d; m3990d0.f1199v = abstractC0330m2; m3990d0.f1200w = abstractC0330m2.m3961p0(); m3990d0.m4182u0(this.f1332d.m3961p0().m4075k(), attributeSet, m3990d0.f1182e); m3954t = this.f1332d.m3954t(m3990d0); if (AbstractC0330m.m4049B0(2)) { sb = new StringBuilder(); sb.append("Retained Fragment "); sb.append(m3990d0); str2 = " has been re-attached via the tag: id=0x"; sb.append(str2); sb.append(Integer.toHexString(resourceId)); Log.v("FragmentManager", sb.toString()); } m3990d0.f1161J = (ViewGroup) view; m3954t.m3827m(); m3954t.m3830j(); view2 = m3990d0.f1162K; if (view2 != null) { } } } @Override // android.view.LayoutInflater.Factory public View onCreateView(String str, Context context, AttributeSet attributeSet) { return onCreateView(null, str, context, attributeSet); } }