* Decompile and recreate Soul Browser v1.4.85 with APK CI builds Co-authored-by: KaKi87 <KaKi87@pm.me> * Fix CI build: include bundled google.jks and remove PR trigger The apktool build failed in CI because app/unknown/.../google.jks was excluded by the *.jks gitignore rule. Whitelist app-bundled JKS files and commit the missing resource. Also remove the redundant pull_request workflow trigger. Co-authored-by: KaKi87 <KaKi87@pm.me> * Change package ID to com.github.kaki87.soulbrowser Rename the application ID so the rebuilt APK can be installed alongside the original Soul Browser from Google Play. - Update AndroidManifest package, permissions, providers, and actions - Update R class references in smali (com/github/kaki87/soulbrowser/R) - Update shortcuts.xml targetPackage - Rename app label to "Soul Rebuild" for easy identification Co-authored-by: KaKi87 <KaKi87@pm.me> * Fix install compatibility: remove split APK metadata and bundle native libs The rebuilt APK still declared requiredSplitTypes and Play Store split metadata, causing Android to reject standalone installs as incompatible. - Remove requiredSplitTypes and split-related manifest meta-data - Merge native libs from all ABI splits with uncompressed storage - Page-align before signing for extractNativeLibs=false - Add .so to apktool doNotCompress list Co-authored-by: KaKi87 <KaKi87@pm.me> * Fix install failure: use apksigner v2/v3 and bundle arm64 native libs Target SDK 36 requires APK Signature Scheme v2+, but jarsigner only produces v1 signatures, causing Android to reject the install. - Sign with apksigner (v1+v2+v3) instead of jarsigner - Add arm64-v8a native libraries from universal Soul Browser 1.4.79 - Set extractNativeLibs=true for reliable sideload installs - Commit stable debug keystore for consistent signatures across builds Co-authored-by: KaKi87 <KaKi87@pm.me> * Add committed debug keystore for consistent APK signatures Co-authored-by: KaKi87 <KaKi87@pm.me> * Fix startup crash: use original classes2.dex desugar libraries Apktool recompiles smali_classes2 into a broken classes2.dex, causing ClassNotFoundException for j$.com.android.tools.r8.a at ML Kit init. Inject the original classes2.dex (Java 8+ desugar libs) after apktool build instead of using the recompiled version. Co-authored-by: KaKi87 <KaKi87@pm.me> * Fix missing drawable resources from density split APKs The base APK is an app bundle module; density-specific drawables like seek_thumb_nor_b live in config.xhdpi.apk and were missing after rebuild, causing Resources$NotFoundException at runtime. - Merge non-9-patch resources from split APKs before apktool build - Sync public.xml IDs from R smali only when backing files exist - Add 713 density-specific resource IDs to public.xml Co-authored-by: KaKi87 <KaKi87@pm.me> --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2284 lines
81 KiB
Java
2284 lines
81 KiB
Java
package androidx.fragment.app;
|
|
|
|
import android.animation.Animator;
|
|
import android.annotation.SuppressLint;
|
|
import android.app.Activity;
|
|
import android.app.Application;
|
|
import android.content.ComponentCallbacks;
|
|
import android.content.Context;
|
|
import android.content.ContextWrapper;
|
|
import android.content.Intent;
|
|
import android.content.IntentSender;
|
|
import android.content.res.Configuration;
|
|
import android.content.res.Resources;
|
|
import android.os.Bundle;
|
|
import android.os.Handler;
|
|
import android.os.Looper;
|
|
import android.os.Parcel;
|
|
import android.os.Parcelable;
|
|
import android.util.AndroidRuntimeException;
|
|
import android.util.AttributeSet;
|
|
import android.util.Log;
|
|
import android.util.SparseArray;
|
|
import android.view.ContextMenu;
|
|
import android.view.LayoutInflater;
|
|
import android.view.Menu;
|
|
import android.view.MenuInflater;
|
|
import android.view.MenuItem;
|
|
import android.view.View;
|
|
import android.view.ViewGroup;
|
|
import android.view.animation.Animation;
|
|
import androidx.activity.result.ActivityResultCallback;
|
|
import androidx.activity.result.ActivityResultCaller;
|
|
import androidx.activity.result.ActivityResultLauncher;
|
|
import androidx.activity.result.ActivityResultRegistry;
|
|
import androidx.activity.result.ActivityResultRegistryOwner;
|
|
import androidx.activity.result.IntentSenderRequest;
|
|
import androidx.activity.result.contract.ActivityResultContract;
|
|
import androidx.annotation.AnimRes;
|
|
import androidx.annotation.CallSuper;
|
|
import androidx.annotation.LayoutRes;
|
|
import androidx.annotation.MainThread;
|
|
import androidx.annotation.NonNull;
|
|
import androidx.annotation.Nullable;
|
|
import androidx.annotation.RequiresApi;
|
|
import androidx.annotation.RestrictTo;
|
|
import androidx.annotation.StringRes;
|
|
import androidx.annotation.UiThread;
|
|
import androidx.arch.core.util.Function;
|
|
import androidx.core.app.SharedElementCallback;
|
|
import androidx.fragment.app.FragmentManager;
|
|
import androidx.fragment.app.strictmode.FragmentStrictMode;
|
|
import androidx.fragment.app.strictmode.GetRetainInstanceUsageViolation;
|
|
import androidx.fragment.app.strictmode.GetTargetFragmentRequestCodeUsageViolation;
|
|
import androidx.fragment.app.strictmode.GetTargetFragmentUsageViolation;
|
|
import androidx.fragment.app.strictmode.SetRetainInstanceUsageViolation;
|
|
import androidx.fragment.app.strictmode.SetTargetFragmentUsageViolation;
|
|
import androidx.fragment.app.strictmode.SetUserVisibleHintViolation;
|
|
import androidx.fragment.app.strictmode.Violation;
|
|
import androidx.lifecycle.HasDefaultViewModelProviderFactory;
|
|
import androidx.lifecycle.Lifecycle;
|
|
import androidx.lifecycle.LifecycleEventObserver;
|
|
import androidx.lifecycle.LifecycleOwner;
|
|
import androidx.lifecycle.LifecycleRegistry;
|
|
import androidx.lifecycle.LiveData;
|
|
import androidx.lifecycle.MutableLiveData;
|
|
import androidx.lifecycle.SavedStateHandleSupport;
|
|
import androidx.lifecycle.SavedStateViewModelFactory;
|
|
import androidx.lifecycle.ViewModelProvider;
|
|
import androidx.lifecycle.ViewModelStore;
|
|
import androidx.lifecycle.ViewModelStoreOwner;
|
|
import androidx.lifecycle.runtime.R;
|
|
import androidx.lifecycle.viewmodel.CreationExtras;
|
|
import androidx.lifecycle.viewmodel.MutableCreationExtras;
|
|
import androidx.loader.app.LoaderManager;
|
|
import androidx.savedstate.SavedStateRegistry;
|
|
import androidx.savedstate.SavedStateRegistryController;
|
|
import androidx.savedstate.SavedStateRegistryOwner;
|
|
import java.io.FileDescriptor;
|
|
import java.io.PrintWriter;
|
|
import java.lang.reflect.InvocationTargetException;
|
|
import java.util.ArrayList;
|
|
import java.util.HashMap;
|
|
import java.util.Iterator;
|
|
import java.util.UUID;
|
|
import java.util.concurrent.TimeUnit;
|
|
import java.util.concurrent.atomic.AtomicInteger;
|
|
import java.util.concurrent.atomic.AtomicReference;
|
|
import kotlin.jvm.internal.Intrinsics;
|
|
import kotlin.uuid.Uuid;
|
|
|
|
/* loaded from: classes.dex */
|
|
public class Fragment implements ComponentCallbacks, View.OnCreateContextMenuListener, LifecycleOwner, ViewModelStoreOwner, HasDefaultViewModelProviderFactory, SavedStateRegistryOwner, ActivityResultCaller {
|
|
static final int ACTIVITY_CREATED = 4;
|
|
static final int ATTACHED = 0;
|
|
static final int AWAITING_ENTER_EFFECTS = 6;
|
|
static final int AWAITING_EXIT_EFFECTS = 3;
|
|
static final int CREATED = 1;
|
|
static final int INITIALIZING = -1;
|
|
static final int RESUMED = 7;
|
|
static final int STARTED = 5;
|
|
static final Object USE_DEFAULT_TRANSITION = new Object();
|
|
static final int VIEW_CREATED = 2;
|
|
boolean mAdded;
|
|
AnimationInfo mAnimationInfo;
|
|
Bundle mArguments;
|
|
int mBackStackNesting;
|
|
boolean mBeingSaved;
|
|
private boolean mCalled;
|
|
ViewGroup mContainer;
|
|
int mContainerId;
|
|
|
|
@LayoutRes
|
|
private int mContentLayoutId;
|
|
ViewModelProvider.Factory mDefaultFactory;
|
|
boolean mDeferStart;
|
|
boolean mDetached;
|
|
int mFragmentId;
|
|
FragmentManager mFragmentManager;
|
|
boolean mFromLayout;
|
|
boolean mHasMenu;
|
|
boolean mHidden;
|
|
boolean mHiddenChanged;
|
|
FragmentHostCallback<?> mHost;
|
|
boolean mInLayout;
|
|
boolean mIsCreated;
|
|
LayoutInflater mLayoutInflater;
|
|
LifecycleRegistry mLifecycleRegistry;
|
|
Fragment mParentFragment;
|
|
boolean mPerformedCreateView;
|
|
Handler mPostponedHandler;
|
|
|
|
@Nullable
|
|
@RestrictTo
|
|
public String mPreviousWho;
|
|
boolean mRemoving;
|
|
boolean mRestored;
|
|
boolean mRetainInstance;
|
|
boolean mRetainInstanceChangedWhileDetached;
|
|
Bundle mSavedFragmentState;
|
|
SavedStateRegistryController mSavedStateRegistryController;
|
|
|
|
@Nullable
|
|
Boolean mSavedUserVisibleHint;
|
|
Bundle mSavedViewRegistryState;
|
|
SparseArray<Parcelable> mSavedViewState;
|
|
String mTag;
|
|
Fragment mTarget;
|
|
int mTargetRequestCode;
|
|
View mView;
|
|
|
|
@Nullable
|
|
FragmentViewLifecycleOwner mViewLifecycleOwner;
|
|
int mState = -1;
|
|
|
|
@NonNull
|
|
String mWho = UUID.randomUUID().toString();
|
|
String mTargetWho = null;
|
|
private Boolean mIsPrimaryNavigationFragment = null;
|
|
|
|
@NonNull
|
|
FragmentManager mChildFragmentManager = new FragmentManager();
|
|
boolean mMenuVisible = true;
|
|
boolean mUserVisibleHint = true;
|
|
Runnable mPostponedDurationRunnable = new Runnable() { // from class: androidx.fragment.app.Fragment.1
|
|
@Override // java.lang.Runnable
|
|
public final void run() {
|
|
Fragment.this.startPostponedEnterTransition();
|
|
}
|
|
};
|
|
Lifecycle.State mMaxState = Lifecycle.State.i;
|
|
MutableLiveData<LifecycleOwner> mViewLifecycleOwnerLiveData = new LiveData();
|
|
private final AtomicInteger mNextLocalRequestCode = new AtomicInteger();
|
|
private final ArrayList<OnPreAttachedListener> mOnPreAttachedListeners = new ArrayList<>();
|
|
private final OnPreAttachedListener mSavedStateAttachListener = new OnPreAttachedListener() { // from class: androidx.fragment.app.Fragment.2
|
|
@Override // androidx.fragment.app.Fragment.OnPreAttachedListener
|
|
public final void a() {
|
|
Bundle bundle;
|
|
Fragment fragment = Fragment.this;
|
|
fragment.mSavedStateRegistryController.a();
|
|
SavedStateHandleSupport.b(fragment);
|
|
Bundle bundle2 = fragment.mSavedFragmentState;
|
|
if (bundle2 != null) {
|
|
bundle = bundle2.getBundle("registryState");
|
|
} else {
|
|
bundle = null;
|
|
}
|
|
fragment.mSavedStateRegistryController.b(bundle);
|
|
}
|
|
};
|
|
|
|
/* loaded from: classes.dex */
|
|
public static class AnimationInfo {
|
|
|
|
/* renamed from: a, reason: collision with root package name */
|
|
public boolean f1093a;
|
|
public int b;
|
|
|
|
/* renamed from: c, reason: collision with root package name */
|
|
public int f1094c;
|
|
public int d;
|
|
public int e;
|
|
public int f;
|
|
public ArrayList g;
|
|
public ArrayList h;
|
|
public Object i;
|
|
public Object j;
|
|
public Object k;
|
|
public Object l;
|
|
public Object m;
|
|
public Object n;
|
|
public Boolean o;
|
|
public Boolean p;
|
|
public SharedElementCallback q;
|
|
public SharedElementCallback r;
|
|
public float s;
|
|
public View t;
|
|
public boolean u;
|
|
}
|
|
|
|
@RequiresApi
|
|
/* loaded from: classes.dex */
|
|
public static class Api19Impl {
|
|
}
|
|
|
|
/* loaded from: classes.dex */
|
|
public static class InstantiationException extends RuntimeException {
|
|
}
|
|
|
|
/* loaded from: classes.dex */
|
|
public static abstract class OnPreAttachedListener {
|
|
public abstract void a();
|
|
}
|
|
|
|
@SuppressLint({"BanParcelableUsage, ParcelClassLoader"})
|
|
/* loaded from: classes.dex */
|
|
public static class SavedState implements Parcelable {
|
|
|
|
@NonNull
|
|
public static final Parcelable.Creator<SavedState> CREATOR = new Object();
|
|
|
|
/* renamed from: c, reason: collision with root package name */
|
|
public final Bundle f1095c;
|
|
|
|
/* renamed from: androidx.fragment.app.Fragment$SavedState$1, reason: invalid class name */
|
|
/* loaded from: classes.dex */
|
|
public class AnonymousClass1 implements Parcelable.ClassLoaderCreator<SavedState> {
|
|
@Override // android.os.Parcelable.Creator
|
|
public final Object createFromParcel(Parcel parcel) {
|
|
return new SavedState(parcel, null);
|
|
}
|
|
|
|
@Override // android.os.Parcelable.Creator
|
|
public final Object[] newArray(int i) {
|
|
return new SavedState[i];
|
|
}
|
|
|
|
@Override // android.os.Parcelable.ClassLoaderCreator
|
|
public final SavedState createFromParcel(Parcel parcel, ClassLoader classLoader) {
|
|
return new SavedState(parcel, classLoader);
|
|
}
|
|
}
|
|
|
|
public SavedState(Parcel parcel, ClassLoader classLoader) {
|
|
Bundle readBundle = parcel.readBundle();
|
|
this.f1095c = readBundle;
|
|
if (classLoader != null && readBundle != null) {
|
|
readBundle.setClassLoader(classLoader);
|
|
}
|
|
}
|
|
|
|
@Override // android.os.Parcelable
|
|
public final int describeContents() {
|
|
return 0;
|
|
}
|
|
|
|
@Override // android.os.Parcelable
|
|
public final void writeToParcel(Parcel parcel, int i) {
|
|
parcel.writeBundle(this.f1095c);
|
|
}
|
|
}
|
|
|
|
/* JADX WARN: Type inference failed for: r0v8, types: [androidx.lifecycle.LiveData, androidx.lifecycle.MutableLiveData<androidx.lifecycle.LifecycleOwner>] */
|
|
public Fragment() {
|
|
d();
|
|
}
|
|
|
|
@NonNull
|
|
@Deprecated
|
|
public static Fragment instantiate(@NonNull Context context, @NonNull String str) {
|
|
return instantiate(context, str, null);
|
|
}
|
|
|
|
/* JADX WARN: Type inference failed for: r0v2, types: [androidx.fragment.app.Fragment$AnimationInfo, java.lang.Object] */
|
|
public final AnimationInfo a() {
|
|
if (this.mAnimationInfo == null) {
|
|
?? obj = new Object();
|
|
obj.i = null;
|
|
Object obj2 = USE_DEFAULT_TRANSITION;
|
|
obj.j = obj2;
|
|
obj.k = null;
|
|
obj.l = obj2;
|
|
obj.m = null;
|
|
obj.n = obj2;
|
|
obj.q = null;
|
|
obj.r = null;
|
|
obj.s = 1.0f;
|
|
obj.t = null;
|
|
this.mAnimationInfo = obj;
|
|
}
|
|
return this.mAnimationInfo;
|
|
}
|
|
|
|
public final int b() {
|
|
Lifecycle.State state = this.mMaxState;
|
|
if (state != Lifecycle.State.f && this.mParentFragment != null) {
|
|
return Math.min(state.ordinal(), this.mParentFragment.b());
|
|
}
|
|
return state.ordinal();
|
|
}
|
|
|
|
public final Fragment c(boolean z) {
|
|
String str;
|
|
if (z) {
|
|
FragmentStrictMode.Policy policy = FragmentStrictMode.f1161a;
|
|
Intrinsics.checkNotNullParameter(this, "fragment");
|
|
Intrinsics.checkNotNullParameter(this, "fragment");
|
|
Intrinsics.checkNotNullParameter(this, "fragment");
|
|
Violation violation = new Violation(this, "Attempting to get target fragment from fragment " + this);
|
|
FragmentStrictMode.c(violation);
|
|
FragmentStrictMode.Policy a2 = FragmentStrictMode.a(this);
|
|
if (a2.f1164a.contains(FragmentStrictMode.Flag.l) && FragmentStrictMode.e(a2, getClass(), GetTargetFragmentUsageViolation.class)) {
|
|
FragmentStrictMode.b(a2, violation);
|
|
}
|
|
}
|
|
Fragment fragment = this.mTarget;
|
|
if (fragment != null) {
|
|
return fragment;
|
|
}
|
|
FragmentManager fragmentManager = this.mFragmentManager;
|
|
if (fragmentManager != null && (str = this.mTargetWho) != null) {
|
|
return fragmentManager.f1106c.b(str);
|
|
}
|
|
return null;
|
|
}
|
|
|
|
public void callStartTransitionListener(boolean z) {
|
|
ViewGroup viewGroup;
|
|
FragmentManager fragmentManager;
|
|
AnimationInfo animationInfo = this.mAnimationInfo;
|
|
if (animationInfo != null) {
|
|
animationInfo.u = false;
|
|
}
|
|
if (this.mView != null && (viewGroup = this.mContainer) != null && (fragmentManager = this.mFragmentManager) != null) {
|
|
final SpecialEffectsController g = SpecialEffectsController.g(viewGroup, fragmentManager);
|
|
g.h();
|
|
if (z) {
|
|
this.mHost.g.post(new Runnable() { // from class: androidx.fragment.app.Fragment.4
|
|
@Override // java.lang.Runnable
|
|
public final void run() {
|
|
SpecialEffectsController.this.d();
|
|
}
|
|
});
|
|
} else {
|
|
g.d();
|
|
}
|
|
Handler handler = this.mPostponedHandler;
|
|
if (handler != null) {
|
|
handler.removeCallbacks(this.mPostponedDurationRunnable);
|
|
this.mPostponedHandler = null;
|
|
}
|
|
}
|
|
}
|
|
|
|
@NonNull
|
|
public FragmentContainer createFragmentContainer() {
|
|
return new FragmentContainer() { // from class: androidx.fragment.app.Fragment.5
|
|
@Override // androidx.fragment.app.FragmentContainer
|
|
public final View b(int i) {
|
|
Fragment fragment = Fragment.this;
|
|
View view = fragment.mView;
|
|
if (view != null) {
|
|
return view.findViewById(i);
|
|
}
|
|
throw new IllegalStateException("Fragment " + fragment + " does not have a view");
|
|
}
|
|
|
|
@Override // androidx.fragment.app.FragmentContainer
|
|
public final boolean c() {
|
|
if (Fragment.this.mView != null) {
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
};
|
|
}
|
|
|
|
public final void d() {
|
|
this.mLifecycleRegistry = new LifecycleRegistry(this);
|
|
this.mSavedStateRegistryController = SavedStateRegistryController.Companion.a(this);
|
|
this.mDefaultFactory = null;
|
|
if (!this.mOnPreAttachedListeners.contains(this.mSavedStateAttachListener)) {
|
|
OnPreAttachedListener onPreAttachedListener = this.mSavedStateAttachListener;
|
|
if (this.mState >= 0) {
|
|
onPreAttachedListener.a();
|
|
} else {
|
|
this.mOnPreAttachedListeners.add(onPreAttachedListener);
|
|
}
|
|
}
|
|
}
|
|
|
|
public void dump(@NonNull String str, @Nullable FileDescriptor fileDescriptor, @NonNull PrintWriter printWriter, @Nullable String[] strArr) {
|
|
printWriter.print(str);
|
|
printWriter.print("mFragmentId=#");
|
|
printWriter.print(Integer.toHexString(this.mFragmentId));
|
|
printWriter.print(" mContainerId=#");
|
|
printWriter.print(Integer.toHexString(this.mContainerId));
|
|
printWriter.print(" mTag=");
|
|
printWriter.println(this.mTag);
|
|
printWriter.print(str);
|
|
printWriter.print("mState=");
|
|
printWriter.print(this.mState);
|
|
printWriter.print(" mWho=");
|
|
printWriter.print(this.mWho);
|
|
printWriter.print(" mBackStackNesting=");
|
|
printWriter.println(this.mBackStackNesting);
|
|
printWriter.print(str);
|
|
printWriter.print("mAdded=");
|
|
printWriter.print(this.mAdded);
|
|
printWriter.print(" mRemoving=");
|
|
printWriter.print(this.mRemoving);
|
|
printWriter.print(" mFromLayout=");
|
|
printWriter.print(this.mFromLayout);
|
|
printWriter.print(" mInLayout=");
|
|
printWriter.println(this.mInLayout);
|
|
printWriter.print(str);
|
|
printWriter.print("mHidden=");
|
|
printWriter.print(this.mHidden);
|
|
printWriter.print(" mDetached=");
|
|
printWriter.print(this.mDetached);
|
|
printWriter.print(" mMenuVisible=");
|
|
printWriter.print(this.mMenuVisible);
|
|
printWriter.print(" mHasMenu=");
|
|
printWriter.println(this.mHasMenu);
|
|
printWriter.print(str);
|
|
printWriter.print("mRetainInstance=");
|
|
printWriter.print(this.mRetainInstance);
|
|
printWriter.print(" mUserVisibleHint=");
|
|
printWriter.println(this.mUserVisibleHint);
|
|
if (this.mFragmentManager != null) {
|
|
printWriter.print(str);
|
|
printWriter.print("mFragmentManager=");
|
|
printWriter.println(this.mFragmentManager);
|
|
}
|
|
if (this.mHost != null) {
|
|
printWriter.print(str);
|
|
printWriter.print("mHost=");
|
|
printWriter.println(this.mHost);
|
|
}
|
|
if (this.mParentFragment != null) {
|
|
printWriter.print(str);
|
|
printWriter.print("mParentFragment=");
|
|
printWriter.println(this.mParentFragment);
|
|
}
|
|
if (this.mArguments != null) {
|
|
printWriter.print(str);
|
|
printWriter.print("mArguments=");
|
|
printWriter.println(this.mArguments);
|
|
}
|
|
if (this.mSavedFragmentState != null) {
|
|
printWriter.print(str);
|
|
printWriter.print("mSavedFragmentState=");
|
|
printWriter.println(this.mSavedFragmentState);
|
|
}
|
|
if (this.mSavedViewState != null) {
|
|
printWriter.print(str);
|
|
printWriter.print("mSavedViewState=");
|
|
printWriter.println(this.mSavedViewState);
|
|
}
|
|
if (this.mSavedViewRegistryState != null) {
|
|
printWriter.print(str);
|
|
printWriter.print("mSavedViewRegistryState=");
|
|
printWriter.println(this.mSavedViewRegistryState);
|
|
}
|
|
Fragment c2 = c(false);
|
|
if (c2 != null) {
|
|
printWriter.print(str);
|
|
printWriter.print("mTarget=");
|
|
printWriter.print(c2);
|
|
printWriter.print(" mTargetRequestCode=");
|
|
printWriter.println(this.mTargetRequestCode);
|
|
}
|
|
printWriter.print(str);
|
|
printWriter.print("mPopDirection=");
|
|
printWriter.println(getPopDirection());
|
|
if (getEnterAnim() != 0) {
|
|
printWriter.print(str);
|
|
printWriter.print("getEnterAnim=");
|
|
printWriter.println(getEnterAnim());
|
|
}
|
|
if (getExitAnim() != 0) {
|
|
printWriter.print(str);
|
|
printWriter.print("getExitAnim=");
|
|
printWriter.println(getExitAnim());
|
|
}
|
|
if (getPopEnterAnim() != 0) {
|
|
printWriter.print(str);
|
|
printWriter.print("getPopEnterAnim=");
|
|
printWriter.println(getPopEnterAnim());
|
|
}
|
|
if (getPopExitAnim() != 0) {
|
|
printWriter.print(str);
|
|
printWriter.print("getPopExitAnim=");
|
|
printWriter.println(getPopExitAnim());
|
|
}
|
|
if (this.mContainer != null) {
|
|
printWriter.print(str);
|
|
printWriter.print("mContainer=");
|
|
printWriter.println(this.mContainer);
|
|
}
|
|
if (this.mView != null) {
|
|
printWriter.print(str);
|
|
printWriter.print("mView=");
|
|
printWriter.println(this.mView);
|
|
}
|
|
if (getAnimatingAway() != null) {
|
|
printWriter.print(str);
|
|
printWriter.print("mAnimatingAway=");
|
|
printWriter.println(getAnimatingAway());
|
|
}
|
|
if (getContext() != null) {
|
|
LoaderManager.b(this).a(str, fileDescriptor, printWriter, strArr);
|
|
}
|
|
printWriter.print(str);
|
|
printWriter.println("Child " + this.mChildFragmentManager + ":");
|
|
this.mChildFragmentManager.v(android.support.v4.media.a.k(str, " "), fileDescriptor, printWriter, strArr);
|
|
}
|
|
|
|
public final ActivityResultLauncher e(final ActivityResultContract activityResultContract, final Function function, final ActivityResultCallback activityResultCallback) {
|
|
if (this.mState <= 1) {
|
|
final AtomicReference atomicReference = new AtomicReference();
|
|
OnPreAttachedListener onPreAttachedListener = new OnPreAttachedListener() { // from class: androidx.fragment.app.Fragment.9
|
|
@Override // androidx.fragment.app.Fragment.OnPreAttachedListener
|
|
public final void a() {
|
|
Fragment fragment = Fragment.this;
|
|
atomicReference.set(((ActivityResultRegistry) function.apply()).d(fragment.generateActivityResultKey(), fragment, activityResultContract, activityResultCallback));
|
|
}
|
|
};
|
|
if (this.mState >= 0) {
|
|
onPreAttachedListener.a();
|
|
} else {
|
|
this.mOnPreAttachedListeners.add(onPreAttachedListener);
|
|
}
|
|
return new ActivityResultLauncher<Object>() { // from class: androidx.fragment.app.Fragment.10
|
|
@Override // androidx.activity.result.ActivityResultLauncher
|
|
public final void a(Object obj) {
|
|
ActivityResultLauncher activityResultLauncher = (ActivityResultLauncher) atomicReference.get();
|
|
if (activityResultLauncher != null) {
|
|
activityResultLauncher.a(obj);
|
|
return;
|
|
}
|
|
throw new IllegalStateException("Operation cannot be started before fragment is in created state");
|
|
}
|
|
};
|
|
}
|
|
throw new IllegalStateException(android.support.v4.media.a.j("Fragment ", this, " is attempting to registerForActivityResult after being created. Fragments must call registerForActivityResult() before they are created (i.e. initialization, onAttach(), or onCreate())."));
|
|
}
|
|
|
|
public final boolean equals(@Nullable Object obj) {
|
|
return super.equals(obj);
|
|
}
|
|
|
|
@Nullable
|
|
public Fragment findFragmentByWho(@NonNull String str) {
|
|
if (str.equals(this.mWho)) {
|
|
return this;
|
|
}
|
|
return this.mChildFragmentManager.f1106c.c(str);
|
|
}
|
|
|
|
@NonNull
|
|
public String generateActivityResultKey() {
|
|
return "fragment_" + this.mWho + "_rq#" + this.mNextLocalRequestCode.getAndIncrement();
|
|
}
|
|
|
|
@Nullable
|
|
public final FragmentActivity getActivity() {
|
|
FragmentHostCallback<?> fragmentHostCallback = this.mHost;
|
|
if (fragmentHostCallback == null) {
|
|
return null;
|
|
}
|
|
return fragmentHostCallback.f1101c;
|
|
}
|
|
|
|
public boolean getAllowEnterTransitionOverlap() {
|
|
Boolean bool;
|
|
AnimationInfo animationInfo = this.mAnimationInfo;
|
|
if (animationInfo != null && (bool = animationInfo.p) != null) {
|
|
return bool.booleanValue();
|
|
}
|
|
return true;
|
|
}
|
|
|
|
public boolean getAllowReturnTransitionOverlap() {
|
|
Boolean bool;
|
|
AnimationInfo animationInfo = this.mAnimationInfo;
|
|
if (animationInfo != null && (bool = animationInfo.o) != null) {
|
|
return bool.booleanValue();
|
|
}
|
|
return true;
|
|
}
|
|
|
|
public View getAnimatingAway() {
|
|
AnimationInfo animationInfo = this.mAnimationInfo;
|
|
if (animationInfo == null) {
|
|
return null;
|
|
}
|
|
animationInfo.getClass();
|
|
return null;
|
|
}
|
|
|
|
@Nullable
|
|
public final Bundle getArguments() {
|
|
return this.mArguments;
|
|
}
|
|
|
|
@NonNull
|
|
public final FragmentManager getChildFragmentManager() {
|
|
if (this.mHost != null) {
|
|
return this.mChildFragmentManager;
|
|
}
|
|
throw new IllegalStateException(android.support.v4.media.a.j("Fragment ", this, " has not been attached yet."));
|
|
}
|
|
|
|
@Nullable
|
|
public Context getContext() {
|
|
FragmentHostCallback<?> fragmentHostCallback = this.mHost;
|
|
if (fragmentHostCallback == null) {
|
|
return null;
|
|
}
|
|
return fragmentHostCallback.f;
|
|
}
|
|
|
|
@Override // androidx.lifecycle.HasDefaultViewModelProviderFactory
|
|
@NonNull
|
|
@CallSuper
|
|
public CreationExtras getDefaultViewModelCreationExtras() {
|
|
Application application;
|
|
Context applicationContext = requireContext().getApplicationContext();
|
|
while (true) {
|
|
if (applicationContext instanceof ContextWrapper) {
|
|
if (applicationContext instanceof Application) {
|
|
application = (Application) applicationContext;
|
|
break;
|
|
}
|
|
applicationContext = ((ContextWrapper) applicationContext).getBaseContext();
|
|
} else {
|
|
application = null;
|
|
break;
|
|
}
|
|
}
|
|
if (application == null && FragmentManager.J(3)) {
|
|
Log.d("FragmentManager", "Could not find Application instance from Context " + requireContext().getApplicationContext() + ", you will not be able to use AndroidViewModel with the default ViewModelProvider.Factory");
|
|
}
|
|
MutableCreationExtras mutableCreationExtras = new MutableCreationExtras(0);
|
|
if (application != null) {
|
|
mutableCreationExtras.b(ViewModelProvider.AndroidViewModelFactory.e, application);
|
|
}
|
|
mutableCreationExtras.b(SavedStateHandleSupport.f1217a, this);
|
|
mutableCreationExtras.b(SavedStateHandleSupport.b, this);
|
|
if (getArguments() != null) {
|
|
mutableCreationExtras.b(SavedStateHandleSupport.f1218c, getArguments());
|
|
}
|
|
return mutableCreationExtras;
|
|
}
|
|
|
|
@Override // androidx.lifecycle.HasDefaultViewModelProviderFactory
|
|
@NonNull
|
|
public ViewModelProvider.Factory getDefaultViewModelProviderFactory() {
|
|
Application application;
|
|
if (this.mFragmentManager != null) {
|
|
if (this.mDefaultFactory == null) {
|
|
Context applicationContext = requireContext().getApplicationContext();
|
|
while (true) {
|
|
if (applicationContext instanceof ContextWrapper) {
|
|
if (applicationContext instanceof Application) {
|
|
application = (Application) applicationContext;
|
|
break;
|
|
}
|
|
applicationContext = ((ContextWrapper) applicationContext).getBaseContext();
|
|
} else {
|
|
application = null;
|
|
break;
|
|
}
|
|
}
|
|
if (application == null && FragmentManager.J(3)) {
|
|
Log.d("FragmentManager", "Could not find Application instance from Context " + requireContext().getApplicationContext() + ", you will need CreationExtras to use AndroidViewModel with the default ViewModelProvider.Factory");
|
|
}
|
|
this.mDefaultFactory = new SavedStateViewModelFactory(application, this, getArguments());
|
|
}
|
|
return this.mDefaultFactory;
|
|
}
|
|
throw new IllegalStateException("Can't access ViewModels from detached fragment");
|
|
}
|
|
|
|
@AnimRes
|
|
public int getEnterAnim() {
|
|
AnimationInfo animationInfo = this.mAnimationInfo;
|
|
if (animationInfo == null) {
|
|
return 0;
|
|
}
|
|
return animationInfo.b;
|
|
}
|
|
|
|
@Nullable
|
|
public Object getEnterTransition() {
|
|
AnimationInfo animationInfo = this.mAnimationInfo;
|
|
if (animationInfo == null) {
|
|
return null;
|
|
}
|
|
return animationInfo.i;
|
|
}
|
|
|
|
public SharedElementCallback getEnterTransitionCallback() {
|
|
AnimationInfo animationInfo = this.mAnimationInfo;
|
|
if (animationInfo == null) {
|
|
return null;
|
|
}
|
|
return animationInfo.q;
|
|
}
|
|
|
|
@AnimRes
|
|
public int getExitAnim() {
|
|
AnimationInfo animationInfo = this.mAnimationInfo;
|
|
if (animationInfo == null) {
|
|
return 0;
|
|
}
|
|
return animationInfo.f1094c;
|
|
}
|
|
|
|
@Nullable
|
|
public Object getExitTransition() {
|
|
AnimationInfo animationInfo = this.mAnimationInfo;
|
|
if (animationInfo == null) {
|
|
return null;
|
|
}
|
|
return animationInfo.k;
|
|
}
|
|
|
|
public SharedElementCallback getExitTransitionCallback() {
|
|
AnimationInfo animationInfo = this.mAnimationInfo;
|
|
if (animationInfo == null) {
|
|
return null;
|
|
}
|
|
return animationInfo.r;
|
|
}
|
|
|
|
public View getFocusedView() {
|
|
AnimationInfo animationInfo = this.mAnimationInfo;
|
|
if (animationInfo == null) {
|
|
return null;
|
|
}
|
|
return animationInfo.t;
|
|
}
|
|
|
|
@Nullable
|
|
@Deprecated
|
|
public final FragmentManager getFragmentManager() {
|
|
return this.mFragmentManager;
|
|
}
|
|
|
|
@Nullable
|
|
public final Object getHost() {
|
|
FragmentHostCallback<?> fragmentHostCallback = this.mHost;
|
|
if (fragmentHostCallback == null) {
|
|
return null;
|
|
}
|
|
return fragmentHostCallback.e();
|
|
}
|
|
|
|
public final int getId() {
|
|
return this.mFragmentId;
|
|
}
|
|
|
|
@NonNull
|
|
public final LayoutInflater getLayoutInflater() {
|
|
LayoutInflater layoutInflater = this.mLayoutInflater;
|
|
return layoutInflater == null ? performGetLayoutInflater(null) : layoutInflater;
|
|
}
|
|
|
|
@Override // androidx.lifecycle.LifecycleOwner
|
|
@NonNull
|
|
public Lifecycle getLifecycle() {
|
|
return this.mLifecycleRegistry;
|
|
}
|
|
|
|
@NonNull
|
|
@Deprecated
|
|
public LoaderManager getLoaderManager() {
|
|
return LoaderManager.b(this);
|
|
}
|
|
|
|
public int getNextTransition() {
|
|
AnimationInfo animationInfo = this.mAnimationInfo;
|
|
if (animationInfo == null) {
|
|
return 0;
|
|
}
|
|
return animationInfo.f;
|
|
}
|
|
|
|
@Nullable
|
|
public final Fragment getParentFragment() {
|
|
return this.mParentFragment;
|
|
}
|
|
|
|
@NonNull
|
|
public final FragmentManager getParentFragmentManager() {
|
|
FragmentManager fragmentManager = this.mFragmentManager;
|
|
if (fragmentManager != null) {
|
|
return fragmentManager;
|
|
}
|
|
throw new IllegalStateException(android.support.v4.media.a.j("Fragment ", this, " not associated with a fragment manager."));
|
|
}
|
|
|
|
public boolean getPopDirection() {
|
|
AnimationInfo animationInfo = this.mAnimationInfo;
|
|
if (animationInfo == null) {
|
|
return false;
|
|
}
|
|
return animationInfo.f1093a;
|
|
}
|
|
|
|
@AnimRes
|
|
public int getPopEnterAnim() {
|
|
AnimationInfo animationInfo = this.mAnimationInfo;
|
|
if (animationInfo == null) {
|
|
return 0;
|
|
}
|
|
return animationInfo.d;
|
|
}
|
|
|
|
@AnimRes
|
|
public int getPopExitAnim() {
|
|
AnimationInfo animationInfo = this.mAnimationInfo;
|
|
if (animationInfo == null) {
|
|
return 0;
|
|
}
|
|
return animationInfo.e;
|
|
}
|
|
|
|
public float getPostOnViewCreatedAlpha() {
|
|
AnimationInfo animationInfo = this.mAnimationInfo;
|
|
if (animationInfo == null) {
|
|
return 1.0f;
|
|
}
|
|
return animationInfo.s;
|
|
}
|
|
|
|
@Nullable
|
|
public Object getReenterTransition() {
|
|
AnimationInfo animationInfo = this.mAnimationInfo;
|
|
if (animationInfo == null) {
|
|
return null;
|
|
}
|
|
Object obj = animationInfo.l;
|
|
if (obj == USE_DEFAULT_TRANSITION) {
|
|
return getExitTransition();
|
|
}
|
|
return obj;
|
|
}
|
|
|
|
@NonNull
|
|
public final Resources getResources() {
|
|
return requireContext().getResources();
|
|
}
|
|
|
|
@Deprecated
|
|
public final boolean getRetainInstance() {
|
|
FragmentStrictMode.Policy policy = FragmentStrictMode.f1161a;
|
|
Intrinsics.checkNotNullParameter(this, "fragment");
|
|
Intrinsics.checkNotNullParameter(this, "fragment");
|
|
Intrinsics.checkNotNullParameter(this, "fragment");
|
|
Violation violation = new Violation(this, "Attempting to get retain instance for fragment " + this);
|
|
FragmentStrictMode.c(violation);
|
|
FragmentStrictMode.Policy a2 = FragmentStrictMode.a(this);
|
|
if (a2.f1164a.contains(FragmentStrictMode.Flag.j) && FragmentStrictMode.e(a2, getClass(), GetRetainInstanceUsageViolation.class)) {
|
|
FragmentStrictMode.b(a2, violation);
|
|
}
|
|
return this.mRetainInstance;
|
|
}
|
|
|
|
@Nullable
|
|
public Object getReturnTransition() {
|
|
AnimationInfo animationInfo = this.mAnimationInfo;
|
|
if (animationInfo == null) {
|
|
return null;
|
|
}
|
|
Object obj = animationInfo.j;
|
|
if (obj == USE_DEFAULT_TRANSITION) {
|
|
return getEnterTransition();
|
|
}
|
|
return obj;
|
|
}
|
|
|
|
@Override // androidx.savedstate.SavedStateRegistryOwner
|
|
@NonNull
|
|
public final SavedStateRegistry getSavedStateRegistry() {
|
|
return this.mSavedStateRegistryController.b;
|
|
}
|
|
|
|
@Nullable
|
|
public Object getSharedElementEnterTransition() {
|
|
AnimationInfo animationInfo = this.mAnimationInfo;
|
|
if (animationInfo == null) {
|
|
return null;
|
|
}
|
|
return animationInfo.m;
|
|
}
|
|
|
|
@Nullable
|
|
public Object getSharedElementReturnTransition() {
|
|
AnimationInfo animationInfo = this.mAnimationInfo;
|
|
if (animationInfo == null) {
|
|
return null;
|
|
}
|
|
Object obj = animationInfo.n;
|
|
if (obj == USE_DEFAULT_TRANSITION) {
|
|
return getSharedElementEnterTransition();
|
|
}
|
|
return obj;
|
|
}
|
|
|
|
@NonNull
|
|
public ArrayList<String> getSharedElementSourceNames() {
|
|
ArrayList<String> arrayList;
|
|
AnimationInfo animationInfo = this.mAnimationInfo;
|
|
if (animationInfo != null && (arrayList = animationInfo.g) != null) {
|
|
return arrayList;
|
|
}
|
|
return new ArrayList<>();
|
|
}
|
|
|
|
@NonNull
|
|
public ArrayList<String> getSharedElementTargetNames() {
|
|
ArrayList<String> arrayList;
|
|
AnimationInfo animationInfo = this.mAnimationInfo;
|
|
if (animationInfo != null && (arrayList = animationInfo.h) != null) {
|
|
return arrayList;
|
|
}
|
|
return new ArrayList<>();
|
|
}
|
|
|
|
@NonNull
|
|
public final String getString(@StringRes int i) {
|
|
return getResources().getString(i);
|
|
}
|
|
|
|
@Nullable
|
|
public final String getTag() {
|
|
return this.mTag;
|
|
}
|
|
|
|
@Nullable
|
|
@Deprecated
|
|
public final Fragment getTargetFragment() {
|
|
return c(true);
|
|
}
|
|
|
|
@Deprecated
|
|
public final int getTargetRequestCode() {
|
|
FragmentStrictMode.Policy policy = FragmentStrictMode.f1161a;
|
|
Intrinsics.checkNotNullParameter(this, "fragment");
|
|
Intrinsics.checkNotNullParameter(this, "fragment");
|
|
Intrinsics.checkNotNullParameter(this, "fragment");
|
|
Violation violation = new Violation(this, "Attempting to get target request code from fragment " + this);
|
|
FragmentStrictMode.c(violation);
|
|
FragmentStrictMode.Policy a2 = FragmentStrictMode.a(this);
|
|
if (a2.f1164a.contains(FragmentStrictMode.Flag.l) && FragmentStrictMode.e(a2, getClass(), GetTargetFragmentRequestCodeUsageViolation.class)) {
|
|
FragmentStrictMode.b(a2, violation);
|
|
}
|
|
return this.mTargetRequestCode;
|
|
}
|
|
|
|
@NonNull
|
|
public final CharSequence getText(@StringRes int i) {
|
|
return getResources().getText(i);
|
|
}
|
|
|
|
@Deprecated
|
|
public boolean getUserVisibleHint() {
|
|
return this.mUserVisibleHint;
|
|
}
|
|
|
|
@Nullable
|
|
public View getView() {
|
|
return this.mView;
|
|
}
|
|
|
|
@NonNull
|
|
@MainThread
|
|
public LifecycleOwner getViewLifecycleOwner() {
|
|
FragmentViewLifecycleOwner fragmentViewLifecycleOwner = this.mViewLifecycleOwner;
|
|
if (fragmentViewLifecycleOwner != null) {
|
|
return fragmentViewLifecycleOwner;
|
|
}
|
|
throw new IllegalStateException(android.support.v4.media.a.j("Can't access the Fragment View's LifecycleOwner for ", this, " when getView() is null i.e., before onCreateView() or after onDestroyView()"));
|
|
}
|
|
|
|
@NonNull
|
|
public LiveData<LifecycleOwner> getViewLifecycleOwnerLiveData() {
|
|
return this.mViewLifecycleOwnerLiveData;
|
|
}
|
|
|
|
@Override // androidx.lifecycle.ViewModelStoreOwner
|
|
@NonNull
|
|
public ViewModelStore getViewModelStore() {
|
|
if (this.mFragmentManager != null) {
|
|
if (b() != 1) {
|
|
HashMap hashMap = this.mFragmentManager.M.f;
|
|
ViewModelStore viewModelStore = (ViewModelStore) hashMap.get(this.mWho);
|
|
if (viewModelStore == null) {
|
|
ViewModelStore viewModelStore2 = new ViewModelStore();
|
|
hashMap.put(this.mWho, viewModelStore2);
|
|
return viewModelStore2;
|
|
}
|
|
return viewModelStore;
|
|
}
|
|
throw new IllegalStateException("Calling getViewModelStore() before a Fragment reaches onCreate() when using setMaxLifecycle(INITIALIZED) is not supported");
|
|
}
|
|
throw new IllegalStateException("Can't access ViewModels from detached fragment");
|
|
}
|
|
|
|
@SuppressLint({"KotlinPropertyAccess"})
|
|
@RestrictTo
|
|
public final boolean hasOptionsMenu() {
|
|
return this.mHasMenu;
|
|
}
|
|
|
|
public final int hashCode() {
|
|
return super.hashCode();
|
|
}
|
|
|
|
public void initState() {
|
|
d();
|
|
this.mPreviousWho = this.mWho;
|
|
this.mWho = UUID.randomUUID().toString();
|
|
this.mAdded = false;
|
|
this.mRemoving = false;
|
|
this.mFromLayout = false;
|
|
this.mInLayout = false;
|
|
this.mRestored = false;
|
|
this.mBackStackNesting = 0;
|
|
this.mFragmentManager = null;
|
|
this.mChildFragmentManager = new FragmentManager();
|
|
this.mHost = null;
|
|
this.mFragmentId = 0;
|
|
this.mContainerId = 0;
|
|
this.mTag = null;
|
|
this.mHidden = false;
|
|
this.mDetached = false;
|
|
}
|
|
|
|
public final boolean isAdded() {
|
|
if (this.mHost != null && this.mAdded) {
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public final boolean isDetached() {
|
|
return this.mDetached;
|
|
}
|
|
|
|
public final boolean isHidden() {
|
|
boolean isHidden;
|
|
if (!this.mHidden) {
|
|
FragmentManager fragmentManager = this.mFragmentManager;
|
|
if (fragmentManager != null) {
|
|
Fragment fragment = this.mParentFragment;
|
|
fragmentManager.getClass();
|
|
if (fragment == null) {
|
|
isHidden = false;
|
|
} else {
|
|
isHidden = fragment.isHidden();
|
|
}
|
|
if (isHidden) {
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
public final boolean isInBackStack() {
|
|
if (this.mBackStackNesting > 0) {
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public final boolean isInLayout() {
|
|
return this.mInLayout;
|
|
}
|
|
|
|
@RestrictTo
|
|
public final boolean isMenuVisible() {
|
|
boolean isMenuVisible;
|
|
if (this.mMenuVisible) {
|
|
if (this.mFragmentManager != null) {
|
|
Fragment fragment = this.mParentFragment;
|
|
if (fragment == null) {
|
|
isMenuVisible = true;
|
|
} else {
|
|
isMenuVisible = fragment.isMenuVisible();
|
|
}
|
|
if (!isMenuVisible) {
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public boolean isPostponed() {
|
|
AnimationInfo animationInfo = this.mAnimationInfo;
|
|
if (animationInfo == null) {
|
|
return false;
|
|
}
|
|
return animationInfo.u;
|
|
}
|
|
|
|
public final boolean isRemoving() {
|
|
return this.mRemoving;
|
|
}
|
|
|
|
public final boolean isResumed() {
|
|
if (this.mState >= 7) {
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public final boolean isStateSaved() {
|
|
FragmentManager fragmentManager = this.mFragmentManager;
|
|
if (fragmentManager == null) {
|
|
return false;
|
|
}
|
|
return fragmentManager.N();
|
|
}
|
|
|
|
public final boolean isVisible() {
|
|
View view;
|
|
if (isAdded() && !isHidden() && (view = this.mView) != null && view.getWindowToken() != null && this.mView.getVisibility() == 0) {
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public void noteStateNotSaved() {
|
|
this.mChildFragmentManager.P();
|
|
}
|
|
|
|
@CallSuper
|
|
@MainThread
|
|
@Deprecated
|
|
public void onActivityCreated(@Nullable Bundle bundle) {
|
|
this.mCalled = true;
|
|
}
|
|
|
|
@Deprecated
|
|
public void onActivityResult(int i, int i2, @Nullable Intent intent) {
|
|
if (FragmentManager.J(2)) {
|
|
Log.v("FragmentManager", "Fragment " + this + " received the following in onActivityResult(): requestCode: " + i + " resultCode: " + i2 + " data: " + intent);
|
|
}
|
|
}
|
|
|
|
@CallSuper
|
|
@MainThread
|
|
public void onAttach(@NonNull Context context) {
|
|
this.mCalled = true;
|
|
FragmentHostCallback<?> fragmentHostCallback = this.mHost;
|
|
FragmentActivity fragmentActivity = fragmentHostCallback == null ? null : fragmentHostCallback.f1101c;
|
|
if (fragmentActivity != null) {
|
|
this.mCalled = false;
|
|
onAttach((Activity) fragmentActivity);
|
|
}
|
|
}
|
|
|
|
@MainThread
|
|
@Deprecated
|
|
public void onAttachFragment(@NonNull Fragment fragment) {
|
|
}
|
|
|
|
@Override // android.content.ComponentCallbacks
|
|
@CallSuper
|
|
public void onConfigurationChanged(@NonNull Configuration configuration) {
|
|
this.mCalled = true;
|
|
}
|
|
|
|
@MainThread
|
|
public boolean onContextItemSelected(@NonNull MenuItem menuItem) {
|
|
return false;
|
|
}
|
|
|
|
public void onCreate(Bundle bundle) {
|
|
this.mCalled = true;
|
|
restoreChildFragmentState();
|
|
FragmentManager fragmentManager = this.mChildFragmentManager;
|
|
if (fragmentManager.t >= 1) {
|
|
return;
|
|
}
|
|
fragmentManager.F = false;
|
|
fragmentManager.G = false;
|
|
fragmentManager.M.i = false;
|
|
fragmentManager.u(1);
|
|
}
|
|
|
|
@Nullable
|
|
@MainThread
|
|
public Animation onCreateAnimation(int i, boolean z, int i2) {
|
|
return null;
|
|
}
|
|
|
|
@Nullable
|
|
@MainThread
|
|
public Animator onCreateAnimator(int i, boolean z, int i2) {
|
|
return null;
|
|
}
|
|
|
|
@Override // android.view.View.OnCreateContextMenuListener
|
|
@MainThread
|
|
public void onCreateContextMenu(@NonNull ContextMenu contextMenu, @NonNull View view, @Nullable ContextMenu.ContextMenuInfo contextMenuInfo) {
|
|
requireActivity().onCreateContextMenu(contextMenu, view, contextMenuInfo);
|
|
}
|
|
|
|
@MainThread
|
|
@Deprecated
|
|
public void onCreateOptionsMenu(@NonNull Menu menu, @NonNull MenuInflater menuInflater) {
|
|
}
|
|
|
|
@Nullable
|
|
@MainThread
|
|
public View onCreateView(@NonNull LayoutInflater layoutInflater, @Nullable ViewGroup viewGroup, @Nullable Bundle bundle) {
|
|
int i = this.mContentLayoutId;
|
|
if (i != 0) {
|
|
return layoutInflater.inflate(i, viewGroup, false);
|
|
}
|
|
return null;
|
|
}
|
|
|
|
@CallSuper
|
|
@MainThread
|
|
public void onDestroy() {
|
|
this.mCalled = true;
|
|
}
|
|
|
|
@MainThread
|
|
@Deprecated
|
|
public void onDestroyOptionsMenu() {
|
|
}
|
|
|
|
@CallSuper
|
|
@MainThread
|
|
public void onDestroyView() {
|
|
this.mCalled = true;
|
|
}
|
|
|
|
@CallSuper
|
|
@MainThread
|
|
public void onDetach() {
|
|
this.mCalled = true;
|
|
}
|
|
|
|
@NonNull
|
|
public LayoutInflater onGetLayoutInflater(@Nullable Bundle bundle) {
|
|
return getLayoutInflater(bundle);
|
|
}
|
|
|
|
@MainThread
|
|
public void onHiddenChanged(boolean z) {
|
|
}
|
|
|
|
@CallSuper
|
|
@UiThread
|
|
public void onInflate(@NonNull Context context, @NonNull AttributeSet attributeSet, @Nullable Bundle bundle) {
|
|
this.mCalled = true;
|
|
FragmentHostCallback<?> fragmentHostCallback = this.mHost;
|
|
FragmentActivity fragmentActivity = fragmentHostCallback == null ? null : fragmentHostCallback.f1101c;
|
|
if (fragmentActivity != null) {
|
|
this.mCalled = false;
|
|
onInflate((Activity) fragmentActivity, attributeSet, bundle);
|
|
}
|
|
}
|
|
|
|
@Override // android.content.ComponentCallbacks
|
|
@CallSuper
|
|
@MainThread
|
|
public void onLowMemory() {
|
|
this.mCalled = true;
|
|
}
|
|
|
|
public void onMultiWindowModeChanged(boolean z) {
|
|
}
|
|
|
|
@MainThread
|
|
@Deprecated
|
|
public boolean onOptionsItemSelected(@NonNull MenuItem menuItem) {
|
|
return false;
|
|
}
|
|
|
|
@MainThread
|
|
@Deprecated
|
|
public void onOptionsMenuClosed(@NonNull Menu menu) {
|
|
}
|
|
|
|
@CallSuper
|
|
@MainThread
|
|
public void onPause() {
|
|
this.mCalled = true;
|
|
}
|
|
|
|
public void onPictureInPictureModeChanged(boolean z) {
|
|
}
|
|
|
|
@MainThread
|
|
@Deprecated
|
|
public void onPrepareOptionsMenu(@NonNull Menu menu) {
|
|
}
|
|
|
|
@MainThread
|
|
public void onPrimaryNavigationFragmentChanged(boolean z) {
|
|
}
|
|
|
|
@Deprecated
|
|
public void onRequestPermissionsResult(int i, @NonNull String[] strArr, @NonNull int[] iArr) {
|
|
}
|
|
|
|
@CallSuper
|
|
@MainThread
|
|
public void onResume() {
|
|
this.mCalled = true;
|
|
}
|
|
|
|
public void onSaveInstanceState(Bundle bundle) {
|
|
}
|
|
|
|
public void onStart() {
|
|
this.mCalled = true;
|
|
}
|
|
|
|
public void onStop() {
|
|
this.mCalled = true;
|
|
}
|
|
|
|
@MainThread
|
|
public void onViewCreated(@NonNull View view, @Nullable Bundle bundle) {
|
|
}
|
|
|
|
@CallSuper
|
|
@MainThread
|
|
public void onViewStateRestored(@Nullable Bundle bundle) {
|
|
this.mCalled = true;
|
|
}
|
|
|
|
public void performActivityCreated(Bundle bundle) {
|
|
Bundle bundle2;
|
|
this.mChildFragmentManager.P();
|
|
this.mState = 3;
|
|
this.mCalled = false;
|
|
onActivityCreated(bundle);
|
|
if (this.mCalled) {
|
|
if (FragmentManager.J(3)) {
|
|
Log.d("FragmentManager", "moveto RESTORE_VIEW_STATE: " + this);
|
|
}
|
|
if (this.mView != null) {
|
|
Bundle bundle3 = this.mSavedFragmentState;
|
|
if (bundle3 != null) {
|
|
bundle2 = bundle3.getBundle("savedInstanceState");
|
|
} else {
|
|
bundle2 = null;
|
|
}
|
|
restoreViewState(bundle2);
|
|
}
|
|
this.mSavedFragmentState = null;
|
|
FragmentManager fragmentManager = this.mChildFragmentManager;
|
|
fragmentManager.F = false;
|
|
fragmentManager.G = false;
|
|
fragmentManager.M.i = false;
|
|
fragmentManager.u(4);
|
|
return;
|
|
}
|
|
throw new AndroidRuntimeException(android.support.v4.media.a.j("Fragment ", this, " did not call through to super.onActivityCreated()"));
|
|
}
|
|
|
|
public void performAttach() {
|
|
ArrayList<OnPreAttachedListener> arrayList = this.mOnPreAttachedListeners;
|
|
int size = arrayList.size();
|
|
int i = 0;
|
|
while (i < size) {
|
|
OnPreAttachedListener onPreAttachedListener = arrayList.get(i);
|
|
i++;
|
|
onPreAttachedListener.a();
|
|
}
|
|
this.mOnPreAttachedListeners.clear();
|
|
this.mChildFragmentManager.b(this.mHost, createFragmentContainer(), this);
|
|
this.mState = 0;
|
|
this.mCalled = false;
|
|
onAttach((Context) this.mHost.f);
|
|
if (this.mCalled) {
|
|
Iterator it = this.mFragmentManager.n.iterator();
|
|
while (it.hasNext()) {
|
|
((FragmentOnAttachListener) it.next()).a(this);
|
|
}
|
|
FragmentManager fragmentManager = this.mChildFragmentManager;
|
|
fragmentManager.F = false;
|
|
fragmentManager.G = false;
|
|
fragmentManager.M.i = false;
|
|
fragmentManager.u(0);
|
|
return;
|
|
}
|
|
throw new AndroidRuntimeException(android.support.v4.media.a.j("Fragment ", this, " did not call through to super.onAttach()"));
|
|
}
|
|
|
|
public void performConfigurationChanged(@NonNull Configuration configuration) {
|
|
onConfigurationChanged(configuration);
|
|
}
|
|
|
|
public boolean performContextItemSelected(@NonNull MenuItem menuItem) {
|
|
if (!this.mHidden) {
|
|
if (onContextItemSelected(menuItem)) {
|
|
return true;
|
|
}
|
|
return this.mChildFragmentManager.j(menuItem);
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public void performCreate(Bundle bundle) {
|
|
this.mChildFragmentManager.P();
|
|
this.mState = 1;
|
|
this.mCalled = false;
|
|
this.mLifecycleRegistry.a(new LifecycleEventObserver() { // from class: androidx.fragment.app.Fragment.6
|
|
@Override // androidx.lifecycle.LifecycleEventObserver
|
|
public final void b(LifecycleOwner lifecycleOwner, Lifecycle.Event event) {
|
|
View view;
|
|
if (event == Lifecycle.Event.ON_STOP && (view = Fragment.this.mView) != null) {
|
|
view.cancelPendingInputEvents();
|
|
}
|
|
}
|
|
});
|
|
onCreate(bundle);
|
|
this.mIsCreated = true;
|
|
if (this.mCalled) {
|
|
this.mLifecycleRegistry.f(Lifecycle.Event.ON_CREATE);
|
|
return;
|
|
}
|
|
throw new AndroidRuntimeException(android.support.v4.media.a.j("Fragment ", this, " did not call through to super.onCreate()"));
|
|
}
|
|
|
|
public boolean performCreateOptionsMenu(@NonNull Menu menu, @NonNull MenuInflater menuInflater) {
|
|
boolean z = false;
|
|
if (this.mHidden) {
|
|
return false;
|
|
}
|
|
if (this.mHasMenu && this.mMenuVisible) {
|
|
onCreateOptionsMenu(menu, menuInflater);
|
|
z = true;
|
|
}
|
|
return this.mChildFragmentManager.k(menu, menuInflater) | z;
|
|
}
|
|
|
|
public void performCreateView(@NonNull LayoutInflater layoutInflater, @Nullable ViewGroup viewGroup, @Nullable Bundle bundle) {
|
|
this.mChildFragmentManager.P();
|
|
this.mPerformedCreateView = true;
|
|
this.mViewLifecycleOwner = new FragmentViewLifecycleOwner(this, getViewModelStore(), new e(0, this));
|
|
View onCreateView = onCreateView(layoutInflater, viewGroup, bundle);
|
|
this.mView = onCreateView;
|
|
if (onCreateView != null) {
|
|
this.mViewLifecycleOwner.b();
|
|
if (FragmentManager.J(3)) {
|
|
Log.d("FragmentManager", "Setting ViewLifecycleOwner on View " + this.mView + " for Fragment " + this);
|
|
}
|
|
View view = this.mView;
|
|
FragmentViewLifecycleOwner fragmentViewLifecycleOwner = this.mViewLifecycleOwner;
|
|
Intrinsics.checkNotNullParameter(view, "<this>");
|
|
view.setTag(R.id.view_tree_lifecycle_owner, fragmentViewLifecycleOwner);
|
|
View view2 = this.mView;
|
|
FragmentViewLifecycleOwner fragmentViewLifecycleOwner2 = this.mViewLifecycleOwner;
|
|
Intrinsics.checkNotNullParameter(view2, "<this>");
|
|
view2.setTag(androidx.lifecycle.viewmodel.R.id.view_tree_view_model_store_owner, fragmentViewLifecycleOwner2);
|
|
View view3 = this.mView;
|
|
FragmentViewLifecycleOwner fragmentViewLifecycleOwner3 = this.mViewLifecycleOwner;
|
|
Intrinsics.checkNotNullParameter(view3, "<this>");
|
|
view3.setTag(androidx.savedstate.R.id.view_tree_saved_state_registry_owner, fragmentViewLifecycleOwner3);
|
|
this.mViewLifecycleOwnerLiveData.i(this.mViewLifecycleOwner);
|
|
return;
|
|
}
|
|
if (this.mViewLifecycleOwner.i == null) {
|
|
this.mViewLifecycleOwner = null;
|
|
return;
|
|
}
|
|
throw new IllegalStateException("Called getViewLifecycleOwner() but onCreateView() returned null");
|
|
}
|
|
|
|
public void performDestroy() {
|
|
this.mChildFragmentManager.l();
|
|
this.mLifecycleRegistry.f(Lifecycle.Event.ON_DESTROY);
|
|
this.mState = 0;
|
|
this.mCalled = false;
|
|
this.mIsCreated = false;
|
|
onDestroy();
|
|
if (this.mCalled) {
|
|
} else {
|
|
throw new AndroidRuntimeException(android.support.v4.media.a.j("Fragment ", this, " did not call through to super.onDestroy()"));
|
|
}
|
|
}
|
|
|
|
public void performDestroyView() {
|
|
this.mChildFragmentManager.u(1);
|
|
if (this.mView != null) {
|
|
FragmentViewLifecycleOwner fragmentViewLifecycleOwner = this.mViewLifecycleOwner;
|
|
fragmentViewLifecycleOwner.b();
|
|
if (fragmentViewLifecycleOwner.i.f1201c.a(Lifecycle.State.g)) {
|
|
this.mViewLifecycleOwner.a(Lifecycle.Event.ON_DESTROY);
|
|
}
|
|
}
|
|
this.mState = 1;
|
|
this.mCalled = false;
|
|
onDestroyView();
|
|
if (this.mCalled) {
|
|
LoaderManager.b(this).d();
|
|
this.mPerformedCreateView = false;
|
|
return;
|
|
}
|
|
throw new AndroidRuntimeException(android.support.v4.media.a.j("Fragment ", this, " did not call through to super.onDestroyView()"));
|
|
}
|
|
|
|
public void performDetach() {
|
|
this.mState = -1;
|
|
this.mCalled = false;
|
|
onDetach();
|
|
this.mLayoutInflater = null;
|
|
if (this.mCalled) {
|
|
FragmentManager fragmentManager = this.mChildFragmentManager;
|
|
if (!fragmentManager.H) {
|
|
fragmentManager.l();
|
|
this.mChildFragmentManager = new FragmentManager();
|
|
return;
|
|
}
|
|
return;
|
|
}
|
|
throw new AndroidRuntimeException(android.support.v4.media.a.j("Fragment ", this, " did not call through to super.onDetach()"));
|
|
}
|
|
|
|
@NonNull
|
|
public LayoutInflater performGetLayoutInflater(@Nullable Bundle bundle) {
|
|
LayoutInflater onGetLayoutInflater = onGetLayoutInflater(bundle);
|
|
this.mLayoutInflater = onGetLayoutInflater;
|
|
return onGetLayoutInflater;
|
|
}
|
|
|
|
public void performLowMemory() {
|
|
onLowMemory();
|
|
}
|
|
|
|
public void performMultiWindowModeChanged(boolean z) {
|
|
onMultiWindowModeChanged(z);
|
|
}
|
|
|
|
public boolean performOptionsItemSelected(@NonNull MenuItem menuItem) {
|
|
if (!this.mHidden) {
|
|
if (this.mHasMenu && this.mMenuVisible && onOptionsItemSelected(menuItem)) {
|
|
return true;
|
|
}
|
|
return this.mChildFragmentManager.p(menuItem);
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public void performOptionsMenuClosed(@NonNull Menu menu) {
|
|
if (!this.mHidden) {
|
|
if (this.mHasMenu && this.mMenuVisible) {
|
|
onOptionsMenuClosed(menu);
|
|
}
|
|
this.mChildFragmentManager.q(menu);
|
|
}
|
|
}
|
|
|
|
public void performPause() {
|
|
this.mChildFragmentManager.u(5);
|
|
if (this.mView != null) {
|
|
this.mViewLifecycleOwner.a(Lifecycle.Event.ON_PAUSE);
|
|
}
|
|
this.mLifecycleRegistry.f(Lifecycle.Event.ON_PAUSE);
|
|
this.mState = 6;
|
|
this.mCalled = false;
|
|
onPause();
|
|
if (this.mCalled) {
|
|
} else {
|
|
throw new AndroidRuntimeException(android.support.v4.media.a.j("Fragment ", this, " did not call through to super.onPause()"));
|
|
}
|
|
}
|
|
|
|
public void performPictureInPictureModeChanged(boolean z) {
|
|
onPictureInPictureModeChanged(z);
|
|
}
|
|
|
|
public boolean performPrepareOptionsMenu(@NonNull Menu menu) {
|
|
boolean z = false;
|
|
if (this.mHidden) {
|
|
return false;
|
|
}
|
|
if (this.mHasMenu && this.mMenuVisible) {
|
|
onPrepareOptionsMenu(menu);
|
|
z = true;
|
|
}
|
|
return this.mChildFragmentManager.t(menu) | z;
|
|
}
|
|
|
|
public void performPrimaryNavigationFragmentChanged() {
|
|
this.mFragmentManager.getClass();
|
|
boolean M = FragmentManager.M(this);
|
|
Boolean bool = this.mIsPrimaryNavigationFragment;
|
|
if (bool != null && bool.booleanValue() == M) {
|
|
return;
|
|
}
|
|
this.mIsPrimaryNavigationFragment = Boolean.valueOf(M);
|
|
onPrimaryNavigationFragmentChanged(M);
|
|
FragmentManager fragmentManager = this.mChildFragmentManager;
|
|
fragmentManager.e0();
|
|
fragmentManager.r(fragmentManager.x);
|
|
}
|
|
|
|
public void performResume() {
|
|
this.mChildFragmentManager.P();
|
|
this.mChildFragmentManager.y(true);
|
|
this.mState = 7;
|
|
this.mCalled = false;
|
|
onResume();
|
|
if (this.mCalled) {
|
|
LifecycleRegistry lifecycleRegistry = this.mLifecycleRegistry;
|
|
Lifecycle.Event event = Lifecycle.Event.ON_RESUME;
|
|
lifecycleRegistry.f(event);
|
|
if (this.mView != null) {
|
|
this.mViewLifecycleOwner.i.f(event);
|
|
}
|
|
FragmentManager fragmentManager = this.mChildFragmentManager;
|
|
fragmentManager.F = false;
|
|
fragmentManager.G = false;
|
|
fragmentManager.M.i = false;
|
|
fragmentManager.u(7);
|
|
return;
|
|
}
|
|
throw new AndroidRuntimeException(android.support.v4.media.a.j("Fragment ", this, " did not call through to super.onResume()"));
|
|
}
|
|
|
|
public void performSaveInstanceState(Bundle bundle) {
|
|
onSaveInstanceState(bundle);
|
|
}
|
|
|
|
public void performStart() {
|
|
this.mChildFragmentManager.P();
|
|
this.mChildFragmentManager.y(true);
|
|
this.mState = 5;
|
|
this.mCalled = false;
|
|
onStart();
|
|
if (this.mCalled) {
|
|
LifecycleRegistry lifecycleRegistry = this.mLifecycleRegistry;
|
|
Lifecycle.Event event = Lifecycle.Event.ON_START;
|
|
lifecycleRegistry.f(event);
|
|
if (this.mView != null) {
|
|
this.mViewLifecycleOwner.i.f(event);
|
|
}
|
|
FragmentManager fragmentManager = this.mChildFragmentManager;
|
|
fragmentManager.F = false;
|
|
fragmentManager.G = false;
|
|
fragmentManager.M.i = false;
|
|
fragmentManager.u(5);
|
|
return;
|
|
}
|
|
throw new AndroidRuntimeException(android.support.v4.media.a.j("Fragment ", this, " did not call through to super.onStart()"));
|
|
}
|
|
|
|
public void performStop() {
|
|
FragmentManager fragmentManager = this.mChildFragmentManager;
|
|
fragmentManager.G = true;
|
|
fragmentManager.M.i = true;
|
|
fragmentManager.u(4);
|
|
if (this.mView != null) {
|
|
this.mViewLifecycleOwner.a(Lifecycle.Event.ON_STOP);
|
|
}
|
|
this.mLifecycleRegistry.f(Lifecycle.Event.ON_STOP);
|
|
this.mState = 4;
|
|
this.mCalled = false;
|
|
onStop();
|
|
if (this.mCalled) {
|
|
} else {
|
|
throw new AndroidRuntimeException(android.support.v4.media.a.j("Fragment ", this, " did not call through to super.onStop()"));
|
|
}
|
|
}
|
|
|
|
public void performViewCreated() {
|
|
Bundle bundle;
|
|
Bundle bundle2 = this.mSavedFragmentState;
|
|
if (bundle2 != null) {
|
|
bundle = bundle2.getBundle("savedInstanceState");
|
|
} else {
|
|
bundle = null;
|
|
}
|
|
onViewCreated(this.mView, bundle);
|
|
this.mChildFragmentManager.u(2);
|
|
}
|
|
|
|
public void postponeEnterTransition() {
|
|
a().u = true;
|
|
}
|
|
|
|
@NonNull
|
|
@MainThread
|
|
public final <I, O> ActivityResultLauncher<I> registerForActivityResult(@NonNull ActivityResultContract<I, O> activityResultContract, @NonNull ActivityResultCallback<O> activityResultCallback) {
|
|
return e(activityResultContract, new Function<Void, ActivityResultRegistry>() { // from class: androidx.fragment.app.Fragment.7
|
|
@Override // androidx.arch.core.util.Function
|
|
public final Object apply() {
|
|
Fragment fragment = Fragment.this;
|
|
Object obj = fragment.mHost;
|
|
if (obj instanceof ActivityResultRegistryOwner) {
|
|
return ((ActivityResultRegistryOwner) obj).v();
|
|
}
|
|
return fragment.requireActivity().m;
|
|
}
|
|
}, activityResultCallback);
|
|
}
|
|
|
|
public void registerForContextMenu(@NonNull View view) {
|
|
view.setOnCreateContextMenuListener(this);
|
|
}
|
|
|
|
@Deprecated
|
|
public final void requestPermissions(@NonNull String[] strArr, int i) {
|
|
if (this.mHost != null) {
|
|
FragmentManager parentFragmentManager = getParentFragmentManager();
|
|
if (parentFragmentManager.C != null) {
|
|
parentFragmentManager.D.addLast(new FragmentManager.LaunchedFragmentInfo(this.mWho, i));
|
|
parentFragmentManager.C.a(strArr);
|
|
return;
|
|
}
|
|
parentFragmentManager.u.getClass();
|
|
return;
|
|
}
|
|
throw new IllegalStateException(android.support.v4.media.a.j("Fragment ", this, " not attached to Activity"));
|
|
}
|
|
|
|
@NonNull
|
|
public final FragmentActivity requireActivity() {
|
|
FragmentActivity activity = getActivity();
|
|
if (activity != null) {
|
|
return activity;
|
|
}
|
|
throw new IllegalStateException(android.support.v4.media.a.j("Fragment ", this, " not attached to an activity."));
|
|
}
|
|
|
|
@NonNull
|
|
public final Bundle requireArguments() {
|
|
Bundle arguments = getArguments();
|
|
if (arguments != null) {
|
|
return arguments;
|
|
}
|
|
throw new IllegalStateException(android.support.v4.media.a.j("Fragment ", this, " does not have any arguments."));
|
|
}
|
|
|
|
@NonNull
|
|
public final Context requireContext() {
|
|
Context context = getContext();
|
|
if (context != null) {
|
|
return context;
|
|
}
|
|
throw new IllegalStateException(android.support.v4.media.a.j("Fragment ", this, " not attached to a context."));
|
|
}
|
|
|
|
@NonNull
|
|
@Deprecated
|
|
public final FragmentManager requireFragmentManager() {
|
|
return getParentFragmentManager();
|
|
}
|
|
|
|
@NonNull
|
|
public final Object requireHost() {
|
|
Object host = getHost();
|
|
if (host != null) {
|
|
return host;
|
|
}
|
|
throw new IllegalStateException(android.support.v4.media.a.j("Fragment ", this, " not attached to a host."));
|
|
}
|
|
|
|
@NonNull
|
|
public final Fragment requireParentFragment() {
|
|
Fragment parentFragment = getParentFragment();
|
|
if (parentFragment == null) {
|
|
if (getContext() == null) {
|
|
throw new IllegalStateException(android.support.v4.media.a.j("Fragment ", this, " is not attached to any Fragment or host"));
|
|
}
|
|
throw new IllegalStateException("Fragment " + this + " is not a child Fragment, it is directly attached to " + getContext());
|
|
}
|
|
return parentFragment;
|
|
}
|
|
|
|
@NonNull
|
|
public final View requireView() {
|
|
View view = getView();
|
|
if (view != null) {
|
|
return view;
|
|
}
|
|
throw new IllegalStateException(android.support.v4.media.a.j("Fragment ", this, " did not return a View from onCreateView() or this was called before onCreateView()."));
|
|
}
|
|
|
|
public void restoreChildFragmentState() {
|
|
Bundle bundle;
|
|
Bundle bundle2 = this.mSavedFragmentState;
|
|
if (bundle2 != null && (bundle = bundle2.getBundle("childFragmentManager")) != null) {
|
|
this.mChildFragmentManager.V(bundle);
|
|
FragmentManager fragmentManager = this.mChildFragmentManager;
|
|
fragmentManager.F = false;
|
|
fragmentManager.G = false;
|
|
fragmentManager.M.i = false;
|
|
fragmentManager.u(1);
|
|
}
|
|
}
|
|
|
|
public final void restoreViewState(Bundle bundle) {
|
|
SparseArray<Parcelable> sparseArray = this.mSavedViewState;
|
|
if (sparseArray != null) {
|
|
this.mView.restoreHierarchyState(sparseArray);
|
|
this.mSavedViewState = null;
|
|
}
|
|
this.mCalled = false;
|
|
onViewStateRestored(bundle);
|
|
if (this.mCalled) {
|
|
if (this.mView != null) {
|
|
this.mViewLifecycleOwner.a(Lifecycle.Event.ON_CREATE);
|
|
return;
|
|
}
|
|
return;
|
|
}
|
|
throw new AndroidRuntimeException(android.support.v4.media.a.j("Fragment ", this, " did not call through to super.onViewStateRestored()"));
|
|
}
|
|
|
|
public void setAllowEnterTransitionOverlap(boolean z) {
|
|
a().p = Boolean.valueOf(z);
|
|
}
|
|
|
|
public void setAllowReturnTransitionOverlap(boolean z) {
|
|
a().o = Boolean.valueOf(z);
|
|
}
|
|
|
|
public void setAnimations(@AnimRes int i, @AnimRes int i2, @AnimRes int i3, @AnimRes int i4) {
|
|
if (this.mAnimationInfo == null && i == 0 && i2 == 0 && i3 == 0 && i4 == 0) {
|
|
return;
|
|
}
|
|
a().b = i;
|
|
a().f1094c = i2;
|
|
a().d = i3;
|
|
a().e = i4;
|
|
}
|
|
|
|
public void setArguments(@Nullable Bundle bundle) {
|
|
if (this.mFragmentManager != null && isStateSaved()) {
|
|
throw new IllegalStateException("Fragment already added and state has been saved");
|
|
}
|
|
this.mArguments = bundle;
|
|
}
|
|
|
|
public void setEnterSharedElementCallback(@Nullable SharedElementCallback sharedElementCallback) {
|
|
a().q = sharedElementCallback;
|
|
}
|
|
|
|
public void setEnterTransition(@Nullable Object obj) {
|
|
a().i = obj;
|
|
}
|
|
|
|
public void setExitSharedElementCallback(@Nullable SharedElementCallback sharedElementCallback) {
|
|
a().r = sharedElementCallback;
|
|
}
|
|
|
|
public void setExitTransition(@Nullable Object obj) {
|
|
a().k = obj;
|
|
}
|
|
|
|
public void setFocusedView(View view) {
|
|
a().t = view;
|
|
}
|
|
|
|
@Deprecated
|
|
public void setHasOptionsMenu(boolean z) {
|
|
if (this.mHasMenu != z) {
|
|
this.mHasMenu = z;
|
|
if (isAdded() && !isHidden()) {
|
|
this.mHost.h();
|
|
}
|
|
}
|
|
}
|
|
|
|
public void setInitialSavedState(@Nullable SavedState savedState) {
|
|
Bundle bundle;
|
|
if (this.mFragmentManager == null) {
|
|
if (savedState == null || (bundle = savedState.f1095c) == null) {
|
|
bundle = null;
|
|
}
|
|
this.mSavedFragmentState = bundle;
|
|
return;
|
|
}
|
|
throw new IllegalStateException("Fragment already added");
|
|
}
|
|
|
|
public void setMenuVisibility(boolean z) {
|
|
if (this.mMenuVisible != z) {
|
|
this.mMenuVisible = z;
|
|
if (this.mHasMenu && isAdded() && !isHidden()) {
|
|
this.mHost.h();
|
|
}
|
|
}
|
|
}
|
|
|
|
public void setNextTransition(int i) {
|
|
if (this.mAnimationInfo == null && i == 0) {
|
|
return;
|
|
}
|
|
a();
|
|
this.mAnimationInfo.f = i;
|
|
}
|
|
|
|
public void setPopDirection(boolean z) {
|
|
if (this.mAnimationInfo == null) {
|
|
return;
|
|
}
|
|
a().f1093a = z;
|
|
}
|
|
|
|
public void setPostOnViewCreatedAlpha(float f) {
|
|
a().s = f;
|
|
}
|
|
|
|
public void setReenterTransition(@Nullable Object obj) {
|
|
a().l = obj;
|
|
}
|
|
|
|
@Deprecated
|
|
public void setRetainInstance(boolean z) {
|
|
FragmentStrictMode.Policy policy = FragmentStrictMode.f1161a;
|
|
Intrinsics.checkNotNullParameter(this, "fragment");
|
|
Intrinsics.checkNotNullParameter(this, "fragment");
|
|
Intrinsics.checkNotNullParameter(this, "fragment");
|
|
Violation violation = new Violation(this, "Attempting to set retain instance for fragment " + this);
|
|
FragmentStrictMode.c(violation);
|
|
FragmentStrictMode.Policy a2 = FragmentStrictMode.a(this);
|
|
if (a2.f1164a.contains(FragmentStrictMode.Flag.j) && FragmentStrictMode.e(a2, getClass(), SetRetainInstanceUsageViolation.class)) {
|
|
FragmentStrictMode.b(a2, violation);
|
|
}
|
|
this.mRetainInstance = z;
|
|
FragmentManager fragmentManager = this.mFragmentManager;
|
|
if (fragmentManager != null) {
|
|
if (z) {
|
|
fragmentManager.M.c(this);
|
|
return;
|
|
} else {
|
|
fragmentManager.M.f(this);
|
|
return;
|
|
}
|
|
}
|
|
this.mRetainInstanceChangedWhileDetached = true;
|
|
}
|
|
|
|
public void setReturnTransition(@Nullable Object obj) {
|
|
a().j = obj;
|
|
}
|
|
|
|
public void setSharedElementEnterTransition(@Nullable Object obj) {
|
|
a().m = obj;
|
|
}
|
|
|
|
public void setSharedElementNames(@Nullable ArrayList<String> arrayList, @Nullable ArrayList<String> arrayList2) {
|
|
a();
|
|
AnimationInfo animationInfo = this.mAnimationInfo;
|
|
animationInfo.g = arrayList;
|
|
animationInfo.h = arrayList2;
|
|
}
|
|
|
|
public void setSharedElementReturnTransition(@Nullable Object obj) {
|
|
a().n = obj;
|
|
}
|
|
|
|
@Deprecated
|
|
public void setTargetFragment(@Nullable Fragment targetFragment, int i) {
|
|
FragmentManager fragmentManager;
|
|
if (targetFragment != null) {
|
|
FragmentStrictMode.Policy policy = FragmentStrictMode.f1161a;
|
|
Intrinsics.checkNotNullParameter(this, "violatingFragment");
|
|
Intrinsics.checkNotNullParameter(targetFragment, "targetFragment");
|
|
Intrinsics.checkNotNullParameter(this, "fragment");
|
|
Intrinsics.checkNotNullParameter(targetFragment, "targetFragment");
|
|
Intrinsics.checkNotNullParameter(this, "fragment");
|
|
Violation violation = new Violation(this, "Attempting to set target fragment " + targetFragment + " with request code " + i + " for fragment " + this);
|
|
FragmentStrictMode.c(violation);
|
|
FragmentStrictMode.Policy a2 = FragmentStrictMode.a(this);
|
|
if (a2.f1164a.contains(FragmentStrictMode.Flag.l) && FragmentStrictMode.e(a2, getClass(), SetTargetFragmentUsageViolation.class)) {
|
|
FragmentStrictMode.b(a2, violation);
|
|
}
|
|
}
|
|
FragmentManager fragmentManager2 = this.mFragmentManager;
|
|
if (targetFragment != null) {
|
|
fragmentManager = targetFragment.mFragmentManager;
|
|
} else {
|
|
fragmentManager = null;
|
|
}
|
|
if (fragmentManager2 != null && fragmentManager != null && fragmentManager2 != fragmentManager) {
|
|
throw new IllegalArgumentException(android.support.v4.media.a.j("Fragment ", targetFragment, " must share the same FragmentManager to be set as a target fragment"));
|
|
}
|
|
for (Fragment fragment = targetFragment; fragment != null; fragment = fragment.c(false)) {
|
|
if (fragment.equals(this)) {
|
|
throw new IllegalArgumentException("Setting " + targetFragment + " as the target of " + this + " would create a target cycle");
|
|
}
|
|
}
|
|
if (targetFragment == null) {
|
|
this.mTargetWho = null;
|
|
this.mTarget = null;
|
|
} else if (this.mFragmentManager != null && targetFragment.mFragmentManager != null) {
|
|
this.mTargetWho = targetFragment.mWho;
|
|
this.mTarget = null;
|
|
} else {
|
|
this.mTargetWho = null;
|
|
this.mTarget = targetFragment;
|
|
}
|
|
this.mTargetRequestCode = i;
|
|
}
|
|
|
|
@Deprecated
|
|
public void setUserVisibleHint(boolean z) {
|
|
FragmentStrictMode.Policy policy = FragmentStrictMode.f1161a;
|
|
Intrinsics.checkNotNullParameter(this, "fragment");
|
|
Intrinsics.checkNotNullParameter(this, "fragment");
|
|
Violation violation = new Violation(this, "Attempting to set user visible hint to " + z + " for fragment " + this);
|
|
FragmentStrictMode.c(violation);
|
|
FragmentStrictMode.Policy a2 = FragmentStrictMode.a(this);
|
|
if (a2.f1164a.contains(FragmentStrictMode.Flag.k) && FragmentStrictMode.e(a2, getClass(), SetUserVisibleHintViolation.class)) {
|
|
FragmentStrictMode.b(a2, violation);
|
|
}
|
|
boolean z2 = false;
|
|
if (!this.mUserVisibleHint && z && this.mState < 5 && this.mFragmentManager != null && isAdded() && this.mIsCreated) {
|
|
FragmentManager fragmentManager = this.mFragmentManager;
|
|
FragmentStateManager g = fragmentManager.g(this);
|
|
Fragment fragment = g.f1119c;
|
|
if (fragment.mDeferStart) {
|
|
if (fragmentManager.b) {
|
|
fragmentManager.I = true;
|
|
} else {
|
|
fragment.mDeferStart = false;
|
|
g.k();
|
|
}
|
|
}
|
|
}
|
|
this.mUserVisibleHint = z;
|
|
if (this.mState < 5 && !z) {
|
|
z2 = true;
|
|
}
|
|
this.mDeferStart = z2;
|
|
if (this.mSavedFragmentState != null) {
|
|
this.mSavedUserVisibleHint = Boolean.valueOf(z);
|
|
}
|
|
}
|
|
|
|
public boolean shouldShowRequestPermissionRationale(@NonNull String str) {
|
|
FragmentHostCallback<?> fragmentHostCallback = this.mHost;
|
|
if (fragmentHostCallback != null) {
|
|
return fragmentHostCallback.g(str);
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public void startActivity(@NonNull Intent intent) {
|
|
startActivity(intent, null);
|
|
}
|
|
|
|
@Deprecated
|
|
public void startActivityForResult(@NonNull Intent intent, int i) {
|
|
startActivityForResult(intent, i, null);
|
|
}
|
|
|
|
@Deprecated
|
|
public void startIntentSenderForResult(@NonNull IntentSender intentSender, int i, @Nullable Intent intent, int i2, int i3, int i4, @Nullable Bundle bundle) {
|
|
if (this.mHost != null) {
|
|
if (FragmentManager.J(2)) {
|
|
Log.v("FragmentManager", "Fragment " + this + " received the following in startIntentSenderForResult() requestCode: " + i + " IntentSender: " + intentSender + " fillInIntent: " + intent + " options: " + bundle);
|
|
}
|
|
FragmentManager parentFragmentManager = getParentFragmentManager();
|
|
if (parentFragmentManager.B != null) {
|
|
if (bundle != null) {
|
|
if (intent == null) {
|
|
intent = new Intent();
|
|
intent.putExtra("androidx.fragment.extra.ACTIVITY_OPTIONS_BUNDLE", true);
|
|
}
|
|
if (FragmentManager.J(2)) {
|
|
Log.v("FragmentManager", "ActivityOptions " + bundle + " were added to fillInIntent " + intent + " for fragment " + this);
|
|
}
|
|
intent.putExtra("androidx.activity.result.contract.extra.ACTIVITY_OPTIONS_BUNDLE", bundle);
|
|
}
|
|
IntentSenderRequest.Builder builder = new IntentSenderRequest.Builder(intentSender);
|
|
builder.b = intent;
|
|
builder.d = i3;
|
|
builder.f65c = i2;
|
|
IntentSenderRequest a2 = builder.a();
|
|
parentFragmentManager.D.addLast(new FragmentManager.LaunchedFragmentInfo(this.mWho, i));
|
|
if (FragmentManager.J(2)) {
|
|
Log.v("FragmentManager", "Fragment " + this + "is launching an IntentSender for result ");
|
|
}
|
|
parentFragmentManager.B.a(a2);
|
|
return;
|
|
}
|
|
FragmentHostCallback fragmentHostCallback = parentFragmentManager.u;
|
|
if (i == -1) {
|
|
fragmentHostCallback.f1101c.startIntentSenderForResult(intentSender, i, intent, i2, i3, i4, bundle);
|
|
return;
|
|
} else {
|
|
fragmentHostCallback.getClass();
|
|
throw new IllegalStateException("Starting intent sender with a requestCode requires a FragmentActivity host");
|
|
}
|
|
}
|
|
throw new IllegalStateException(android.support.v4.media.a.j("Fragment ", this, " not attached to Activity"));
|
|
}
|
|
|
|
public void startPostponedEnterTransition() {
|
|
if (this.mAnimationInfo != null && a().u) {
|
|
if (this.mHost == null) {
|
|
a().u = false;
|
|
} else if (Looper.myLooper() != this.mHost.g.getLooper()) {
|
|
this.mHost.g.postAtFrontOfQueue(new Runnable() { // from class: androidx.fragment.app.Fragment.3
|
|
@Override // java.lang.Runnable
|
|
public final void run() {
|
|
Fragment.this.callStartTransitionListener(false);
|
|
}
|
|
});
|
|
} else {
|
|
callStartTransitionListener(true);
|
|
}
|
|
}
|
|
}
|
|
|
|
@NonNull
|
|
public String toString() {
|
|
StringBuilder sb = new StringBuilder(Uuid.SIZE_BITS);
|
|
sb.append(getClass().getSimpleName());
|
|
sb.append("{");
|
|
sb.append(Integer.toHexString(System.identityHashCode(this)));
|
|
sb.append("} (");
|
|
sb.append(this.mWho);
|
|
if (this.mFragmentId != 0) {
|
|
sb.append(" id=0x");
|
|
sb.append(Integer.toHexString(this.mFragmentId));
|
|
}
|
|
if (this.mTag != null) {
|
|
sb.append(" tag=");
|
|
sb.append(this.mTag);
|
|
}
|
|
sb.append(")");
|
|
return sb.toString();
|
|
}
|
|
|
|
public void unregisterForContextMenu(@NonNull View view) {
|
|
view.setOnCreateContextMenuListener(null);
|
|
}
|
|
|
|
@NonNull
|
|
@Deprecated
|
|
public static Fragment instantiate(@NonNull Context context, @NonNull String str, @Nullable Bundle bundle) {
|
|
try {
|
|
Fragment fragment = (Fragment) FragmentFactory.c(context.getClassLoader(), str).getConstructor(null).newInstance(null);
|
|
if (bundle == null) {
|
|
return fragment;
|
|
}
|
|
bundle.setClassLoader(fragment.getClass().getClassLoader());
|
|
fragment.setArguments(bundle);
|
|
return fragment;
|
|
} catch (IllegalAccessException e) {
|
|
throw new RuntimeException(android.support.v4.media.a.l("Unable to instantiate fragment ", str, ": make sure class name exists, is public, and has an empty constructor that is public"), e);
|
|
} catch (java.lang.InstantiationException e2) {
|
|
throw new RuntimeException(android.support.v4.media.a.l("Unable to instantiate fragment ", str, ": make sure class name exists, is public, and has an empty constructor that is public"), e2);
|
|
} catch (NoSuchMethodException e3) {
|
|
throw new RuntimeException(android.support.v4.media.a.l("Unable to instantiate fragment ", str, ": could not find Fragment constructor"), e3);
|
|
} catch (InvocationTargetException e4) {
|
|
throw new RuntimeException(android.support.v4.media.a.l("Unable to instantiate fragment ", str, ": calling Fragment constructor caused an exception"), e4);
|
|
}
|
|
}
|
|
|
|
@NonNull
|
|
public final String getString(@StringRes int i, @Nullable Object... objArr) {
|
|
return getResources().getString(i, objArr);
|
|
}
|
|
|
|
public final void postponeEnterTransition(long j, @NonNull TimeUnit timeUnit) {
|
|
a().u = true;
|
|
Handler handler = this.mPostponedHandler;
|
|
if (handler != null) {
|
|
handler.removeCallbacks(this.mPostponedDurationRunnable);
|
|
}
|
|
FragmentManager fragmentManager = this.mFragmentManager;
|
|
if (fragmentManager != null) {
|
|
this.mPostponedHandler = fragmentManager.u.g;
|
|
} else {
|
|
this.mPostponedHandler = new Handler(Looper.getMainLooper());
|
|
}
|
|
this.mPostponedHandler.removeCallbacks(this.mPostponedDurationRunnable);
|
|
this.mPostponedHandler.postDelayed(this.mPostponedDurationRunnable, timeUnit.toMillis(j));
|
|
}
|
|
|
|
@NonNull
|
|
@MainThread
|
|
public final <I, O> ActivityResultLauncher<I> registerForActivityResult(@NonNull ActivityResultContract<I, O> activityResultContract, @NonNull final ActivityResultRegistry activityResultRegistry, @NonNull ActivityResultCallback<O> activityResultCallback) {
|
|
return e(activityResultContract, new Function<Void, ActivityResultRegistry>() { // from class: androidx.fragment.app.Fragment.8
|
|
@Override // androidx.arch.core.util.Function
|
|
public final Object apply() {
|
|
return ActivityResultRegistry.this;
|
|
}
|
|
}, activityResultCallback);
|
|
}
|
|
|
|
public void startActivity(@NonNull Intent intent, @Nullable Bundle bundle) {
|
|
FragmentHostCallback<?> fragmentHostCallback = this.mHost;
|
|
if (fragmentHostCallback != null) {
|
|
fragmentHostCallback.f.startActivity(intent, bundle);
|
|
return;
|
|
}
|
|
throw new IllegalStateException(android.support.v4.media.a.j("Fragment ", this, " not attached to Activity"));
|
|
}
|
|
|
|
@Deprecated
|
|
public void startActivityForResult(@NonNull Intent intent, int i, @Nullable Bundle bundle) {
|
|
if (this.mHost != null) {
|
|
FragmentManager parentFragmentManager = getParentFragmentManager();
|
|
if (parentFragmentManager.A != null) {
|
|
parentFragmentManager.D.addLast(new FragmentManager.LaunchedFragmentInfo(this.mWho, i));
|
|
if (bundle != null) {
|
|
intent.putExtra("androidx.activity.result.contract.extra.ACTIVITY_OPTIONS_BUNDLE", bundle);
|
|
}
|
|
parentFragmentManager.A.a(intent);
|
|
return;
|
|
}
|
|
FragmentHostCallback fragmentHostCallback = parentFragmentManager.u;
|
|
if (i == -1) {
|
|
fragmentHostCallback.f.startActivity(intent, bundle);
|
|
return;
|
|
} else {
|
|
fragmentHostCallback.getClass();
|
|
throw new IllegalStateException("Starting activity with a requestCode requires a FragmentActivity host");
|
|
}
|
|
}
|
|
throw new IllegalStateException(android.support.v4.media.a.j("Fragment ", this, " not attached to Activity"));
|
|
}
|
|
|
|
@NonNull
|
|
@RestrictTo
|
|
@Deprecated
|
|
public LayoutInflater getLayoutInflater(@Nullable Bundle bundle) {
|
|
FragmentHostCallback<?> fragmentHostCallback = this.mHost;
|
|
if (fragmentHostCallback != null) {
|
|
LayoutInflater f = fragmentHostCallback.f();
|
|
f.setFactory2(this.mChildFragmentManager.f);
|
|
return f;
|
|
}
|
|
throw new IllegalStateException("onGetLayoutInflater() cannot be executed until the Fragment is attached to the FragmentManager.");
|
|
}
|
|
|
|
@CallSuper
|
|
@MainThread
|
|
@Deprecated
|
|
public void onAttach(@NonNull Activity activity) {
|
|
this.mCalled = true;
|
|
}
|
|
|
|
@CallSuper
|
|
@UiThread
|
|
@Deprecated
|
|
public void onInflate(@NonNull Activity activity, @NonNull AttributeSet attributeSet, @Nullable Bundle bundle) {
|
|
this.mCalled = true;
|
|
}
|
|
}
|