package o; import android.os.Parcelable; import android.view.View; import android.view.ViewGroup; import androidx.fragment.app.Fragment; import o.AbstractC13482fbE; import o.wdQ; @Deprecated /* loaded from: classes.dex */ public abstract class rgb extends WYJ { private boolean a; private final int b; private Fragment c; private final yRS d; private AbstractC13482fbE e; public abstract Fragment e(int i); @Override // o.WYJ public void restoreState(Parcelable parcelable, ClassLoader classLoader) { } @Override // o.WYJ public Parcelable saveState() { return null; } @Deprecated public rgb(yRS yrs) { this(yrs, (byte) 0); } private rgb(yRS yrs, byte b) { this.e = null; this.c = null; this.d = yrs; this.b = 0; } @Override // o.WYJ public void startUpdate(ViewGroup viewGroup) { if (viewGroup.getId() != -1) { return; } StringBuilder sb = new StringBuilder("ViewPager with adapter "); sb.append(this); sb.append(" requires a view id"); throw new IllegalStateException(sb.toString()); } @Override // o.WYJ public Object instantiateItem(ViewGroup viewGroup, int i) { if (this.e == null) { this.e = this.d.a(); } long j = i; int id = viewGroup.getId(); StringBuilder sb = new StringBuilder("android:switcher:"); sb.append(id); sb.append(":"); sb.append(j); Fragment findFragmentByTag = this.d.findFragmentByTag(sb.toString()); if (findFragmentByTag == null) { findFragmentByTag = e(i); AbstractC13482fbE abstractC13482fbE = this.e; int id2 = viewGroup.getId(); int id3 = viewGroup.getId(); StringBuilder sb2 = new StringBuilder("android:switcher:"); sb2.append(id3); sb2.append(":"); sb2.append(j); abstractC13482fbE.b(id2, findFragmentByTag, sb2.toString(), 1); } else { this.e.b(new AbstractC13482fbE.RVV(7, findFragmentByTag)); } if (findFragmentByTag != this.c) { findFragmentByTag.setMenuVisibility(false); if (this.b == 1) { this.e.d(findFragmentByTag, wdQ.IeS.STARTED); } else { findFragmentByTag.setUserVisibleHint(false); } } return findFragmentByTag; } @Override // o.WYJ public void destroyItem(ViewGroup viewGroup, int i, Object obj) { Fragment fragment = (Fragment) obj; if (this.e == null) { this.e = this.d.a(); } this.e.d(fragment); if (fragment.equals(this.c)) { this.c = null; } } @Override // o.WYJ public void setPrimaryItem(ViewGroup viewGroup, int i, Object obj) { Fragment fragment = (Fragment) obj; Fragment fragment2 = this.c; if (fragment != fragment2) { if (fragment2 != null) { fragment2.setMenuVisibility(false); if (this.b == 1) { if (this.e == null) { this.e = this.d.a(); } this.e.d(this.c, wdQ.IeS.STARTED); } else { this.c.setUserVisibleHint(false); } } fragment.setMenuVisibility(true); if (this.b == 1) { if (this.e == null) { this.e = this.d.a(); } this.e.d(fragment, wdQ.IeS.RESUMED); } else { fragment.setUserVisibleHint(true); } this.c = fragment; } } @Override // o.WYJ public void finishUpdate(ViewGroup viewGroup) { AbstractC13482fbE abstractC13482fbE = this.e; if (abstractC13482fbE != null) { if (!this.a) { try { this.a = true; abstractC13482fbE.e(); } finally { this.a = false; } } this.e = null; } } @Override // o.WYJ public boolean isViewFromObject(View view, Object obj) { return ((Fragment) obj).getView() == view; } }