2025 lines
73 KiB
Java
2025 lines
73 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.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.contract.ActivityResultContract;
|
|
import androidx.annotation.CallSuper;
|
|
import androidx.annotation.ContentView;
|
|
import androidx.annotation.LayoutRes;
|
|
import androidx.annotation.MainThread;
|
|
import androidx.annotation.NonNull;
|
|
import androidx.annotation.Nullable;
|
|
import androidx.annotation.RestrictTo;
|
|
import androidx.annotation.StringRes;
|
|
import androidx.annotation.UiThread;
|
|
import androidx.arch.core.util.Function;
|
|
import androidx.core.app.ActivityOptionsCompat;
|
|
import androidx.core.app.SharedElementCallback;
|
|
import androidx.core.view.LayoutInflaterCompat;
|
|
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.SavedStateViewModelFactory;
|
|
import androidx.lifecycle.ViewModelProvider;
|
|
import androidx.lifecycle.ViewModelStore;
|
|
import androidx.lifecycle.ViewModelStoreOwner;
|
|
import androidx.lifecycle.ViewTreeLifecycleOwner;
|
|
import androidx.lifecycle.ViewTreeViewModelStoreOwner;
|
|
import androidx.loader.app.LoaderManager;
|
|
import androidx.savedstate.SavedStateRegistry;
|
|
import androidx.savedstate.SavedStateRegistryController;
|
|
import androidx.savedstate.SavedStateRegistryOwner;
|
|
import androidx.savedstate.ViewTreeSavedStateRegistryOwner;
|
|
import c.d.b.a.a;
|
|
import java.io.FileDescriptor;
|
|
import java.io.PrintWriter;
|
|
import java.lang.reflect.InvocationTargetException;
|
|
import java.util.ArrayList;
|
|
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;
|
|
public class Fragment implements ComponentCallbacks, View.OnCreateContextMenuListener, LifecycleOwner, ViewModelStoreOwner, HasDefaultViewModelProviderFactory, SavedStateRegistryOwner, ActivityResultCaller {
|
|
public static final int ACTIVITY_CREATED = 4;
|
|
public static final int ATTACHED = 0;
|
|
public static final int AWAITING_ENTER_EFFECTS = 6;
|
|
public static final int AWAITING_EXIT_EFFECTS = 3;
|
|
public static final int CREATED = 1;
|
|
public static final int INITIALIZING = -1;
|
|
public static final int RESUMED = 7;
|
|
public static final int STARTED = 5;
|
|
public static final Object USE_DEFAULT_TRANSITION = new Object();
|
|
public static final int VIEW_CREATED = 2;
|
|
public boolean mAdded;
|
|
public AnimationInfo mAnimationInfo;
|
|
public Bundle mArguments;
|
|
public int mBackStackNesting;
|
|
private boolean mCalled;
|
|
@NonNull
|
|
public FragmentManager mChildFragmentManager;
|
|
public ViewGroup mContainer;
|
|
public int mContainerId;
|
|
@LayoutRes
|
|
private int mContentLayoutId;
|
|
private ViewModelProvider.Factory mDefaultFactory;
|
|
public boolean mDeferStart;
|
|
public boolean mDetached;
|
|
public int mFragmentId;
|
|
public FragmentManager mFragmentManager;
|
|
public boolean mFromLayout;
|
|
public boolean mHasMenu;
|
|
public boolean mHidden;
|
|
public boolean mHiddenChanged;
|
|
public FragmentHostCallback<?> mHost;
|
|
public boolean mInLayout;
|
|
public boolean mIsCreated;
|
|
public boolean mIsNewlyAdded;
|
|
private Boolean mIsPrimaryNavigationFragment;
|
|
public LayoutInflater mLayoutInflater;
|
|
public LifecycleRegistry mLifecycleRegistry;
|
|
public Lifecycle.State mMaxState;
|
|
public boolean mMenuVisible;
|
|
private final AtomicInteger mNextLocalRequestCode;
|
|
private final ArrayList<OnPreAttachedListener> mOnPreAttachedListeners;
|
|
public Fragment mParentFragment;
|
|
public boolean mPerformedCreateView;
|
|
public float mPostponedAlpha;
|
|
public Runnable mPostponedDurationRunnable;
|
|
public boolean mRemoving;
|
|
public boolean mRestored;
|
|
public boolean mRetainInstance;
|
|
public boolean mRetainInstanceChangedWhileDetached;
|
|
public Bundle mSavedFragmentState;
|
|
public SavedStateRegistryController mSavedStateRegistryController;
|
|
@Nullable
|
|
public Boolean mSavedUserVisibleHint;
|
|
public Bundle mSavedViewRegistryState;
|
|
public SparseArray<Parcelable> mSavedViewState;
|
|
public int mState;
|
|
public String mTag;
|
|
public Fragment mTarget;
|
|
public int mTargetRequestCode;
|
|
public String mTargetWho;
|
|
public boolean mUserVisibleHint;
|
|
public View mView;
|
|
@Nullable
|
|
public FragmentViewLifecycleOwner mViewLifecycleOwner;
|
|
public MutableLiveData<LifecycleOwner> mViewLifecycleOwnerLiveData;
|
|
@NonNull
|
|
public String mWho;
|
|
|
|
/* renamed from: androidx.fragment.app.Fragment$1 reason: invalid class name */
|
|
public class AnonymousClass1 implements Runnable {
|
|
public AnonymousClass1() {
|
|
}
|
|
|
|
@Override // java.lang.Runnable
|
|
public void run() {
|
|
Fragment.this.startPostponedEnterTransition();
|
|
}
|
|
}
|
|
|
|
/* renamed from: androidx.fragment.app.Fragment$2 reason: invalid class name */
|
|
public class AnonymousClass2 implements Runnable {
|
|
public AnonymousClass2() {
|
|
}
|
|
|
|
@Override // java.lang.Runnable
|
|
public void run() {
|
|
Fragment.this.callStartTransitionListener(false);
|
|
}
|
|
}
|
|
|
|
/* renamed from: androidx.fragment.app.Fragment$3 reason: invalid class name */
|
|
public class AnonymousClass3 implements Runnable {
|
|
public final /* synthetic */ SpecialEffectsController val$controller;
|
|
|
|
public AnonymousClass3(SpecialEffectsController specialEffectsController) {
|
|
this.val$controller = specialEffectsController;
|
|
}
|
|
|
|
@Override // java.lang.Runnable
|
|
public void run() {
|
|
this.val$controller.executePendingOperations();
|
|
}
|
|
}
|
|
|
|
/* renamed from: androidx.fragment.app.Fragment$4 reason: invalid class name */
|
|
public class AnonymousClass4 extends FragmentContainer {
|
|
public AnonymousClass4() {
|
|
}
|
|
|
|
@Override // androidx.fragment.app.FragmentContainer
|
|
@Nullable
|
|
public View onFindViewById(int i) {
|
|
View view = Fragment.this.mView;
|
|
if (view != null) {
|
|
return view.findViewById(i);
|
|
}
|
|
StringBuilder K = a.K("Fragment ");
|
|
K.append(Fragment.this);
|
|
K.append(" does not have a view");
|
|
throw new IllegalStateException(K.toString());
|
|
}
|
|
|
|
@Override // androidx.fragment.app.FragmentContainer
|
|
public boolean onHasView() {
|
|
return Fragment.this.mView != null;
|
|
}
|
|
}
|
|
|
|
/* renamed from: androidx.fragment.app.Fragment$5 reason: invalid class name */
|
|
public class AnonymousClass5 implements LifecycleEventObserver {
|
|
public AnonymousClass5() {
|
|
}
|
|
|
|
@Override // androidx.lifecycle.LifecycleEventObserver
|
|
public void onStateChanged(@NonNull LifecycleOwner lifecycleOwner, @NonNull Lifecycle.Event event) {
|
|
View view;
|
|
if (event == Lifecycle.Event.ON_STOP && (view = Fragment.this.mView) != null) {
|
|
view.cancelPendingInputEvents();
|
|
}
|
|
}
|
|
}
|
|
|
|
/* renamed from: androidx.fragment.app.Fragment$6 reason: invalid class name */
|
|
public class AnonymousClass6 implements Function<Void, ActivityResultRegistry> {
|
|
public AnonymousClass6() {
|
|
}
|
|
|
|
public ActivityResultRegistry apply(Void r3) {
|
|
Fragment fragment = Fragment.this;
|
|
FragmentHostCallback<?> fragmentHostCallback = fragment.mHost;
|
|
return fragmentHostCallback instanceof ActivityResultRegistryOwner ? ((ActivityResultRegistryOwner) fragmentHostCallback).getActivityResultRegistry() : fragment.requireActivity().getActivityResultRegistry();
|
|
}
|
|
}
|
|
|
|
/* renamed from: androidx.fragment.app.Fragment$7 reason: invalid class name */
|
|
public class AnonymousClass7 implements Function<Void, ActivityResultRegistry> {
|
|
public final /* synthetic */ ActivityResultRegistry val$registry;
|
|
|
|
public AnonymousClass7(ActivityResultRegistry activityResultRegistry) {
|
|
this.val$registry = activityResultRegistry;
|
|
}
|
|
|
|
public ActivityResultRegistry apply(Void r1) {
|
|
return this.val$registry;
|
|
}
|
|
}
|
|
|
|
/* renamed from: androidx.fragment.app.Fragment$8 reason: invalid class name */
|
|
public class AnonymousClass8 extends OnPreAttachedListener {
|
|
public final /* synthetic */ ActivityResultCallback val$callback;
|
|
public final /* synthetic */ ActivityResultContract val$contract;
|
|
public final /* synthetic */ AtomicReference val$ref;
|
|
public final /* synthetic */ Function val$registryProvider;
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public AnonymousClass8(Function function, AtomicReference atomicReference, ActivityResultContract activityResultContract, ActivityResultCallback activityResultCallback) {
|
|
super(null);
|
|
this.val$registryProvider = function;
|
|
this.val$ref = atomicReference;
|
|
this.val$contract = activityResultContract;
|
|
this.val$callback = activityResultCallback;
|
|
}
|
|
|
|
@Override // androidx.fragment.app.Fragment.OnPreAttachedListener
|
|
public void onPreAttached() {
|
|
this.val$ref.set(((ActivityResultRegistry) this.val$registryProvider.apply(null)).register(Fragment.this.generateActivityResultKey(), Fragment.this, this.val$contract, this.val$callback));
|
|
}
|
|
}
|
|
|
|
/* renamed from: androidx.fragment.app.Fragment$9 reason: invalid class name */
|
|
public class AnonymousClass9 extends ActivityResultLauncher<I> {
|
|
public final /* synthetic */ ActivityResultContract val$contract;
|
|
public final /* synthetic */ AtomicReference val$ref;
|
|
|
|
public AnonymousClass9(AtomicReference atomicReference, ActivityResultContract activityResultContract) {
|
|
this.val$ref = atomicReference;
|
|
this.val$contract = activityResultContract;
|
|
}
|
|
|
|
@Override // androidx.activity.result.ActivityResultLauncher
|
|
@NonNull
|
|
public ActivityResultContract<I, ?> getContract() {
|
|
return this.val$contract;
|
|
}
|
|
|
|
@Override // androidx.activity.result.ActivityResultLauncher
|
|
public void launch(I i, @Nullable ActivityOptionsCompat activityOptionsCompat) {
|
|
ActivityResultLauncher activityResultLauncher = (ActivityResultLauncher) this.val$ref.get();
|
|
if (activityResultLauncher != null) {
|
|
activityResultLauncher.launch(i, activityOptionsCompat);
|
|
return;
|
|
}
|
|
throw new IllegalStateException("Operation cannot be started before fragment is in created state");
|
|
}
|
|
|
|
@Override // androidx.activity.result.ActivityResultLauncher
|
|
public void unregister() {
|
|
ActivityResultLauncher activityResultLauncher = (ActivityResultLauncher) this.val$ref.getAndSet(null);
|
|
if (activityResultLauncher != null) {
|
|
activityResultLauncher.unregister();
|
|
}
|
|
}
|
|
}
|
|
|
|
public static class AnimationInfo {
|
|
public Boolean mAllowEnterTransitionOverlap;
|
|
public Boolean mAllowReturnTransitionOverlap;
|
|
public View mAnimatingAway;
|
|
public Animator mAnimator;
|
|
public Object mEnterTransition = null;
|
|
public SharedElementCallback mEnterTransitionCallback;
|
|
public boolean mEnterTransitionPostponed;
|
|
public Object mExitTransition;
|
|
public SharedElementCallback mExitTransitionCallback;
|
|
public View mFocusedView;
|
|
public boolean mIsHideReplaced;
|
|
public int mNextAnim;
|
|
public int mNextTransition;
|
|
public float mPostOnViewCreatedAlpha;
|
|
public Object mReenterTransition;
|
|
public Object mReturnTransition;
|
|
public Object mSharedElementEnterTransition;
|
|
public Object mSharedElementReturnTransition;
|
|
public ArrayList<String> mSharedElementSourceNames;
|
|
public ArrayList<String> mSharedElementTargetNames;
|
|
public OnStartEnterTransitionListener mStartEnterTransitionListener;
|
|
|
|
public AnimationInfo() {
|
|
Object obj = Fragment.USE_DEFAULT_TRANSITION;
|
|
this.mReturnTransition = obj;
|
|
this.mExitTransition = null;
|
|
this.mReenterTransition = obj;
|
|
this.mSharedElementEnterTransition = null;
|
|
this.mSharedElementReturnTransition = obj;
|
|
this.mEnterTransitionCallback = null;
|
|
this.mExitTransitionCallback = null;
|
|
this.mPostOnViewCreatedAlpha = 1.0f;
|
|
this.mFocusedView = null;
|
|
}
|
|
}
|
|
|
|
public static class InstantiationException extends RuntimeException {
|
|
public InstantiationException(@NonNull String str, @Nullable Exception exc) {
|
|
super(str, exc);
|
|
}
|
|
}
|
|
|
|
public static abstract class OnPreAttachedListener {
|
|
private OnPreAttachedListener() {
|
|
}
|
|
|
|
public /* synthetic */ OnPreAttachedListener(AnonymousClass1 r1) {
|
|
this();
|
|
}
|
|
|
|
public abstract void onPreAttached();
|
|
}
|
|
|
|
public interface OnStartEnterTransitionListener {
|
|
void onStartEnterTransition();
|
|
|
|
void startListening();
|
|
}
|
|
|
|
@SuppressLint({"BanParcelableUsage, ParcelClassLoader"})
|
|
public static class SavedState implements Parcelable {
|
|
@NonNull
|
|
public static final Parcelable.Creator<SavedState> CREATOR = new AnonymousClass1();
|
|
public final Bundle mState;
|
|
|
|
/* renamed from: androidx.fragment.app.Fragment$SavedState$1 reason: invalid class name */
|
|
public class AnonymousClass1 implements Parcelable.ClassLoaderCreator<SavedState> {
|
|
@Override // android.os.Parcelable.Creator
|
|
public SavedState createFromParcel(Parcel parcel) {
|
|
return new SavedState(parcel, null);
|
|
}
|
|
|
|
@Override // android.os.Parcelable.ClassLoaderCreator
|
|
public SavedState createFromParcel(Parcel parcel, ClassLoader classLoader) {
|
|
return new SavedState(parcel, classLoader);
|
|
}
|
|
|
|
@Override // android.os.Parcelable.Creator
|
|
public SavedState[] newArray(int i) {
|
|
return new SavedState[i];
|
|
}
|
|
}
|
|
|
|
public SavedState(Bundle bundle) {
|
|
this.mState = bundle;
|
|
}
|
|
|
|
public SavedState(@NonNull Parcel parcel, @Nullable ClassLoader classLoader) {
|
|
Bundle readBundle = parcel.readBundle();
|
|
this.mState = readBundle;
|
|
if (classLoader != null && readBundle != null) {
|
|
readBundle.setClassLoader(classLoader);
|
|
}
|
|
}
|
|
|
|
@Override // android.os.Parcelable
|
|
public int describeContents() {
|
|
return 0;
|
|
}
|
|
|
|
@Override // android.os.Parcelable
|
|
public void writeToParcel(@NonNull Parcel parcel, int i) {
|
|
parcel.writeBundle(this.mState);
|
|
}
|
|
}
|
|
|
|
public Fragment() {
|
|
this.mState = -1;
|
|
this.mWho = UUID.randomUUID().toString();
|
|
this.mTargetWho = null;
|
|
this.mIsPrimaryNavigationFragment = null;
|
|
this.mChildFragmentManager = new FragmentManagerImpl();
|
|
this.mMenuVisible = true;
|
|
this.mUserVisibleHint = true;
|
|
this.mPostponedDurationRunnable = new AnonymousClass1();
|
|
this.mMaxState = Lifecycle.State.RESUMED;
|
|
this.mViewLifecycleOwnerLiveData = new MutableLiveData<>();
|
|
this.mNextLocalRequestCode = new AtomicInteger();
|
|
this.mOnPreAttachedListeners = new ArrayList<>();
|
|
initLifecycle();
|
|
}
|
|
|
|
@ContentView
|
|
public Fragment(@LayoutRes int i) {
|
|
this();
|
|
this.mContentLayoutId = i;
|
|
}
|
|
|
|
private AnimationInfo ensureAnimationInfo() {
|
|
if (this.mAnimationInfo == null) {
|
|
this.mAnimationInfo = new AnimationInfo();
|
|
}
|
|
return this.mAnimationInfo;
|
|
}
|
|
|
|
private int getMinimumMaxLifecycleState() {
|
|
Lifecycle.State state = this.mMaxState;
|
|
return (state == Lifecycle.State.INITIALIZED || this.mParentFragment == null) ? state.ordinal() : Math.min(state.ordinal(), this.mParentFragment.getMinimumMaxLifecycleState());
|
|
}
|
|
|
|
private void initLifecycle() {
|
|
this.mLifecycleRegistry = new LifecycleRegistry(this);
|
|
this.mSavedStateRegistryController = SavedStateRegistryController.create(this);
|
|
}
|
|
|
|
@NonNull
|
|
@Deprecated
|
|
public static Fragment instantiate(@NonNull Context context, @NonNull String str) {
|
|
return instantiate(context, str, null);
|
|
}
|
|
|
|
@NonNull
|
|
@Deprecated
|
|
public static Fragment instantiate(@NonNull Context context, @NonNull String str, @Nullable Bundle bundle) {
|
|
try {
|
|
Fragment fragment = (Fragment) FragmentFactory.loadFragmentClass(context.getClassLoader(), str).getConstructor(new Class[0]).newInstance(new Object[0]);
|
|
if (bundle != null) {
|
|
bundle.setClassLoader(fragment.getClass().getClassLoader());
|
|
fragment.setArguments(bundle);
|
|
}
|
|
return fragment;
|
|
} catch (InstantiationException e) {
|
|
throw new InstantiationException(a.t("Unable to instantiate fragment ", str, ": make sure class name exists, is public, and has an empty constructor that is public"), e);
|
|
} catch (IllegalAccessException e2) {
|
|
throw new InstantiationException(a.t("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 InstantiationException(a.t("Unable to instantiate fragment ", str, ": could not find Fragment constructor"), e3);
|
|
} catch (InvocationTargetException e4) {
|
|
throw new InstantiationException(a.t("Unable to instantiate fragment ", str, ": calling Fragment constructor caused an exception"), e4);
|
|
}
|
|
}
|
|
|
|
@NonNull
|
|
private <I, O> ActivityResultLauncher<I> prepareCallInternal(@NonNull ActivityResultContract<I, O> activityResultContract, @NonNull Function<Void, ActivityResultRegistry> function, @NonNull ActivityResultCallback<O> activityResultCallback) {
|
|
if (this.mState <= 1) {
|
|
AtomicReference atomicReference = new AtomicReference();
|
|
registerOnPreAttachListener(new AnonymousClass8(function, atomicReference, activityResultContract, activityResultCallback));
|
|
return new AnonymousClass9(atomicReference, activityResultContract);
|
|
}
|
|
throw new IllegalStateException(a.q("Fragment ", this, " is attempting to registerForActivityResult after being created. Fragments must call registerForActivityResult() before they are created (i.e. initialization, onAttach(), or onCreate())."));
|
|
}
|
|
|
|
private void registerOnPreAttachListener(@NonNull OnPreAttachedListener onPreAttachedListener) {
|
|
if (this.mState >= 0) {
|
|
onPreAttachedListener.onPreAttached();
|
|
} else {
|
|
this.mOnPreAttachedListeners.add(onPreAttachedListener);
|
|
}
|
|
}
|
|
|
|
private void restoreViewState() {
|
|
if (FragmentManager.isLoggingEnabled(3)) {
|
|
Log.d("FragmentManager", "moveto RESTORE_VIEW_STATE: " + this);
|
|
}
|
|
if (this.mView != null) {
|
|
restoreViewState(this.mSavedFragmentState);
|
|
}
|
|
this.mSavedFragmentState = null;
|
|
}
|
|
|
|
public void callStartTransitionListener(boolean z2) {
|
|
ViewGroup viewGroup;
|
|
FragmentManager fragmentManager;
|
|
AnimationInfo animationInfo = this.mAnimationInfo;
|
|
OnStartEnterTransitionListener onStartEnterTransitionListener = null;
|
|
if (animationInfo != null) {
|
|
animationInfo.mEnterTransitionPostponed = false;
|
|
OnStartEnterTransitionListener onStartEnterTransitionListener2 = animationInfo.mStartEnterTransitionListener;
|
|
animationInfo.mStartEnterTransitionListener = null;
|
|
onStartEnterTransitionListener = onStartEnterTransitionListener2;
|
|
}
|
|
if (onStartEnterTransitionListener != null) {
|
|
onStartEnterTransitionListener.onStartEnterTransition();
|
|
} else if (FragmentManager.USE_STATE_MANAGER && this.mView != null && (viewGroup = this.mContainer) != null && (fragmentManager = this.mFragmentManager) != null) {
|
|
SpecialEffectsController orCreateController = SpecialEffectsController.getOrCreateController(viewGroup, fragmentManager);
|
|
orCreateController.markPostponedState();
|
|
if (z2) {
|
|
this.mHost.getHandler().post(new AnonymousClass3(orCreateController));
|
|
} else {
|
|
orCreateController.executePendingOperations();
|
|
}
|
|
}
|
|
}
|
|
|
|
@NonNull
|
|
public FragmentContainer createFragmentContainer() {
|
|
return new AnonymousClass4();
|
|
}
|
|
|
|
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 targetFragment = getTargetFragment();
|
|
if (targetFragment != null) {
|
|
printWriter.print(str);
|
|
printWriter.print("mTarget=");
|
|
printWriter.print(targetFragment);
|
|
printWriter.print(" mTargetRequestCode=");
|
|
printWriter.println(this.mTargetRequestCode);
|
|
}
|
|
if (getNextAnim() != 0) {
|
|
printWriter.print(str);
|
|
printWriter.print("mNextAnim=");
|
|
printWriter.println(getNextAnim());
|
|
}
|
|
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.getInstance(this).dump(str, fileDescriptor, printWriter, strArr);
|
|
}
|
|
printWriter.print(str);
|
|
printWriter.println("Child " + this.mChildFragmentManager + ":");
|
|
this.mChildFragmentManager.dump(a.s(str, " "), fileDescriptor, printWriter, strArr);
|
|
}
|
|
|
|
@Override // java.lang.Object
|
|
public final boolean equals(@Nullable Object obj) {
|
|
return super.equals(obj);
|
|
}
|
|
|
|
@Nullable
|
|
public Fragment findFragmentByWho(@NonNull String str) {
|
|
return str.equals(this.mWho) ? this : this.mChildFragmentManager.findFragmentByWho(str);
|
|
}
|
|
|
|
@NonNull
|
|
public String generateActivityResultKey() {
|
|
StringBuilder K = a.K("fragment_");
|
|
K.append(this.mWho);
|
|
K.append("_rq#");
|
|
K.append(this.mNextLocalRequestCode.getAndIncrement());
|
|
return K.toString();
|
|
}
|
|
|
|
@Nullable
|
|
public final FragmentActivity getActivity() {
|
|
FragmentHostCallback<?> fragmentHostCallback = this.mHost;
|
|
if (fragmentHostCallback == null) {
|
|
return null;
|
|
}
|
|
return (FragmentActivity) fragmentHostCallback.getActivity();
|
|
}
|
|
|
|
public boolean getAllowEnterTransitionOverlap() {
|
|
Boolean bool;
|
|
AnimationInfo animationInfo = this.mAnimationInfo;
|
|
if (animationInfo == null || (bool = animationInfo.mAllowEnterTransitionOverlap) == null) {
|
|
return true;
|
|
}
|
|
return bool.booleanValue();
|
|
}
|
|
|
|
public boolean getAllowReturnTransitionOverlap() {
|
|
Boolean bool;
|
|
AnimationInfo animationInfo = this.mAnimationInfo;
|
|
if (animationInfo == null || (bool = animationInfo.mAllowReturnTransitionOverlap) == null) {
|
|
return true;
|
|
}
|
|
return bool.booleanValue();
|
|
}
|
|
|
|
public View getAnimatingAway() {
|
|
AnimationInfo animationInfo = this.mAnimationInfo;
|
|
if (animationInfo == null) {
|
|
return null;
|
|
}
|
|
return animationInfo.mAnimatingAway;
|
|
}
|
|
|
|
public Animator getAnimator() {
|
|
AnimationInfo animationInfo = this.mAnimationInfo;
|
|
if (animationInfo == null) {
|
|
return null;
|
|
}
|
|
return animationInfo.mAnimator;
|
|
}
|
|
|
|
@Nullable
|
|
public final Bundle getArguments() {
|
|
return this.mArguments;
|
|
}
|
|
|
|
@NonNull
|
|
public final FragmentManager getChildFragmentManager() {
|
|
if (this.mHost != null) {
|
|
return this.mChildFragmentManager;
|
|
}
|
|
throw new IllegalStateException(a.q("Fragment ", this, " has not been attached yet."));
|
|
}
|
|
|
|
@Nullable
|
|
public Context getContext() {
|
|
FragmentHostCallback<?> fragmentHostCallback = this.mHost;
|
|
if (fragmentHostCallback == null) {
|
|
return null;
|
|
}
|
|
return fragmentHostCallback.getContext();
|
|
}
|
|
|
|
@Override // androidx.lifecycle.HasDefaultViewModelProviderFactory
|
|
@NonNull
|
|
public ViewModelProvider.Factory getDefaultViewModelProviderFactory() {
|
|
if (this.mFragmentManager != null) {
|
|
if (this.mDefaultFactory == null) {
|
|
Application application = null;
|
|
Context applicationContext = requireContext().getApplicationContext();
|
|
while (true) {
|
|
if (!(applicationContext instanceof ContextWrapper)) {
|
|
break;
|
|
} else if (applicationContext instanceof Application) {
|
|
application = (Application) applicationContext;
|
|
break;
|
|
} else {
|
|
applicationContext = ((ContextWrapper) applicationContext).getBaseContext();
|
|
}
|
|
}
|
|
if (application == null && FragmentManager.isLoggingEnabled(3)) {
|
|
StringBuilder K = a.K("Could not find Application instance from Context ");
|
|
K.append(requireContext().getApplicationContext());
|
|
K.append(", you will not be able to use AndroidViewModel with the default ViewModelProvider.Factory");
|
|
Log.d("FragmentManager", K.toString());
|
|
}
|
|
this.mDefaultFactory = new SavedStateViewModelFactory(application, this, getArguments());
|
|
}
|
|
return this.mDefaultFactory;
|
|
}
|
|
throw new IllegalStateException("Can't access ViewModels from detached fragment");
|
|
}
|
|
|
|
@Nullable
|
|
public Object getEnterTransition() {
|
|
AnimationInfo animationInfo = this.mAnimationInfo;
|
|
if (animationInfo == null) {
|
|
return null;
|
|
}
|
|
return animationInfo.mEnterTransition;
|
|
}
|
|
|
|
public SharedElementCallback getEnterTransitionCallback() {
|
|
AnimationInfo animationInfo = this.mAnimationInfo;
|
|
if (animationInfo == null) {
|
|
return null;
|
|
}
|
|
return animationInfo.mEnterTransitionCallback;
|
|
}
|
|
|
|
@Nullable
|
|
public Object getExitTransition() {
|
|
AnimationInfo animationInfo = this.mAnimationInfo;
|
|
if (animationInfo == null) {
|
|
return null;
|
|
}
|
|
return animationInfo.mExitTransition;
|
|
}
|
|
|
|
public SharedElementCallback getExitTransitionCallback() {
|
|
AnimationInfo animationInfo = this.mAnimationInfo;
|
|
if (animationInfo == null) {
|
|
return null;
|
|
}
|
|
return animationInfo.mExitTransitionCallback;
|
|
}
|
|
|
|
public View getFocusedView() {
|
|
AnimationInfo animationInfo = this.mAnimationInfo;
|
|
if (animationInfo == null) {
|
|
return null;
|
|
}
|
|
return animationInfo.mFocusedView;
|
|
}
|
|
|
|
@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.onGetHost();
|
|
}
|
|
|
|
public final int getId() {
|
|
return this.mFragmentId;
|
|
}
|
|
|
|
@NonNull
|
|
public final LayoutInflater getLayoutInflater() {
|
|
LayoutInflater layoutInflater = this.mLayoutInflater;
|
|
return layoutInflater == null ? performGetLayoutInflater(null) : layoutInflater;
|
|
}
|
|
|
|
@NonNull
|
|
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
|
|
@Deprecated
|
|
public LayoutInflater getLayoutInflater(@Nullable Bundle bundle) {
|
|
FragmentHostCallback<?> fragmentHostCallback = this.mHost;
|
|
if (fragmentHostCallback != null) {
|
|
LayoutInflater onGetLayoutInflater = fragmentHostCallback.onGetLayoutInflater();
|
|
LayoutInflaterCompat.setFactory2(onGetLayoutInflater, this.mChildFragmentManager.getLayoutInflaterFactory());
|
|
return onGetLayoutInflater;
|
|
}
|
|
throw new IllegalStateException("onGetLayoutInflater() cannot be executed until the Fragment is attached to the FragmentManager.");
|
|
}
|
|
|
|
@Override // androidx.lifecycle.LifecycleOwner
|
|
@NonNull
|
|
public Lifecycle getLifecycle() {
|
|
return this.mLifecycleRegistry;
|
|
}
|
|
|
|
@NonNull
|
|
@Deprecated
|
|
public LoaderManager getLoaderManager() {
|
|
return LoaderManager.getInstance(this);
|
|
}
|
|
|
|
public int getNextAnim() {
|
|
AnimationInfo animationInfo = this.mAnimationInfo;
|
|
if (animationInfo == null) {
|
|
return 0;
|
|
}
|
|
return animationInfo.mNextAnim;
|
|
}
|
|
|
|
public int getNextTransition() {
|
|
AnimationInfo animationInfo = this.mAnimationInfo;
|
|
if (animationInfo == null) {
|
|
return 0;
|
|
}
|
|
return animationInfo.mNextTransition;
|
|
}
|
|
|
|
@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(a.q("Fragment ", this, " not associated with a fragment manager."));
|
|
}
|
|
|
|
public float getPostOnViewCreatedAlpha() {
|
|
AnimationInfo animationInfo = this.mAnimationInfo;
|
|
if (animationInfo == null) {
|
|
return 1.0f;
|
|
}
|
|
return animationInfo.mPostOnViewCreatedAlpha;
|
|
}
|
|
|
|
@Nullable
|
|
public Object getReenterTransition() {
|
|
AnimationInfo animationInfo = this.mAnimationInfo;
|
|
if (animationInfo == null) {
|
|
return null;
|
|
}
|
|
Object obj = animationInfo.mReenterTransition;
|
|
return obj == USE_DEFAULT_TRANSITION ? getExitTransition() : obj;
|
|
}
|
|
|
|
@NonNull
|
|
public final Resources getResources() {
|
|
return requireContext().getResources();
|
|
}
|
|
|
|
@Deprecated
|
|
public final boolean getRetainInstance() {
|
|
return this.mRetainInstance;
|
|
}
|
|
|
|
@Nullable
|
|
public Object getReturnTransition() {
|
|
AnimationInfo animationInfo = this.mAnimationInfo;
|
|
if (animationInfo == null) {
|
|
return null;
|
|
}
|
|
Object obj = animationInfo.mReturnTransition;
|
|
return obj == USE_DEFAULT_TRANSITION ? getEnterTransition() : obj;
|
|
}
|
|
|
|
@Override // androidx.savedstate.SavedStateRegistryOwner
|
|
@NonNull
|
|
public final SavedStateRegistry getSavedStateRegistry() {
|
|
return this.mSavedStateRegistryController.getSavedStateRegistry();
|
|
}
|
|
|
|
@Nullable
|
|
public Object getSharedElementEnterTransition() {
|
|
AnimationInfo animationInfo = this.mAnimationInfo;
|
|
if (animationInfo == null) {
|
|
return null;
|
|
}
|
|
return animationInfo.mSharedElementEnterTransition;
|
|
}
|
|
|
|
@Nullable
|
|
public Object getSharedElementReturnTransition() {
|
|
AnimationInfo animationInfo = this.mAnimationInfo;
|
|
if (animationInfo == null) {
|
|
return null;
|
|
}
|
|
Object obj = animationInfo.mSharedElementReturnTransition;
|
|
return obj == USE_DEFAULT_TRANSITION ? getSharedElementEnterTransition() : obj;
|
|
}
|
|
|
|
@NonNull
|
|
public ArrayList<String> getSharedElementSourceNames() {
|
|
ArrayList<String> arrayList;
|
|
AnimationInfo animationInfo = this.mAnimationInfo;
|
|
return (animationInfo == null || (arrayList = animationInfo.mSharedElementSourceNames) == null) ? new ArrayList<>() : arrayList;
|
|
}
|
|
|
|
@NonNull
|
|
public ArrayList<String> getSharedElementTargetNames() {
|
|
ArrayList<String> arrayList;
|
|
AnimationInfo animationInfo = this.mAnimationInfo;
|
|
return (animationInfo == null || (arrayList = animationInfo.mSharedElementTargetNames) == null) ? new ArrayList<>() : arrayList;
|
|
}
|
|
|
|
@NonNull
|
|
public final String getString(@StringRes int i) {
|
|
return getResources().getString(i);
|
|
}
|
|
|
|
@NonNull
|
|
public final String getString(@StringRes int i, @Nullable Object... objArr) {
|
|
return getResources().getString(i, objArr);
|
|
}
|
|
|
|
@Nullable
|
|
public final String getTag() {
|
|
return this.mTag;
|
|
}
|
|
|
|
@Nullable
|
|
@Deprecated
|
|
public final Fragment getTargetFragment() {
|
|
String str;
|
|
Fragment fragment = this.mTarget;
|
|
if (fragment != null) {
|
|
return fragment;
|
|
}
|
|
FragmentManager fragmentManager = this.mFragmentManager;
|
|
if (fragmentManager == null || (str = this.mTargetWho) == null) {
|
|
return null;
|
|
}
|
|
return fragmentManager.findActiveFragment(str);
|
|
}
|
|
|
|
@Deprecated
|
|
public final int getTargetRequestCode() {
|
|
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("Can't access the Fragment View's LifecycleOwner 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) {
|
|
throw new IllegalStateException("Can't access ViewModels from detached fragment");
|
|
} else if (getMinimumMaxLifecycleState() != Lifecycle.State.INITIALIZED.ordinal()) {
|
|
return this.mFragmentManager.getViewModelStore(this);
|
|
} else {
|
|
throw new IllegalStateException("Calling getViewModelStore() before a Fragment reaches onCreate() when using setMaxLifecycle(INITIALIZED) is not supported");
|
|
}
|
|
}
|
|
|
|
@SuppressLint({"KotlinPropertyAccess"})
|
|
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
|
|
public final boolean hasOptionsMenu() {
|
|
return this.mHasMenu;
|
|
}
|
|
|
|
@Override // java.lang.Object
|
|
public final int hashCode() {
|
|
return super.hashCode();
|
|
}
|
|
|
|
public void initState() {
|
|
initLifecycle();
|
|
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 FragmentManagerImpl();
|
|
this.mHost = null;
|
|
this.mFragmentId = 0;
|
|
this.mContainerId = 0;
|
|
this.mTag = null;
|
|
this.mHidden = false;
|
|
this.mDetached = false;
|
|
}
|
|
|
|
public final boolean isAdded() {
|
|
return this.mHost != null && this.mAdded;
|
|
}
|
|
|
|
public final boolean isDetached() {
|
|
return this.mDetached;
|
|
}
|
|
|
|
public final boolean isHidden() {
|
|
return this.mHidden;
|
|
}
|
|
|
|
public boolean isHideReplaced() {
|
|
AnimationInfo animationInfo = this.mAnimationInfo;
|
|
if (animationInfo == null) {
|
|
return false;
|
|
}
|
|
return animationInfo.mIsHideReplaced;
|
|
}
|
|
|
|
public final boolean isInBackStack() {
|
|
return this.mBackStackNesting > 0;
|
|
}
|
|
|
|
public final boolean isInLayout() {
|
|
return this.mInLayout;
|
|
}
|
|
|
|
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
|
|
public final boolean isMenuVisible() {
|
|
FragmentManager fragmentManager;
|
|
return this.mMenuVisible && ((fragmentManager = this.mFragmentManager) == null || fragmentManager.isParentMenuVisible(this.mParentFragment));
|
|
}
|
|
|
|
public boolean isPostponed() {
|
|
AnimationInfo animationInfo = this.mAnimationInfo;
|
|
if (animationInfo == null) {
|
|
return false;
|
|
}
|
|
return animationInfo.mEnterTransitionPostponed;
|
|
}
|
|
|
|
public final boolean isRemoving() {
|
|
return this.mRemoving;
|
|
}
|
|
|
|
public final boolean isRemovingParent() {
|
|
Fragment parentFragment = getParentFragment();
|
|
return parentFragment != null && (parentFragment.isRemoving() || parentFragment.isRemovingParent());
|
|
}
|
|
|
|
public final boolean isResumed() {
|
|
return this.mState >= 7;
|
|
}
|
|
|
|
public final boolean isStateSaved() {
|
|
FragmentManager fragmentManager = this.mFragmentManager;
|
|
if (fragmentManager == null) {
|
|
return false;
|
|
}
|
|
return fragmentManager.isStateSaved();
|
|
}
|
|
|
|
public final boolean isVisible() {
|
|
View view;
|
|
return isAdded() && !isHidden() && (view = this.mView) != null && view.getWindowToken() != null && this.mView.getVisibility() == 0;
|
|
}
|
|
|
|
public void noteStateNotSaved() {
|
|
this.mChildFragmentManager.noteStateNotSaved();
|
|
}
|
|
|
|
@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.isLoggingEnabled(2)) {
|
|
Log.v("FragmentManager", "Fragment " + this + " received the following in onActivityResult(): requestCode: " + i + " resultCode: " + i2 + " data: " + intent);
|
|
}
|
|
}
|
|
|
|
@CallSuper
|
|
@MainThread
|
|
@Deprecated
|
|
public void onAttach(@NonNull Activity activity) {
|
|
this.mCalled = true;
|
|
}
|
|
|
|
@CallSuper
|
|
@MainThread
|
|
public void onAttach(@NonNull Context context) {
|
|
this.mCalled = true;
|
|
FragmentHostCallback<?> fragmentHostCallback = this.mHost;
|
|
Activity activity = fragmentHostCallback == null ? null : fragmentHostCallback.getActivity();
|
|
if (activity != null) {
|
|
this.mCalled = false;
|
|
onAttach(activity);
|
|
}
|
|
}
|
|
|
|
@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;
|
|
}
|
|
|
|
@CallSuper
|
|
@MainThread
|
|
public void onCreate(@Nullable Bundle bundle) {
|
|
this.mCalled = true;
|
|
restoreChildFragmentState(bundle);
|
|
if (!this.mChildFragmentManager.isStateAtLeast(1)) {
|
|
this.mChildFragmentManager.dispatchCreate();
|
|
}
|
|
}
|
|
|
|
@Nullable
|
|
@MainThread
|
|
public Animation onCreateAnimation(int i, boolean z2, int i2) {
|
|
return null;
|
|
}
|
|
|
|
@Nullable
|
|
@MainThread
|
|
public Animator onCreateAnimator(int i, boolean z2, 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
|
|
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
|
|
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 z2) {
|
|
}
|
|
|
|
@CallSuper
|
|
@UiThread
|
|
@Deprecated
|
|
public void onInflate(@NonNull Activity activity, @NonNull AttributeSet attributeSet, @Nullable Bundle bundle) {
|
|
this.mCalled = true;
|
|
}
|
|
|
|
@CallSuper
|
|
@UiThread
|
|
public void onInflate(@NonNull Context context, @NonNull AttributeSet attributeSet, @Nullable Bundle bundle) {
|
|
this.mCalled = true;
|
|
FragmentHostCallback<?> fragmentHostCallback = this.mHost;
|
|
Activity activity = fragmentHostCallback == null ? null : fragmentHostCallback.getActivity();
|
|
if (activity != null) {
|
|
this.mCalled = false;
|
|
onInflate(activity, attributeSet, bundle);
|
|
}
|
|
}
|
|
|
|
@Override // android.content.ComponentCallbacks
|
|
@CallSuper
|
|
@MainThread
|
|
public void onLowMemory() {
|
|
this.mCalled = true;
|
|
}
|
|
|
|
public void onMultiWindowModeChanged(boolean z2) {
|
|
}
|
|
|
|
@MainThread
|
|
public boolean onOptionsItemSelected(@NonNull MenuItem menuItem) {
|
|
return false;
|
|
}
|
|
|
|
@MainThread
|
|
public void onOptionsMenuClosed(@NonNull Menu menu) {
|
|
}
|
|
|
|
@CallSuper
|
|
@MainThread
|
|
public void onPause() {
|
|
this.mCalled = true;
|
|
}
|
|
|
|
public void onPictureInPictureModeChanged(boolean z2) {
|
|
}
|
|
|
|
@MainThread
|
|
public void onPrepareOptionsMenu(@NonNull Menu menu) {
|
|
}
|
|
|
|
@MainThread
|
|
public void onPrimaryNavigationFragmentChanged(boolean z2) {
|
|
}
|
|
|
|
@Deprecated
|
|
public void onRequestPermissionsResult(int i, @NonNull String[] strArr, @NonNull int[] iArr) {
|
|
}
|
|
|
|
@CallSuper
|
|
@MainThread
|
|
public void onResume() {
|
|
this.mCalled = true;
|
|
}
|
|
|
|
@MainThread
|
|
public void onSaveInstanceState(@NonNull Bundle bundle) {
|
|
}
|
|
|
|
@CallSuper
|
|
@MainThread
|
|
public void onStart() {
|
|
this.mCalled = true;
|
|
}
|
|
|
|
@CallSuper
|
|
@MainThread
|
|
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) {
|
|
this.mChildFragmentManager.noteStateNotSaved();
|
|
this.mState = 3;
|
|
this.mCalled = false;
|
|
onActivityCreated(bundle);
|
|
if (this.mCalled) {
|
|
restoreViewState();
|
|
this.mChildFragmentManager.dispatchActivityCreated();
|
|
return;
|
|
}
|
|
throw new SuperNotCalledException(a.q("Fragment ", this, " did not call through to super.onActivityCreated()"));
|
|
}
|
|
|
|
public void performAttach() {
|
|
Iterator<OnPreAttachedListener> it = this.mOnPreAttachedListeners.iterator();
|
|
while (it.hasNext()) {
|
|
it.next().onPreAttached();
|
|
}
|
|
this.mOnPreAttachedListeners.clear();
|
|
this.mChildFragmentManager.attachController(this.mHost, createFragmentContainer(), this);
|
|
this.mState = 0;
|
|
this.mCalled = false;
|
|
onAttach(this.mHost.getContext());
|
|
if (this.mCalled) {
|
|
this.mFragmentManager.dispatchOnAttachFragment(this);
|
|
this.mChildFragmentManager.dispatchAttach();
|
|
return;
|
|
}
|
|
throw new SuperNotCalledException(a.q("Fragment ", this, " did not call through to super.onAttach()"));
|
|
}
|
|
|
|
public void performConfigurationChanged(@NonNull Configuration configuration) {
|
|
onConfigurationChanged(configuration);
|
|
this.mChildFragmentManager.dispatchConfigurationChanged(configuration);
|
|
}
|
|
|
|
public boolean performContextItemSelected(@NonNull MenuItem menuItem) {
|
|
if (this.mHidden) {
|
|
return false;
|
|
}
|
|
if (onContextItemSelected(menuItem)) {
|
|
return true;
|
|
}
|
|
return this.mChildFragmentManager.dispatchContextItemSelected(menuItem);
|
|
}
|
|
|
|
public void performCreate(Bundle bundle) {
|
|
this.mChildFragmentManager.noteStateNotSaved();
|
|
this.mState = 1;
|
|
this.mCalled = false;
|
|
this.mLifecycleRegistry.addObserver(new AnonymousClass5());
|
|
this.mSavedStateRegistryController.performRestore(bundle);
|
|
onCreate(bundle);
|
|
this.mIsCreated = true;
|
|
if (this.mCalled) {
|
|
this.mLifecycleRegistry.handleLifecycleEvent(Lifecycle.Event.ON_CREATE);
|
|
return;
|
|
}
|
|
throw new SuperNotCalledException(a.q("Fragment ", this, " did not call through to super.onCreate()"));
|
|
}
|
|
|
|
public boolean performCreateOptionsMenu(@NonNull Menu menu, @NonNull MenuInflater menuInflater) {
|
|
boolean z2 = false;
|
|
if (this.mHidden) {
|
|
return false;
|
|
}
|
|
if (this.mHasMenu && this.mMenuVisible) {
|
|
z2 = true;
|
|
onCreateOptionsMenu(menu, menuInflater);
|
|
}
|
|
return z2 | this.mChildFragmentManager.dispatchCreateOptionsMenu(menu, menuInflater);
|
|
}
|
|
|
|
public void performCreateView(@NonNull LayoutInflater layoutInflater, @Nullable ViewGroup viewGroup, @Nullable Bundle bundle) {
|
|
this.mChildFragmentManager.noteStateNotSaved();
|
|
this.mPerformedCreateView = true;
|
|
this.mViewLifecycleOwner = new FragmentViewLifecycleOwner();
|
|
View onCreateView = onCreateView(layoutInflater, viewGroup, bundle);
|
|
this.mView = onCreateView;
|
|
if (onCreateView != null) {
|
|
this.mViewLifecycleOwner.initialize();
|
|
ViewTreeLifecycleOwner.set(this.mView, this.mViewLifecycleOwner);
|
|
ViewTreeViewModelStoreOwner.set(this.mView, this);
|
|
ViewTreeSavedStateRegistryOwner.set(this.mView, this.mViewLifecycleOwner);
|
|
this.mViewLifecycleOwnerLiveData.setValue(this.mViewLifecycleOwner);
|
|
} else if (!this.mViewLifecycleOwner.isInitialized()) {
|
|
this.mViewLifecycleOwner = null;
|
|
} else {
|
|
throw new IllegalStateException("Called getViewLifecycleOwner() but onCreateView() returned null");
|
|
}
|
|
}
|
|
|
|
public void performDestroy() {
|
|
this.mChildFragmentManager.dispatchDestroy();
|
|
this.mLifecycleRegistry.handleLifecycleEvent(Lifecycle.Event.ON_DESTROY);
|
|
this.mState = 0;
|
|
this.mCalled = false;
|
|
this.mIsCreated = false;
|
|
onDestroy();
|
|
if (!this.mCalled) {
|
|
throw new SuperNotCalledException(a.q("Fragment ", this, " did not call through to super.onDestroy()"));
|
|
}
|
|
}
|
|
|
|
public void performDestroyView() {
|
|
this.mChildFragmentManager.dispatchDestroyView();
|
|
if (this.mView != null && this.mViewLifecycleOwner.getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.CREATED)) {
|
|
this.mViewLifecycleOwner.handleLifecycleEvent(Lifecycle.Event.ON_DESTROY);
|
|
}
|
|
this.mState = 1;
|
|
this.mCalled = false;
|
|
onDestroyView();
|
|
if (this.mCalled) {
|
|
LoaderManager.getInstance(this).markForRedelivery();
|
|
this.mPerformedCreateView = false;
|
|
return;
|
|
}
|
|
throw new SuperNotCalledException(a.q("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) {
|
|
throw new SuperNotCalledException(a.q("Fragment ", this, " did not call through to super.onDetach()"));
|
|
} else if (!this.mChildFragmentManager.isDestroyed()) {
|
|
this.mChildFragmentManager.dispatchDestroy();
|
|
this.mChildFragmentManager = new FragmentManagerImpl();
|
|
}
|
|
}
|
|
|
|
@NonNull
|
|
public LayoutInflater performGetLayoutInflater(@Nullable Bundle bundle) {
|
|
LayoutInflater onGetLayoutInflater = onGetLayoutInflater(bundle);
|
|
this.mLayoutInflater = onGetLayoutInflater;
|
|
return onGetLayoutInflater;
|
|
}
|
|
|
|
public void performLowMemory() {
|
|
onLowMemory();
|
|
this.mChildFragmentManager.dispatchLowMemory();
|
|
}
|
|
|
|
public void performMultiWindowModeChanged(boolean z2) {
|
|
onMultiWindowModeChanged(z2);
|
|
this.mChildFragmentManager.dispatchMultiWindowModeChanged(z2);
|
|
}
|
|
|
|
public boolean performOptionsItemSelected(@NonNull MenuItem menuItem) {
|
|
if (this.mHidden) {
|
|
return false;
|
|
}
|
|
if (!this.mHasMenu || !this.mMenuVisible || !onOptionsItemSelected(menuItem)) {
|
|
return this.mChildFragmentManager.dispatchOptionsItemSelected(menuItem);
|
|
}
|
|
return true;
|
|
}
|
|
|
|
public void performOptionsMenuClosed(@NonNull Menu menu) {
|
|
if (!this.mHidden) {
|
|
if (this.mHasMenu && this.mMenuVisible) {
|
|
onOptionsMenuClosed(menu);
|
|
}
|
|
this.mChildFragmentManager.dispatchOptionsMenuClosed(menu);
|
|
}
|
|
}
|
|
|
|
public void performPause() {
|
|
this.mChildFragmentManager.dispatchPause();
|
|
if (this.mView != null) {
|
|
this.mViewLifecycleOwner.handleLifecycleEvent(Lifecycle.Event.ON_PAUSE);
|
|
}
|
|
this.mLifecycleRegistry.handleLifecycleEvent(Lifecycle.Event.ON_PAUSE);
|
|
this.mState = 6;
|
|
this.mCalled = false;
|
|
onPause();
|
|
if (!this.mCalled) {
|
|
throw new SuperNotCalledException(a.q("Fragment ", this, " did not call through to super.onPause()"));
|
|
}
|
|
}
|
|
|
|
public void performPictureInPictureModeChanged(boolean z2) {
|
|
onPictureInPictureModeChanged(z2);
|
|
this.mChildFragmentManager.dispatchPictureInPictureModeChanged(z2);
|
|
}
|
|
|
|
public boolean performPrepareOptionsMenu(@NonNull Menu menu) {
|
|
boolean z2 = false;
|
|
if (this.mHidden) {
|
|
return false;
|
|
}
|
|
if (this.mHasMenu && this.mMenuVisible) {
|
|
z2 = true;
|
|
onPrepareOptionsMenu(menu);
|
|
}
|
|
return z2 | this.mChildFragmentManager.dispatchPrepareOptionsMenu(menu);
|
|
}
|
|
|
|
public void performPrimaryNavigationFragmentChanged() {
|
|
boolean isPrimaryNavigation = this.mFragmentManager.isPrimaryNavigation(this);
|
|
Boolean bool = this.mIsPrimaryNavigationFragment;
|
|
if (bool == null || bool.booleanValue() != isPrimaryNavigation) {
|
|
this.mIsPrimaryNavigationFragment = Boolean.valueOf(isPrimaryNavigation);
|
|
onPrimaryNavigationFragmentChanged(isPrimaryNavigation);
|
|
this.mChildFragmentManager.dispatchPrimaryNavigationFragmentChanged();
|
|
}
|
|
}
|
|
|
|
public void performResume() {
|
|
this.mChildFragmentManager.noteStateNotSaved();
|
|
this.mChildFragmentManager.execPendingActions(true);
|
|
this.mState = 7;
|
|
this.mCalled = false;
|
|
onResume();
|
|
if (this.mCalled) {
|
|
LifecycleRegistry lifecycleRegistry = this.mLifecycleRegistry;
|
|
Lifecycle.Event event = Lifecycle.Event.ON_RESUME;
|
|
lifecycleRegistry.handleLifecycleEvent(event);
|
|
if (this.mView != null) {
|
|
this.mViewLifecycleOwner.handleLifecycleEvent(event);
|
|
}
|
|
this.mChildFragmentManager.dispatchResume();
|
|
return;
|
|
}
|
|
throw new SuperNotCalledException(a.q("Fragment ", this, " did not call through to super.onResume()"));
|
|
}
|
|
|
|
public void performSaveInstanceState(Bundle bundle) {
|
|
onSaveInstanceState(bundle);
|
|
this.mSavedStateRegistryController.performSave(bundle);
|
|
Parcelable saveAllState = this.mChildFragmentManager.saveAllState();
|
|
if (saveAllState != null) {
|
|
bundle.putParcelable("android:support:fragments", saveAllState);
|
|
}
|
|
}
|
|
|
|
public void performStart() {
|
|
this.mChildFragmentManager.noteStateNotSaved();
|
|
this.mChildFragmentManager.execPendingActions(true);
|
|
this.mState = 5;
|
|
this.mCalled = false;
|
|
onStart();
|
|
if (this.mCalled) {
|
|
LifecycleRegistry lifecycleRegistry = this.mLifecycleRegistry;
|
|
Lifecycle.Event event = Lifecycle.Event.ON_START;
|
|
lifecycleRegistry.handleLifecycleEvent(event);
|
|
if (this.mView != null) {
|
|
this.mViewLifecycleOwner.handleLifecycleEvent(event);
|
|
}
|
|
this.mChildFragmentManager.dispatchStart();
|
|
return;
|
|
}
|
|
throw new SuperNotCalledException(a.q("Fragment ", this, " did not call through to super.onStart()"));
|
|
}
|
|
|
|
public void performStop() {
|
|
this.mChildFragmentManager.dispatchStop();
|
|
if (this.mView != null) {
|
|
this.mViewLifecycleOwner.handleLifecycleEvent(Lifecycle.Event.ON_STOP);
|
|
}
|
|
this.mLifecycleRegistry.handleLifecycleEvent(Lifecycle.Event.ON_STOP);
|
|
this.mState = 4;
|
|
this.mCalled = false;
|
|
onStop();
|
|
if (!this.mCalled) {
|
|
throw new SuperNotCalledException(a.q("Fragment ", this, " did not call through to super.onStop()"));
|
|
}
|
|
}
|
|
|
|
public void performViewCreated() {
|
|
onViewCreated(this.mView, this.mSavedFragmentState);
|
|
this.mChildFragmentManager.dispatchViewCreated();
|
|
}
|
|
|
|
public void postponeEnterTransition() {
|
|
ensureAnimationInfo().mEnterTransitionPostponed = true;
|
|
}
|
|
|
|
public final void postponeEnterTransition(long j, @NonNull TimeUnit timeUnit) {
|
|
ensureAnimationInfo().mEnterTransitionPostponed = true;
|
|
FragmentManager fragmentManager = this.mFragmentManager;
|
|
Handler handler = fragmentManager != null ? fragmentManager.getHost().getHandler() : new Handler(Looper.getMainLooper());
|
|
handler.removeCallbacks(this.mPostponedDurationRunnable);
|
|
handler.postDelayed(this.mPostponedDurationRunnable, timeUnit.toMillis(j));
|
|
}
|
|
|
|
@Override // androidx.activity.result.ActivityResultCaller
|
|
@NonNull
|
|
@MainThread
|
|
public final <I, O> ActivityResultLauncher<I> registerForActivityResult(@NonNull ActivityResultContract<I, O> activityResultContract, @NonNull ActivityResultCallback<O> activityResultCallback) {
|
|
return prepareCallInternal(activityResultContract, new AnonymousClass6(), activityResultCallback);
|
|
}
|
|
|
|
@Override // androidx.activity.result.ActivityResultCaller
|
|
@NonNull
|
|
@MainThread
|
|
public final <I, O> ActivityResultLauncher<I> registerForActivityResult(@NonNull ActivityResultContract<I, O> activityResultContract, @NonNull ActivityResultRegistry activityResultRegistry, @NonNull ActivityResultCallback<O> activityResultCallback) {
|
|
return prepareCallInternal(activityResultContract, new AnonymousClass7(activityResultRegistry), activityResultCallback);
|
|
}
|
|
|
|
public void registerForContextMenu(@NonNull View view) {
|
|
view.setOnCreateContextMenuListener(this);
|
|
}
|
|
|
|
@Deprecated
|
|
public final void requestPermissions(@NonNull String[] strArr, int i) {
|
|
if (this.mHost != null) {
|
|
getParentFragmentManager().launchRequestPermissions(this, strArr, i);
|
|
return;
|
|
}
|
|
throw new IllegalStateException(a.q("Fragment ", this, " not attached to Activity"));
|
|
}
|
|
|
|
@NonNull
|
|
public final FragmentActivity requireActivity() {
|
|
FragmentActivity activity = getActivity();
|
|
if (activity != null) {
|
|
return activity;
|
|
}
|
|
throw new IllegalStateException(a.q("Fragment ", this, " not attached to an activity."));
|
|
}
|
|
|
|
@NonNull
|
|
public final Bundle requireArguments() {
|
|
Bundle arguments = getArguments();
|
|
if (arguments != null) {
|
|
return arguments;
|
|
}
|
|
throw new IllegalStateException(a.q("Fragment ", this, " does not have any arguments."));
|
|
}
|
|
|
|
@NonNull
|
|
public final Context requireContext() {
|
|
Context context = getContext();
|
|
if (context != null) {
|
|
return context;
|
|
}
|
|
throw new IllegalStateException(a.q("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(a.q("Fragment ", this, " not attached to a host."));
|
|
}
|
|
|
|
@NonNull
|
|
public final Fragment requireParentFragment() {
|
|
Fragment parentFragment = getParentFragment();
|
|
if (parentFragment != null) {
|
|
return parentFragment;
|
|
}
|
|
if (getContext() == null) {
|
|
throw new IllegalStateException(a.q("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());
|
|
}
|
|
|
|
@NonNull
|
|
public final View requireView() {
|
|
View view = getView();
|
|
if (view != null) {
|
|
return view;
|
|
}
|
|
throw new IllegalStateException(a.q("Fragment ", this, " did not return a View from onCreateView() or this was called before onCreateView()."));
|
|
}
|
|
|
|
public void restoreChildFragmentState(@Nullable Bundle bundle) {
|
|
Parcelable parcelable;
|
|
if (bundle != null && (parcelable = bundle.getParcelable("android:support:fragments")) != null) {
|
|
this.mChildFragmentManager.restoreSaveState(parcelable);
|
|
this.mChildFragmentManager.dispatchCreate();
|
|
}
|
|
}
|
|
|
|
public final void restoreViewState(Bundle bundle) {
|
|
SparseArray<Parcelable> sparseArray = this.mSavedViewState;
|
|
if (sparseArray != null) {
|
|
this.mView.restoreHierarchyState(sparseArray);
|
|
this.mSavedViewState = null;
|
|
}
|
|
if (this.mView != null) {
|
|
this.mViewLifecycleOwner.performRestore(this.mSavedViewRegistryState);
|
|
this.mSavedViewRegistryState = null;
|
|
}
|
|
this.mCalled = false;
|
|
onViewStateRestored(bundle);
|
|
if (!this.mCalled) {
|
|
throw new SuperNotCalledException(a.q("Fragment ", this, " did not call through to super.onViewStateRestored()"));
|
|
} else if (this.mView != null) {
|
|
this.mViewLifecycleOwner.handleLifecycleEvent(Lifecycle.Event.ON_CREATE);
|
|
}
|
|
}
|
|
|
|
public void setAllowEnterTransitionOverlap(boolean z2) {
|
|
ensureAnimationInfo().mAllowEnterTransitionOverlap = Boolean.valueOf(z2);
|
|
}
|
|
|
|
public void setAllowReturnTransitionOverlap(boolean z2) {
|
|
ensureAnimationInfo().mAllowReturnTransitionOverlap = Boolean.valueOf(z2);
|
|
}
|
|
|
|
public void setAnimatingAway(View view) {
|
|
ensureAnimationInfo().mAnimatingAway = view;
|
|
}
|
|
|
|
public void setAnimator(Animator animator) {
|
|
ensureAnimationInfo().mAnimator = animator;
|
|
}
|
|
|
|
public void setArguments(@Nullable Bundle bundle) {
|
|
if (this.mFragmentManager == null || !isStateSaved()) {
|
|
this.mArguments = bundle;
|
|
return;
|
|
}
|
|
throw new IllegalStateException("Fragment already added and state has been saved");
|
|
}
|
|
|
|
public void setEnterSharedElementCallback(@Nullable SharedElementCallback sharedElementCallback) {
|
|
ensureAnimationInfo().mEnterTransitionCallback = sharedElementCallback;
|
|
}
|
|
|
|
public void setEnterTransition(@Nullable Object obj) {
|
|
ensureAnimationInfo().mEnterTransition = obj;
|
|
}
|
|
|
|
public void setExitSharedElementCallback(@Nullable SharedElementCallback sharedElementCallback) {
|
|
ensureAnimationInfo().mExitTransitionCallback = sharedElementCallback;
|
|
}
|
|
|
|
public void setExitTransition(@Nullable Object obj) {
|
|
ensureAnimationInfo().mExitTransition = obj;
|
|
}
|
|
|
|
public void setFocusedView(View view) {
|
|
ensureAnimationInfo().mFocusedView = view;
|
|
}
|
|
|
|
public void setHasOptionsMenu(boolean z2) {
|
|
if (this.mHasMenu != z2) {
|
|
this.mHasMenu = z2;
|
|
if (isAdded() && !isHidden()) {
|
|
this.mHost.onSupportInvalidateOptionsMenu();
|
|
}
|
|
}
|
|
}
|
|
|
|
public void setHideReplaced(boolean z2) {
|
|
ensureAnimationInfo().mIsHideReplaced = z2;
|
|
}
|
|
|
|
public void setInitialSavedState(@Nullable SavedState savedState) {
|
|
Bundle bundle;
|
|
if (this.mFragmentManager == null) {
|
|
if (savedState == null || (bundle = savedState.mState) == null) {
|
|
bundle = null;
|
|
}
|
|
this.mSavedFragmentState = bundle;
|
|
return;
|
|
}
|
|
throw new IllegalStateException("Fragment already added");
|
|
}
|
|
|
|
public void setMenuVisibility(boolean z2) {
|
|
if (this.mMenuVisible != z2) {
|
|
this.mMenuVisible = z2;
|
|
if (this.mHasMenu && isAdded() && !isHidden()) {
|
|
this.mHost.onSupportInvalidateOptionsMenu();
|
|
}
|
|
}
|
|
}
|
|
|
|
public void setNextAnim(int i) {
|
|
if (this.mAnimationInfo != null || i != 0) {
|
|
ensureAnimationInfo().mNextAnim = i;
|
|
}
|
|
}
|
|
|
|
public void setNextTransition(int i) {
|
|
if (this.mAnimationInfo != null || i != 0) {
|
|
ensureAnimationInfo();
|
|
this.mAnimationInfo.mNextTransition = i;
|
|
}
|
|
}
|
|
|
|
public void setOnStartEnterTransitionListener(OnStartEnterTransitionListener onStartEnterTransitionListener) {
|
|
ensureAnimationInfo();
|
|
AnimationInfo animationInfo = this.mAnimationInfo;
|
|
OnStartEnterTransitionListener onStartEnterTransitionListener2 = animationInfo.mStartEnterTransitionListener;
|
|
if (onStartEnterTransitionListener != onStartEnterTransitionListener2) {
|
|
if (onStartEnterTransitionListener == null || onStartEnterTransitionListener2 == null) {
|
|
if (animationInfo.mEnterTransitionPostponed) {
|
|
animationInfo.mStartEnterTransitionListener = onStartEnterTransitionListener;
|
|
}
|
|
if (onStartEnterTransitionListener != null) {
|
|
onStartEnterTransitionListener.startListening();
|
|
return;
|
|
}
|
|
return;
|
|
}
|
|
throw new IllegalStateException("Trying to set a replacement startPostponedEnterTransition on " + this);
|
|
}
|
|
}
|
|
|
|
public void setPostOnViewCreatedAlpha(float f) {
|
|
ensureAnimationInfo().mPostOnViewCreatedAlpha = f;
|
|
}
|
|
|
|
public void setReenterTransition(@Nullable Object obj) {
|
|
ensureAnimationInfo().mReenterTransition = obj;
|
|
}
|
|
|
|
@Deprecated
|
|
public void setRetainInstance(boolean z2) {
|
|
this.mRetainInstance = z2;
|
|
FragmentManager fragmentManager = this.mFragmentManager;
|
|
if (fragmentManager == null) {
|
|
this.mRetainInstanceChangedWhileDetached = true;
|
|
} else if (z2) {
|
|
fragmentManager.addRetainedFragment(this);
|
|
} else {
|
|
fragmentManager.removeRetainedFragment(this);
|
|
}
|
|
}
|
|
|
|
public void setReturnTransition(@Nullable Object obj) {
|
|
ensureAnimationInfo().mReturnTransition = obj;
|
|
}
|
|
|
|
public void setSharedElementEnterTransition(@Nullable Object obj) {
|
|
ensureAnimationInfo().mSharedElementEnterTransition = obj;
|
|
}
|
|
|
|
public void setSharedElementNames(@Nullable ArrayList<String> arrayList, @Nullable ArrayList<String> arrayList2) {
|
|
ensureAnimationInfo();
|
|
AnimationInfo animationInfo = this.mAnimationInfo;
|
|
animationInfo.mSharedElementSourceNames = arrayList;
|
|
animationInfo.mSharedElementTargetNames = arrayList2;
|
|
}
|
|
|
|
public void setSharedElementReturnTransition(@Nullable Object obj) {
|
|
ensureAnimationInfo().mSharedElementReturnTransition = obj;
|
|
}
|
|
|
|
@Deprecated
|
|
public void setTargetFragment(@Nullable Fragment fragment, int i) {
|
|
FragmentManager fragmentManager = this.mFragmentManager;
|
|
FragmentManager fragmentManager2 = fragment != null ? fragment.mFragmentManager : null;
|
|
if (fragmentManager == null || fragmentManager2 == null || fragmentManager == fragmentManager2) {
|
|
for (Fragment fragment2 = fragment; fragment2 != null; fragment2 = fragment2.getTargetFragment()) {
|
|
if (fragment2.equals(this)) {
|
|
throw new IllegalArgumentException("Setting " + fragment + " as the target of " + this + " would create a target cycle");
|
|
}
|
|
}
|
|
if (fragment == null) {
|
|
this.mTargetWho = null;
|
|
this.mTarget = null;
|
|
} else if (this.mFragmentManager == null || fragment.mFragmentManager == null) {
|
|
this.mTargetWho = null;
|
|
this.mTarget = fragment;
|
|
} else {
|
|
this.mTargetWho = fragment.mWho;
|
|
this.mTarget = null;
|
|
}
|
|
this.mTargetRequestCode = i;
|
|
return;
|
|
}
|
|
throw new IllegalArgumentException(a.q("Fragment ", fragment, " must share the same FragmentManager to be set as a target fragment"));
|
|
}
|
|
|
|
@Deprecated
|
|
public void setUserVisibleHint(boolean z2) {
|
|
if (!this.mUserVisibleHint && z2 && this.mState < 5 && this.mFragmentManager != null && isAdded() && this.mIsCreated) {
|
|
FragmentManager fragmentManager = this.mFragmentManager;
|
|
fragmentManager.performPendingDeferredStart(fragmentManager.createOrGetFragmentStateManager(this));
|
|
}
|
|
this.mUserVisibleHint = z2;
|
|
this.mDeferStart = this.mState < 5 && !z2;
|
|
if (this.mSavedFragmentState != null) {
|
|
this.mSavedUserVisibleHint = Boolean.valueOf(z2);
|
|
}
|
|
}
|
|
|
|
public boolean shouldShowRequestPermissionRationale(@NonNull String str) {
|
|
FragmentHostCallback<?> fragmentHostCallback = this.mHost;
|
|
if (fragmentHostCallback != null) {
|
|
return fragmentHostCallback.onShouldShowRequestPermissionRationale(str);
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public void startActivity(@SuppressLint({"UnknownNullness"}) Intent intent) {
|
|
startActivity(intent, null);
|
|
}
|
|
|
|
public void startActivity(@SuppressLint({"UnknownNullness"}) Intent intent, @Nullable Bundle bundle) {
|
|
FragmentHostCallback<?> fragmentHostCallback = this.mHost;
|
|
if (fragmentHostCallback != null) {
|
|
fragmentHostCallback.onStartActivityFromFragment(this, intent, -1, bundle);
|
|
return;
|
|
}
|
|
throw new IllegalStateException(a.q("Fragment ", this, " not attached to Activity"));
|
|
}
|
|
|
|
@Deprecated
|
|
public void startActivityForResult(@SuppressLint({"UnknownNullness"}) Intent intent, int i) {
|
|
startActivityForResult(intent, i, null);
|
|
}
|
|
|
|
@Deprecated
|
|
public void startActivityForResult(@SuppressLint({"UnknownNullness"}) Intent intent, int i, @Nullable Bundle bundle) {
|
|
if (this.mHost != null) {
|
|
getParentFragmentManager().launchStartActivityForResult(this, intent, i, bundle);
|
|
return;
|
|
}
|
|
throw new IllegalStateException(a.q("Fragment ", this, " not attached to Activity"));
|
|
}
|
|
|
|
@Deprecated
|
|
public void startIntentSenderForResult(@SuppressLint({"UnknownNullness"}) IntentSender intentSender, int i, @Nullable Intent intent, int i2, int i3, int i4, @Nullable Bundle bundle) throws IntentSender.SendIntentException {
|
|
if (this.mHost != null) {
|
|
if (FragmentManager.isLoggingEnabled(2)) {
|
|
Log.v("FragmentManager", "Fragment " + this + " received the following in startIntentSenderForResult() requestCode: " + i + " IntentSender: " + intentSender + " fillInIntent: " + intent + " options: " + bundle);
|
|
}
|
|
getParentFragmentManager().launchStartIntentSenderForResult(this, intentSender, i, intent, i2, i3, i4, bundle);
|
|
return;
|
|
}
|
|
throw new IllegalStateException(a.q("Fragment ", this, " not attached to Activity"));
|
|
}
|
|
|
|
public void startPostponedEnterTransition() {
|
|
if (this.mAnimationInfo != null && ensureAnimationInfo().mEnterTransitionPostponed) {
|
|
if (this.mHost == null) {
|
|
ensureAnimationInfo().mEnterTransitionPostponed = false;
|
|
} else if (Looper.myLooper() != this.mHost.getHandler().getLooper()) {
|
|
this.mHost.getHandler().postAtFrontOfQueue(new AnonymousClass2());
|
|
} else {
|
|
callStartTransitionListener(true);
|
|
}
|
|
}
|
|
}
|
|
|
|
@Override // java.lang.Object
|
|
@NonNull
|
|
public String toString() {
|
|
StringBuilder sb = new StringBuilder(128);
|
|
sb.append(getClass().getSimpleName());
|
|
sb.append("{");
|
|
sb.append(Integer.toHexString(System.identityHashCode(this)));
|
|
sb.append("}");
|
|
sb.append(" (");
|
|
sb.append(this.mWho);
|
|
sb.append(")");
|
|
if (this.mFragmentId != 0) {
|
|
sb.append(" id=0x");
|
|
sb.append(Integer.toHexString(this.mFragmentId));
|
|
}
|
|
if (this.mTag != null) {
|
|
sb.append(" ");
|
|
sb.append(this.mTag);
|
|
}
|
|
sb.append('}');
|
|
return sb.toString();
|
|
}
|
|
|
|
public void unregisterForContextMenu(@NonNull View view) {
|
|
view.setOnCreateContextMenuListener(null);
|
|
}
|
|
}
|