Rabbit-R1/switch port/java/sources/androidx/fragment/app/FragmentState.java
2024-05-21 17:08:36 -04:00

158 lines
5.9 KiB
Java

package androidx.fragment.app;
import android.os.Parcel;
import android.os.Parcelable;
import androidx.lifecycle.Lifecycle;
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes2.dex */
public final class FragmentState implements Parcelable {
public static final Parcelable.Creator<FragmentState> CREATOR = new Parcelable.Creator<FragmentState>() { // from class: androidx.fragment.app.FragmentState.1
/* JADX WARN: Can't rename method to resolve collision */
@Override // android.os.Parcelable.Creator
public FragmentState createFromParcel(Parcel parcel) {
return new FragmentState(parcel);
}
/* JADX WARN: Can't rename method to resolve collision */
@Override // android.os.Parcelable.Creator
public FragmentState[] newArray(int i) {
return new FragmentState[i];
}
};
final String mClassName;
final int mContainerId;
final boolean mDetached;
final int mFragmentId;
final boolean mFromLayout;
final boolean mHidden;
final int mMaxLifecycleState;
final boolean mRemoving;
final boolean mRetainInstance;
final String mTag;
final int mTargetRequestCode;
final String mTargetWho;
final boolean mUserVisibleHint;
final String mWho;
@Override // android.os.Parcelable
public int describeContents() {
return 0;
}
/* JADX INFO: Access modifiers changed from: package-private */
public FragmentState(Fragment fragment) {
this.mClassName = fragment.getClass().getName();
this.mWho = fragment.mWho;
this.mFromLayout = fragment.mFromLayout;
this.mFragmentId = fragment.mFragmentId;
this.mContainerId = fragment.mContainerId;
this.mTag = fragment.mTag;
this.mRetainInstance = fragment.mRetainInstance;
this.mRemoving = fragment.mRemoving;
this.mDetached = fragment.mDetached;
this.mHidden = fragment.mHidden;
this.mMaxLifecycleState = fragment.mMaxState.ordinal();
this.mTargetWho = fragment.mTargetWho;
this.mTargetRequestCode = fragment.mTargetRequestCode;
this.mUserVisibleHint = fragment.mUserVisibleHint;
}
FragmentState(Parcel parcel) {
this.mClassName = parcel.readString();
this.mWho = parcel.readString();
this.mFromLayout = parcel.readInt() != 0;
this.mFragmentId = parcel.readInt();
this.mContainerId = parcel.readInt();
this.mTag = parcel.readString();
this.mRetainInstance = parcel.readInt() != 0;
this.mRemoving = parcel.readInt() != 0;
this.mDetached = parcel.readInt() != 0;
this.mHidden = parcel.readInt() != 0;
this.mMaxLifecycleState = parcel.readInt();
this.mTargetWho = parcel.readString();
this.mTargetRequestCode = parcel.readInt();
this.mUserVisibleHint = parcel.readInt() != 0;
}
/* JADX INFO: Access modifiers changed from: package-private */
public Fragment instantiate(FragmentFactory fragmentFactory, ClassLoader classLoader) {
Fragment instantiate = fragmentFactory.instantiate(classLoader, this.mClassName);
instantiate.mWho = this.mWho;
instantiate.mFromLayout = this.mFromLayout;
instantiate.mRestored = true;
instantiate.mFragmentId = this.mFragmentId;
instantiate.mContainerId = this.mContainerId;
instantiate.mTag = this.mTag;
instantiate.mRetainInstance = this.mRetainInstance;
instantiate.mRemoving = this.mRemoving;
instantiate.mDetached = this.mDetached;
instantiate.mHidden = this.mHidden;
instantiate.mMaxState = Lifecycle.State.values()[this.mMaxLifecycleState];
instantiate.mTargetWho = this.mTargetWho;
instantiate.mTargetRequestCode = this.mTargetRequestCode;
instantiate.mUserVisibleHint = this.mUserVisibleHint;
return instantiate;
}
public String toString() {
StringBuilder sb = new StringBuilder(128);
sb.append("FragmentState{");
sb.append(this.mClassName);
sb.append(" (");
sb.append(this.mWho);
sb.append(")}:");
if (this.mFromLayout) {
sb.append(" fromLayout");
}
if (this.mContainerId != 0) {
sb.append(" id=0x");
sb.append(Integer.toHexString(this.mContainerId));
}
String str = this.mTag;
if (str != null && !str.isEmpty()) {
sb.append(" tag=");
sb.append(this.mTag);
}
if (this.mRetainInstance) {
sb.append(" retainInstance");
}
if (this.mRemoving) {
sb.append(" removing");
}
if (this.mDetached) {
sb.append(" detached");
}
if (this.mHidden) {
sb.append(" hidden");
}
if (this.mTargetWho != null) {
sb.append(" targetWho=");
sb.append(this.mTargetWho);
sb.append(" targetRequestCode=");
sb.append(this.mTargetRequestCode);
}
if (this.mUserVisibleHint) {
sb.append(" userVisibleHint");
}
return sb.toString();
}
@Override // android.os.Parcelable
public void writeToParcel(Parcel parcel, int i) {
parcel.writeString(this.mClassName);
parcel.writeString(this.mWho);
parcel.writeInt(this.mFromLayout ? 1 : 0);
parcel.writeInt(this.mFragmentId);
parcel.writeInt(this.mContainerId);
parcel.writeString(this.mTag);
parcel.writeInt(this.mRetainInstance ? 1 : 0);
parcel.writeInt(this.mRemoving ? 1 : 0);
parcel.writeInt(this.mDetached ? 1 : 0);
parcel.writeInt(this.mHidden ? 1 : 0);
parcel.writeInt(this.mMaxLifecycleState);
parcel.writeString(this.mTargetWho);
parcel.writeInt(this.mTargetRequestCode);
parcel.writeInt(this.mUserVisibleHint ? 1 : 0);
}
}