package p037.p089.p090;

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 androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentContainerView;
import p037.p089.C1987;
import p138.p139.p143.p144.C2803;

/* JADX INFO: renamed from: މ.ވ.ށ.ލ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes.dex */
public class LayoutInflaterFactory2C2011 implements LayoutInflater.Factory2 {

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

    public LayoutInflaterFactory2C2011(AbstractC2014 abstractC2014) {
        this.f6598 = abstractC2014;
    }

    @Override // android.view.LayoutInflater.Factory2
    public View onCreateView(View view, String str, Context context, AttributeSet attributeSet) {
        C2039 c2039M3938;
        if (FragmentContainerView.class.getName().equals(str)) {
            return new FragmentContainerView(context, attributeSet, this.f6598);
        }
        if (!"fragment".equals(str)) {
            return null;
        }
        String attributeValue = attributeSet.getAttributeValue(null, "class");
        TypedArray typedArrayObtainStyledAttributes = context.obtainStyledAttributes(attributeSet, C1987.Fragment);
        if (attributeValue == null) {
            attributeValue = typedArrayObtainStyledAttributes.getString(C1987.Fragment_android_name);
        }
        int resourceId = typedArrayObtainStyledAttributes.getResourceId(C1987.Fragment_android_id, -1);
        String string = typedArrayObtainStyledAttributes.getString(C1987.Fragment_android_tag);
        typedArrayObtainStyledAttributes.recycle();
        if (attributeValue == null || !C2009.m3881(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 fragmentM3924 = resourceId != -1 ? this.f6598.m3924(resourceId) : null;
        if (fragmentM3924 == null && string != null) {
            fragmentM3924 = this.f6598.m3925(string);
        }
        if (fragmentM3924 == null && id != -1) {
            fragmentM3924 = this.f6598.m3924(id);
        }
        if (AbstractC2014.m3899(2)) {
            StringBuilder sbM4889 = C2803.m4889("onCreateView: id=0x");
            sbM4889.append(Integer.toHexString(resourceId));
            sbM4889.append(" fname=");
            sbM4889.append(attributeValue);
            sbM4889.append(" existing=");
            sbM4889.append(fragmentM3924);
            Log.v("FragmentManager", sbM4889.toString());
        }
        if (fragmentM3924 == null) {
            fragmentM3924 = this.f6598.m3948().mo3884(context.getClassLoader(), attributeValue);
            fragmentM3924.mFromLayout = true;
            fragmentM3924.mFragmentId = resourceId != 0 ? resourceId : id;
            fragmentM3924.mContainerId = id;
            fragmentM3924.mTag = string;
            fragmentM3924.mInLayout = true;
            AbstractC2014 abstractC2014 = this.f6598;
            fragmentM3924.mFragmentManager = abstractC2014;
            AbstractC2010<?> abstractC2010 = abstractC2014.f6618;
            fragmentM3924.mHost = abstractC2010;
            Context context2 = abstractC2010.f6595;
            fragmentM3924.onInflate(attributeSet, fragmentM3924.mSavedFragmentState);
            c2039M3938 = this.f6598.m3938(fragmentM3924);
            this.f6598.m3908(fragmentM3924);
        } else {
            if (fragmentM3924.mInLayout) {
                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);
            }
            fragmentM3924.mInLayout = true;
            AbstractC2014 abstractC20142 = this.f6598;
            fragmentM3924.mFragmentManager = abstractC20142;
            AbstractC2010<?> abstractC20102 = abstractC20142.f6618;
            fragmentM3924.mHost = abstractC20102;
            Context context3 = abstractC20102.f6595;
            fragmentM3924.onInflate(attributeSet, fragmentM3924.mSavedFragmentState);
            c2039M3938 = this.f6598.m3938(fragmentM3924);
        }
        c2039M3938.m3984();
        c2039M3938.m3983();
        View view2 = fragmentM3924.mView;
        if (view2 == null) {
            throw new IllegalStateException(C2803.m4880("Fragment ", attributeValue, " did not create a view."));
        }
        if (resourceId != 0) {
            view2.setId(resourceId);
        }
        if (fragmentM3924.mView.getTag() == null) {
            fragmentM3924.mView.setTag(string);
        }
        return fragmentM3924.mView;
    }

    @Override // android.view.LayoutInflater.Factory
    public View onCreateView(String str, Context context, AttributeSet attributeSet) {
        return onCreateView(null, str, context, attributeSet);
    }
}
