Files
rr3-apk/decompiled-community/sources/androidx/fragment/app/FragmentLayoutInflaterFactory.java
Daniel Elliott c080f0d97f Add Discord community version (64-bit only)
- Added realracing3-community.apk (71.57 MB)
- Removed 32-bit support (armeabi-v7a)
- Only includes arm64-v8a libraries
- Decompiled source code included
- Added README-community.md with analysis
2026-02-18 15:48:36 -08:00

128 lines
6.7 KiB
Java

package androidx.fragment.app;
import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.R;
import androidx.fragment.app.strictmode.FragmentStrictMode;
/* loaded from: classes.dex */
class FragmentLayoutInflaterFactory implements LayoutInflater.Factory2 {
private static final String TAG = "FragmentManager";
final FragmentManager mFragmentManager;
public FragmentLayoutInflaterFactory(FragmentManager fragmentManager) {
this.mFragmentManager = fragmentManager;
}
@Override // android.view.LayoutInflater.Factory
@Nullable
public View onCreateView(@NonNull String str, @NonNull Context context, @NonNull AttributeSet attributeSet) {
return onCreateView(null, str, context, attributeSet);
}
@Override // android.view.LayoutInflater.Factory2
@Nullable
public View onCreateView(@Nullable View view, @NonNull String str, @NonNull Context context, @NonNull AttributeSet attributeSet) {
final FragmentStateManager createOrGetFragmentStateManager;
if (FragmentContainerView.class.getName().equals(str)) {
return new FragmentContainerView(context, attributeSet, this.mFragmentManager);
}
if (!"fragment".equals(str)) {
return null;
}
String attributeValue = attributeSet.getAttributeValue(null, "class");
TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, R.styleable.Fragment);
if (attributeValue == null) {
attributeValue = obtainStyledAttributes.getString(R.styleable.Fragment_android_name);
}
int resourceId = obtainStyledAttributes.getResourceId(R.styleable.Fragment_android_id, -1);
String string = obtainStyledAttributes.getString(R.styleable.Fragment_android_tag);
obtainStyledAttributes.recycle();
if (attributeValue == null || !FragmentFactory.isFragmentClass(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 findFragmentById = resourceId != -1 ? this.mFragmentManager.findFragmentById(resourceId) : null;
if (findFragmentById == null && string != null) {
findFragmentById = this.mFragmentManager.findFragmentByTag(string);
}
if (findFragmentById == null && id != -1) {
findFragmentById = this.mFragmentManager.findFragmentById(id);
}
if (findFragmentById == null) {
findFragmentById = this.mFragmentManager.getFragmentFactory().instantiate(context.getClassLoader(), attributeValue);
findFragmentById.mFromLayout = true;
findFragmentById.mFragmentId = resourceId != 0 ? resourceId : id;
findFragmentById.mContainerId = id;
findFragmentById.mTag = string;
findFragmentById.mInLayout = true;
FragmentManager fragmentManager = this.mFragmentManager;
findFragmentById.mFragmentManager = fragmentManager;
findFragmentById.mHost = fragmentManager.getHost();
findFragmentById.onInflate(this.mFragmentManager.getHost().getContext(), attributeSet, findFragmentById.mSavedFragmentState);
createOrGetFragmentStateManager = this.mFragmentManager.addFragment(findFragmentById);
if (FragmentManager.isLoggingEnabled(2)) {
StringBuilder sb = new StringBuilder();
sb.append("Fragment ");
sb.append(findFragmentById);
sb.append(" has been inflated via the <fragment> tag: id=0x");
sb.append(Integer.toHexString(resourceId));
}
} else {
if (findFragmentById.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);
}
findFragmentById.mInLayout = true;
FragmentManager fragmentManager2 = this.mFragmentManager;
findFragmentById.mFragmentManager = fragmentManager2;
findFragmentById.mHost = fragmentManager2.getHost();
findFragmentById.onInflate(this.mFragmentManager.getHost().getContext(), attributeSet, findFragmentById.mSavedFragmentState);
createOrGetFragmentStateManager = this.mFragmentManager.createOrGetFragmentStateManager(findFragmentById);
if (FragmentManager.isLoggingEnabled(2)) {
StringBuilder sb2 = new StringBuilder();
sb2.append("Retained Fragment ");
sb2.append(findFragmentById);
sb2.append(" has been re-attached via the <fragment> tag: id=0x");
sb2.append(Integer.toHexString(resourceId));
}
}
ViewGroup viewGroup = (ViewGroup) view;
FragmentStrictMode.onFragmentTagUsage(findFragmentById, viewGroup);
findFragmentById.mContainer = viewGroup;
createOrGetFragmentStateManager.moveToExpectedState();
createOrGetFragmentStateManager.ensureInflatedView();
View view2 = findFragmentById.mView;
if (view2 == null) {
throw new IllegalStateException("Fragment " + attributeValue + " did not create a view.");
}
if (resourceId != 0) {
view2.setId(resourceId);
}
if (findFragmentById.mView.getTag() == null) {
findFragmentById.mView.setTag(string);
}
findFragmentById.mView.addOnAttachStateChangeListener(new View.OnAttachStateChangeListener() { // from class: androidx.fragment.app.FragmentLayoutInflaterFactory.1
@Override // android.view.View.OnAttachStateChangeListener
public void onViewDetachedFromWindow(View view3) {
}
@Override // android.view.View.OnAttachStateChangeListener
public void onViewAttachedToWindow(View view3) {
Fragment fragment = createOrGetFragmentStateManager.getFragment();
createOrGetFragmentStateManager.moveToExpectedState();
SpecialEffectsController.getOrCreateController((ViewGroup) fragment.mView.getParent(), FragmentLayoutInflaterFactory.this.mFragmentManager).forceCompleteAllOperations();
}
});
return findFragmentById.mView;
}
}