- Added realracing3-community.apk (71.57 MB) - Removed 32-bit support (armeabi-v7a) - Only includes arm64-v8a libraries - Decompiled source code included - Added README-community.md with analysis
155 lines
5.7 KiB
Java
155 lines
5.7 KiB
Java
package androidx.fragment.app;
|
|
|
|
import android.os.Parcelable;
|
|
import android.view.View;
|
|
import android.view.ViewGroup;
|
|
import androidx.annotation.NonNull;
|
|
import androidx.annotation.Nullable;
|
|
import androidx.lifecycle.Lifecycle;
|
|
import androidx.viewpager.widget.PagerAdapter;
|
|
import com.facebook.internal.security.CertificateUtil;
|
|
|
|
@Deprecated
|
|
/* loaded from: classes.dex */
|
|
public abstract class FragmentPagerAdapter extends PagerAdapter {
|
|
public static final int BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT = 1;
|
|
|
|
@Deprecated
|
|
public static final int BEHAVIOR_SET_USER_VISIBLE_HINT = 0;
|
|
private static final boolean DEBUG = false;
|
|
private static final String TAG = "FragmentPagerAdapter";
|
|
private final int mBehavior;
|
|
private FragmentTransaction mCurTransaction;
|
|
private Fragment mCurrentPrimaryItem;
|
|
private boolean mExecutingFinishUpdate;
|
|
private final FragmentManager mFragmentManager;
|
|
|
|
@NonNull
|
|
public abstract Fragment getItem(int i);
|
|
|
|
public long getItemId(int i) {
|
|
return i;
|
|
}
|
|
|
|
@Override // androidx.viewpager.widget.PagerAdapter
|
|
public void restoreState(@Nullable Parcelable parcelable, @Nullable ClassLoader classLoader) {
|
|
}
|
|
|
|
@Override // androidx.viewpager.widget.PagerAdapter
|
|
@Nullable
|
|
public Parcelable saveState() {
|
|
return null;
|
|
}
|
|
|
|
@Deprecated
|
|
public FragmentPagerAdapter(@NonNull FragmentManager fragmentManager) {
|
|
this(fragmentManager, 0);
|
|
}
|
|
|
|
public FragmentPagerAdapter(@NonNull FragmentManager fragmentManager, int i) {
|
|
this.mCurTransaction = null;
|
|
this.mCurrentPrimaryItem = null;
|
|
this.mFragmentManager = fragmentManager;
|
|
this.mBehavior = i;
|
|
}
|
|
|
|
@Override // androidx.viewpager.widget.PagerAdapter
|
|
public void startUpdate(@NonNull ViewGroup viewGroup) {
|
|
if (viewGroup.getId() != -1) {
|
|
return;
|
|
}
|
|
throw new IllegalStateException("ViewPager with adapter " + this + " requires a view id");
|
|
}
|
|
|
|
@Override // androidx.viewpager.widget.PagerAdapter
|
|
@NonNull
|
|
public Object instantiateItem(@NonNull ViewGroup viewGroup, int i) {
|
|
if (this.mCurTransaction == null) {
|
|
this.mCurTransaction = this.mFragmentManager.beginTransaction();
|
|
}
|
|
long itemId = getItemId(i);
|
|
Fragment findFragmentByTag = this.mFragmentManager.findFragmentByTag(makeFragmentName(viewGroup.getId(), itemId));
|
|
if (findFragmentByTag != null) {
|
|
this.mCurTransaction.attach(findFragmentByTag);
|
|
} else {
|
|
findFragmentByTag = getItem(i);
|
|
this.mCurTransaction.add(viewGroup.getId(), findFragmentByTag, makeFragmentName(viewGroup.getId(), itemId));
|
|
}
|
|
if (findFragmentByTag != this.mCurrentPrimaryItem) {
|
|
findFragmentByTag.setMenuVisibility(false);
|
|
if (this.mBehavior == 1) {
|
|
this.mCurTransaction.setMaxLifecycle(findFragmentByTag, Lifecycle.State.STARTED);
|
|
} else {
|
|
findFragmentByTag.setUserVisibleHint(false);
|
|
}
|
|
}
|
|
return findFragmentByTag;
|
|
}
|
|
|
|
@Override // androidx.viewpager.widget.PagerAdapter
|
|
public void destroyItem(@NonNull ViewGroup viewGroup, int i, @NonNull Object obj) {
|
|
Fragment fragment = (Fragment) obj;
|
|
if (this.mCurTransaction == null) {
|
|
this.mCurTransaction = this.mFragmentManager.beginTransaction();
|
|
}
|
|
this.mCurTransaction.detach(fragment);
|
|
if (fragment.equals(this.mCurrentPrimaryItem)) {
|
|
this.mCurrentPrimaryItem = null;
|
|
}
|
|
}
|
|
|
|
@Override // androidx.viewpager.widget.PagerAdapter
|
|
public void setPrimaryItem(@NonNull ViewGroup viewGroup, int i, @NonNull Object obj) {
|
|
Fragment fragment = (Fragment) obj;
|
|
Fragment fragment2 = this.mCurrentPrimaryItem;
|
|
if (fragment != fragment2) {
|
|
if (fragment2 != null) {
|
|
fragment2.setMenuVisibility(false);
|
|
if (this.mBehavior == 1) {
|
|
if (this.mCurTransaction == null) {
|
|
this.mCurTransaction = this.mFragmentManager.beginTransaction();
|
|
}
|
|
this.mCurTransaction.setMaxLifecycle(this.mCurrentPrimaryItem, Lifecycle.State.STARTED);
|
|
} else {
|
|
this.mCurrentPrimaryItem.setUserVisibleHint(false);
|
|
}
|
|
}
|
|
fragment.setMenuVisibility(true);
|
|
if (this.mBehavior == 1) {
|
|
if (this.mCurTransaction == null) {
|
|
this.mCurTransaction = this.mFragmentManager.beginTransaction();
|
|
}
|
|
this.mCurTransaction.setMaxLifecycle(fragment, Lifecycle.State.RESUMED);
|
|
} else {
|
|
fragment.setUserVisibleHint(true);
|
|
}
|
|
this.mCurrentPrimaryItem = fragment;
|
|
}
|
|
}
|
|
|
|
@Override // androidx.viewpager.widget.PagerAdapter
|
|
public void finishUpdate(@NonNull ViewGroup viewGroup) {
|
|
FragmentTransaction fragmentTransaction = this.mCurTransaction;
|
|
if (fragmentTransaction != null) {
|
|
if (!this.mExecutingFinishUpdate) {
|
|
try {
|
|
this.mExecutingFinishUpdate = true;
|
|
fragmentTransaction.commitNowAllowingStateLoss();
|
|
} finally {
|
|
this.mExecutingFinishUpdate = false;
|
|
}
|
|
}
|
|
this.mCurTransaction = null;
|
|
}
|
|
}
|
|
|
|
@Override // androidx.viewpager.widget.PagerAdapter
|
|
public boolean isViewFromObject(@NonNull View view, @NonNull Object obj) {
|
|
return ((Fragment) obj).getView() == view;
|
|
}
|
|
|
|
private static String makeFragmentName(int i, long j) {
|
|
return "android:switcher:" + i + CertificateUtil.DELIMITER + j;
|
|
}
|
|
}
|